You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by pi...@locus.apache.org on 2000/09/19 21:26:46 UTC
cvs commit: jakarta-tomcat-4.0/jasper/src/share/org/apache/jasper/compiler Parser.java
pierred 00/09/19 12:26:46
Modified: jasper/src/share/org/apache/jasper/compiler Parser.java
Log:
Support for XML syntax:
- new contructor
(creates the reader and passes it the ctxt)
- we now pass the char[] of text directly to the event listener
so that the listener does not have to refer back to the reader
(so xml parser can also work with listener)
Revision Changes Path
1.2 +27 -3 jakarta-tomcat-4.0/jasper/src/share/org/apache/jasper/compiler/Parser.java
Index: Parser.java
===================================================================
RCS file: /home/cvs/jakarta-tomcat-4.0/jasper/src/share/org/apache/jasper/compiler/Parser.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- Parser.java 2000/08/12 00:52:08 1.1
+++ Parser.java 2000/09/19 19:26:46 1.2
@@ -59,6 +59,9 @@
import java.util.Enumeration;
import java.io.CharArrayWriter;
+import java.io.InputStreamReader;
+import java.io.File;
+
import org.apache.jasper.JasperException;
import org.apache.jasper.Constants;
@@ -66,6 +69,7 @@
import javax.servlet.jsp.tagext.TagInfo;
import org.apache.jasper.logging.Logger;
+import org.apache.jasper.JspCompilationContext;
/**
* The class that parses the JSP input and calls the right methods on
@@ -121,6 +125,26 @@
this.currentFile = reader.mark().getFile();
}
+ // new constructor for JSP1.2
+ public Parser(JspCompilationContext ctxt, File file,
+ String encoding, InputStreamReader inReader,
+ final ParseEventListener lnr)
+ throws ParseException, java.io.FileNotFoundException
+ {
+ this.reader = new JspReader(ctxt, file, encoding, inReader);
+ lnr.setReader(this.reader);
+ this.listener = new DelegatingListener(lnr,
+ new Action() {
+ public void execute(Mark start, Mark stop)
+ throws JasperException
+ {
+ Parser.this.flushCharData(start, stop);
+ }
+ });
+ this.caw = new CharArrayWriter();
+ this.currentFile = reader.mark().getFile();
+ }
+
static final Vector coreElements = new Vector();
/*
@@ -471,7 +495,7 @@
new Object[] { open }));
listener.setTemplateInfo(parser.tmplStart, parser.tmplStop);
- listener.handleDeclaration(start, stop, attrs);
+ listener.handleDeclaration(start, stop, attrs, reader.getChars(start, stop));
return true;
}
}
@@ -525,7 +549,7 @@
Constants.getString("jsp.error.unterminated",
new Object[] { open }));
listener.setTemplateInfo(parser.tmplStart, parser.tmplStop);
- listener.handleExpression(start, stop, attrs);
+ listener.handleExpression(start, stop, attrs, reader.getChars(start, stop));
return true;
}
}
@@ -578,7 +602,7 @@
Constants.getString("jsp.error.unterminated",
new Object[] { open }));
listener.setTemplateInfo(parser.tmplStart, parser.tmplStop);
- listener.handleScriptlet(start, stop, attrs);
+ listener.handleScriptlet(start, stop, attrs, reader.getChars(start, stop));
return true;
}
}