geirm 01/04/22 11:04:00
Modified: src/java/org/apache/velocity/runtime/parser Parser.java
Parser.jj
Log:
Parser.jjt followers.
Revision Changes Path
1.59 +21 -50
jakarta-velocity/src/java/org/apache/velocity/runtime/parser/Parser.java
Index: Parser.java
===================================================================
RCS file:
/home/cvs/jakarta-velocity/src/java/org/apache/velocity/runtime/parser/Parser.java,v
retrieving revision 1.58
retrieving revision 1.59
diff -u -r1.58 -r1.59
--- Parser.java 2001/04/14 02:51:16 1.58
+++ Parser.java 2001/04/22 18:03:59 1.59
@@ -21,7 +21,7 @@
*
* @author <a href="mailto:[EMAIL PROTECTED]">Jason van Zyl</a>
* @author <a href="mailto:[EMAIL PROTECTED]">Geir Magnusson Jr.</a>
- * @version $Id: Parser.java,v 1.58 2001/04/14 02:51:16 geirm Exp $
+ * @version $Id: Parser.java,v 1.59 2001/04/22 18:03:59 geirm Exp $
*/
public class Parser/*@bgen(jjtree)*/implements ParserTreeConstants, ParserConstants
{/*@bgen(jjtree)*/
protected JJTParserState jjtree = new JJTParserState();/**
@@ -34,11 +34,6 @@
*/
String currentTemplateName = "";
- /**
- * encoding for the input stream.
- */
- private String inputEncoding = "ISO-8859-1";
-
/**
* This constructor was added to allow the re-use of parsers.
* The normal constructor takes a single argument which
@@ -49,11 +44,6 @@
public Parser()
{
this(new ByteArrayInputStream("\n".getBytes()));
-
- /*
- * get the encoding property. Default is ISO latin
- */
- inputEncoding = Runtime.getString( Runtime.INPUT_ENCODING, "ISO-8859-1");
}
/**
@@ -65,7 +55,7 @@
* method and re-initializing the lexer with
* the new stream that we want parsed.
*/
- public SimpleNode parse(InputStream stream, String templateName )
+ public SimpleNode parse( Reader reader, String templateName )
throws ParseException
{
SimpleNode sn = null;
@@ -81,29 +71,10 @@
Runtime.dumpVMNamespace( currentTemplateName );
- /*
- * wrap in a reader so users can control the encoding
- * of the template
- */
-
- BufferedReader br = null;
-
- try
- {
- br = new BufferedReader( new InputStreamReader( stream, inputEncoding
) );
- }
- catch( UnsupportedEncodingException uce )
- {
- String msg = "Parser Exception: Unsupported input encoding : " +
inputEncoding
- + " for template " + templateName;
- Runtime.error( msg );
- throw new ParseException( msg );
- }
-
try
{
token_source.clearStateVars();
- ReInit(br);
+ ReInit(reader);
sn = process();
}
catch (ParseException pe)
@@ -2231,6 +2202,18 @@
return retval;
}
+ final private boolean jj_3_5() {
+ if (jj_scan_token(WHITESPACE)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ final private boolean jj_3R_66() {
+ if (jj_scan_token(RCURLY)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
final private boolean jj_3R_19() {
if (jj_3R_32()) return true;
if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
@@ -2505,12 +2488,6 @@
return false;
}
- final private boolean jj_3R_55() {
- if (jj_scan_token(WHITESPACE)) return true;
- if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- return false;
- }
-
final private boolean jj_3R_21() {
Token xsp;
xsp = jj_scanpos;
@@ -2546,6 +2523,12 @@
return false;
}
+ final private boolean jj_3R_55() {
+ if (jj_scan_token(WHITESPACE)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
final private boolean jj_3R_90() {
if (jj_scan_token(DIVIDE)) return true;
if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
@@ -2957,18 +2940,6 @@
final private boolean jj_3R_63() {
if (jj_3R_67()) return true;
- if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- return false;
- }
-
- final private boolean jj_3_5() {
- if (jj_scan_token(WHITESPACE)) return true;
- if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- return false;
- }
-
- final private boolean jj_3R_66() {
- if (jj_scan_token(RCURLY)) return true;
if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
return false;
}
1.57 +3 -32
jakarta-velocity/src/java/org/apache/velocity/runtime/parser/Parser.jj
Index: Parser.jj
===================================================================
RCS file:
/home/cvs/jakarta-velocity/src/java/org/apache/velocity/runtime/parser/Parser.jj,v
retrieving revision 1.56
retrieving revision 1.57
diff -u -r1.56 -r1.57
--- Parser.jj 2001/04/14 02:51:16 1.56
+++ Parser.jj 2001/04/22 18:03:59 1.57
@@ -96,7 +96,7 @@
*
* @author <a href="mailto:[EMAIL PROTECTED]">Jason van Zyl</a>
* @author <a href="mailto:[EMAIL PROTECTED]">Geir Magnusson Jr.</a>
- * @version $Id: Parser.jj,v 1.56 2001/04/14 02:51:16 geirm Exp $
+ * @version $Id: Parser.jj,v 1.57 2001/04/22 18:03:59 geirm Exp $
*/
public class Parser/*@bgen(jjtree)*/implements ParserTreeConstants/*@egen*/
{/*@bgen(jjtree)*/
@@ -113,11 +113,6 @@
*/
String currentTemplateName = "";
- /**
- * encoding for the input stream.
- */
- private String inputEncoding = "ISO-8859-1";
-
/**
* This constructor was added to allow the re-use of parsers.
* The normal constructor takes a single argument which
@@ -128,11 +123,6 @@
public Parser()
{
this(new ByteArrayInputStream("\n".getBytes()));
-
- /*
- * get the encoding property. Default is ISO latin
- */
- inputEncoding = Runtime.getString( Runtime.INPUT_ENCODING, "ISO-8859-1");
}
/**
@@ -144,7 +134,7 @@
* method and re-initializing the lexer with
* the new stream that we want parsed.
*/
- public SimpleNode parse(InputStream stream, String templateName )
+ public SimpleNode parse( Reader reader, String templateName )
throws ParseException
{
SimpleNode sn = null;
@@ -160,29 +150,10 @@
Runtime.dumpVMNamespace( currentTemplateName );
- /*
- * wrap in a reader so users can control the encoding
- * of the template
- */
-
- BufferedReader br = null;
-
- try
- {
- br = new BufferedReader( new InputStreamReader( stream, inputEncoding
) );
- }
- catch( UnsupportedEncodingException uce )
- {
- String msg = "Parser Exception: Unsupported input encoding : " +
inputEncoding
- + " for template " + templateName;
- Runtime.error( msg );
- throw new ParseException( msg );
- }
-
try
{
token_source.clearStateVars();
- ReInit(br);
+ ReInit(reader);
sn = process();
}
catch (ParseException pe)