You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@velocity.apache.org by ge...@locus.apache.org on 2000/12/11 05:26:25 UTC
cvs commit: jakarta-velocity/src/java/org/apache/velocity/runtime/parser Parser.java Parser.jj Parser.jjt ParserTokenManager.java
geirm 00/12/10 20:26:24
Modified: src/java/org/apache/velocity/runtime/parser Parser.java
Parser.jj Parser.jjt ParserTokenManager.java
Log:
No functional changes. Aligned var decls with convention.
Revision Changes Path
1.42 +61 -60 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.41
retrieving revision 1.42
diff -u -r1.41 -r1.42
--- Parser.java 2000/12/10 04:50:04 1.41
+++ Parser.java 2000/12/11 04:26:23 1.42
@@ -21,7 +21,7 @@
*
* @author <a href="mailto:jvanzyl@periapt.com">Jason van Zyl</a>
* @author <a href="mailto:geirm@optonline.net">Geir Magnusson Jr.</a>
- * @version $Id: Parser.java,v 1.41 2000/12/10 04:50:04 geirm Exp $
+ * @version $Id: Parser.java,v 1.42 2000/12/11 04:26:23 geirm Exp $
*/
public class Parser/*@bgen(jjtree)*/implements ParserTreeConstants, ParserConstants {/*@bgen(jjtree)*/
protected JJTParserState jjtree = new JJTParserState();/**
@@ -33,7 +33,7 @@
* Name of current template we are parsing. Passed to us in parse()
*/
- String strCurrentTemplateName = "";
+ String currentTemplateName = "";
/**
* This constructor was added to allow the re-use of parsers.
@@ -56,11 +56,12 @@
* method and re-initializing the lexer with
* the new stream that we want parsed.
*/
- public SimpleNode parse(InputStream stream, String strTemplateName ) throws ParseException
+ public SimpleNode parse(InputStream stream, String templateName )
+ throws ParseException
{
SimpleNode sn = null;
- strCurrentTemplateName = strTemplateName;
+ currentTemplateName = templateName;
/*
* clearing the VM namespace for this template
@@ -69,7 +70,7 @@
* that it should be done.
*/
- Runtime.dumpVMNamespace( strCurrentTemplateName );
+ Runtime.dumpVMNamespace( currentTemplateName );
try
{
@@ -79,16 +80,16 @@
}
catch (ParseException pe)
{
- Runtime.error ("Parser Exception: " + strTemplateName + " : " + StringUtils.stackTrace(pe));
+ Runtime.error ("Parser Exception: " + templateName + " : " + StringUtils.stackTrace(pe));
throw new ParseException (pe.currentToken,
pe.expectedTokenSequences, pe.tokenImage);
}
catch (Exception e)
{
- Runtime.error ("Parser Error: " + strTemplateName + " : " + StringUtils.stackTrace(e));
+ Runtime.error ("Parser Error: " + templateName + " : " + StringUtils.stackTrace(e));
}
- strCurrentTemplateName = "";
+ currentTemplateName = "";
return sn;
}
@@ -142,7 +143,7 @@
{
bRecognizedDirective = true;
}
- else if (Runtime.isVelocimacro( strDirective.substring(1), strCurrentTemplateName))
+ else if (Runtime.isVelocimacro( strDirective.substring(1), currentTemplateName))
{
bRecognizedDirective = true;
}
@@ -334,12 +335,12 @@
jjtree.openNodeScope(jjtn000);
try {
Token t = null;
- int iCount = 0;
- boolean bControl = false;
+ int count = 0;
+ boolean control = false;
label_2:
while (true) {
t = jj_consume_token(DOUBLE_ESCAPE);
- iCount++;
+ count++;
if (jj_2_1(2)) {
;
} else {
@@ -357,7 +358,7 @@
case ELSEIF_DIRECTIVE :
case END :
case STOP_DIRECTIVE :
- bControl = true;
+ control = true;
break;
}
@@ -366,14 +367,14 @@
*/
if ( isDirective( t.next.image.substring(1)))
- bControl = true;
- else if ( Runtime.isVelocimacro( t.next.image.substring(1), strCurrentTemplateName))
- bControl = true;
+ control = true;
+ else if ( Runtime.isVelocimacro( t.next.image.substring(1), currentTemplateName))
+ control = true;
t.image = "";
- for( int i = 0; i < iCount; i++)
- t.image += (bControl ? "\\" : "\\\\");
+ for( int i = 0; i < count; i++)
+ t.image += ( control ? "\\" : "\\\\");
} finally {
if (jjtc000) {
jjtree.closeNodeScope(jjtn000, true);
@@ -520,16 +521,16 @@
boolean jjtc000 = true;
jjtree.openNodeScope(jjtn000);Token t = null;
Directive d;
- boolean bDoItNow = false;
+ boolean doItNow = false;
try {
/*
* note that if we were escaped, that is now handled by
* EscapedDirective()
*/
t = jj_consume_token(WORD);
- String strDirectiveName = t.image.substring(1);
+ String directiveName = t.image.substring(1);
- d = (Directive) directives.get( strDirectiveName );
+ d = (Directive) directives.get( directiveName );
/*
* Velocimacro support : if the directive is macro directive
@@ -537,9 +538,9 @@
* right then. (So available if used w/in the current template )
*/
- if ( strDirectiveName.equals("macro"))
+ if ( directiveName.equals("macro"))
{
- bDoItNow = true;
+ doItNow = true;
}
/*
@@ -547,7 +548,7 @@
* about parser tokens
*/
- jjtn000.setDirectiveName( strDirectiveName );
+ jjtn000.setDirectiveName( directiveName );
if ( d == null)
{
@@ -555,7 +556,7 @@
* if null, then not a real directive, but maybe a Velocimacro
*/
- d = (Directive) Runtime.getVelocimacro( strDirectiveName, strCurrentTemplateName );
+ d = (Directive) Runtime.getVelocimacro( directiveName, currentTemplateName );
if (d == null)
{
@@ -663,10 +664,10 @@
* we don't have to worry about forward references and such...
*/
- if (bDoItNow)
+ if ( doItNow )
{
Macro m = new Macro();
- m.processAndRegister( jjtn000, strCurrentTemplateName );
+ m.processAndRegister( jjtn000, currentTemplateName );
}
/*
@@ -2078,39 +2079,6 @@
return retval;
}
- final private boolean jj_3R_69() {
- if (jj_scan_token(LOGICAL_NOT_EQUALS)) return true;
- if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- if (jj_3R_58()) return true;
- if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- return false;
- }
-
- final private boolean jj_3R_68() {
- if (jj_scan_token(LOGICAL_EQUALS)) return true;
- if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- if (jj_3R_58()) return true;
- if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- return false;
- }
-
- final private boolean jj_3R_65() {
- Token xsp;
- xsp = jj_scanpos;
- if (jj_3R_68()) {
- jj_scanpos = xsp;
- if (jj_3R_69()) return true;
- if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- return false;
- }
-
- final private boolean jj_3R_22() {
- if (jj_scan_token(IDENTIFIER)) return true;
- if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- return false;
- }
-
final private boolean jj_3_3() {
if (jj_3R_19()) return true;
if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
@@ -2716,6 +2684,39 @@
if (jj_scan_token(COMMA)) return true;
if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
if (jj_3R_35()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ final private boolean jj_3R_69() {
+ if (jj_scan_token(LOGICAL_NOT_EQUALS)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ if (jj_3R_58()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ final private boolean jj_3R_68() {
+ if (jj_scan_token(LOGICAL_EQUALS)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ if (jj_3R_58()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ final private boolean jj_3R_65() {
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_3R_68()) {
+ jj_scanpos = xsp;
+ if (jj_3R_69()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ final private boolean jj_3R_22() {
+ if (jj_scan_token(IDENTIFIER)) return true;
if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
return false;
}
1.40 +58 -55 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.39
retrieving revision 1.40
diff -u -r1.39 -r1.40
--- Parser.jj 2000/12/10 04:50:05 1.39
+++ Parser.jj 2000/12/11 04:26:23 1.40
@@ -96,7 +96,7 @@
*
* @author <a href="mailto:jvanzyl@periapt.com">Jason van Zyl</a>
* @author <a href="mailto:geirm@optonline.net">Geir Magnusson Jr.</a>
- * @version $Id: Parser.jj,v 1.39 2000/12/10 04:50:05 geirm Exp $
+ * @version $Id: Parser.jj,v 1.40 2000/12/11 04:26:23 geirm Exp $
*/
public class Parser/*@bgen(jjtree)*/implements ParserTreeConstants/*@egen*/
{/*@bgen(jjtree)*/
@@ -112,7 +112,7 @@
* Name of current template we are parsing. Passed to us in parse()
*/
- String strCurrentTemplateName = "";
+ String currentTemplateName = "";
/**
* This constructor was added to allow the re-use of parsers.
@@ -135,11 +135,12 @@
* method and re-initializing the lexer with
* the new stream that we want parsed.
*/
- public SimpleNode parse(InputStream stream, String strTemplateName ) throws ParseException
+ public SimpleNode parse(InputStream stream, String templateName )
+ throws ParseException
{
SimpleNode sn = null;
- strCurrentTemplateName = strTemplateName;
+ currentTemplateName = templateName;
/*
* clearing the VM namespace for this template
@@ -148,7 +149,7 @@
* that it should be done.
*/
- Runtime.dumpVMNamespace( strCurrentTemplateName );
+ Runtime.dumpVMNamespace( currentTemplateName );
try
{
@@ -158,16 +159,16 @@
}
catch (ParseException pe)
{
- Runtime.error ("Parser Exception: " + strTemplateName + " : " + StringUtils.stackTrace(pe));
+ Runtime.error ("Parser Exception: " + templateName + " : " + StringUtils.stackTrace(pe));
throw new ParseException (pe.currentToken,
pe.expectedTokenSequences, pe.tokenImage);
}
catch (Exception e)
{
- Runtime.error ("Parser Error: " + strTemplateName + " : " + StringUtils.stackTrace(e));
+ Runtime.error ("Parser Error: " + templateName + " : " + StringUtils.stackTrace(e));
}
- strCurrentTemplateName = "";
+ currentTemplateName = "";
return sn;
}
@@ -221,7 +222,7 @@
{
bRecognizedDirective = true;
}
- else if (Runtime.isVelocimacro( strDirective.substring(1), strCurrentTemplateName))
+ else if (Runtime.isVelocimacro( strDirective.substring(1), currentTemplateName))
{
bRecognizedDirective = true;
}
@@ -279,7 +280,7 @@
private int rparen = 0;
Stack stateStack = new Stack();
- public boolean bDebugPrint_ = false;
+ public boolean debugPrint = false;
private boolean inReference;
public boolean inDirective;
@@ -297,11 +298,11 @@
public boolean stateStackPop()
{
- Hashtable hStack;
+ Hashtable h;
try
{
- hStack = (Hashtable) stateStack.pop();
+ h = (Hashtable) stateStack.pop();
}
catch( EmptyStackException e)
{
@@ -310,16 +311,16 @@
return false;
}
- if( bDebugPrint_ )
+ if( debugPrint )
System.out.println(
" stack pop (" + stateStack.size() + ") : lparen=" +
- ( (Integer) hStack.get("lparen")).intValue() +
- " newstate=" + ( (Integer) hStack
- .get("lexstate")).intValue() );
+ ( (Integer) h.get("lparen")).intValue() +
+ " newstate=" + ( (Integer) h.get("lexstate")).intValue() );
- lparen = ( (Integer) hStack.get("lparen")).intValue();
- rparen = ( (Integer) hStack.get("rparen")).intValue();
- SwitchTo( ( (Integer) hStack.get("lexstate")).intValue() );
+ lparen = ( (Integer) h.get("lparen")).intValue();
+ rparen = ( (Integer) h.get("rparen")).intValue();
+
+ SwitchTo( ( (Integer) h.get("lexstate")).intValue() );
return true;
}
@@ -331,17 +332,19 @@
*/
public boolean stateStackPush()
{
- if( bDebugPrint_ )
+ if( debugPrint )
System.out.println(" (" + stateStack.size() + ") pushing cur state : " +
curLexState );
- Hashtable hStack = new Hashtable();
- hStack.put("lexstate", new Integer( curLexState ) );
- hStack.put("lparen", new Integer( lparen ));
- hStack.put("rparen", new Integer( rparen ));
+ Hashtable h = new Hashtable();
+
+ h.put("lexstate", new Integer( curLexState ) );
+ h.put("lparen", new Integer( lparen ));
+ h.put("rparen", new Integer( rparen ));
+
lparen = 0;
- stateStack.push( hStack );
+ stateStack.push( h );
return true;
}
@@ -379,12 +382,12 @@
*
*/
- boolean bClosed = false;
+ boolean closed = false;
if (inComment)
- bClosed = true;
+ closed = true;
- while( !bClosed)
+ while( !closed )
{
/*
* look at current state. If we haven't seen a lparen
@@ -408,7 +411,7 @@
rparen++;
}
- bClosed = true;
+ closed = true;
}
else
{
@@ -538,7 +541,7 @@
{
inDirective = true;
- if ( bDebugPrint_ )
+ if ( debugPrint )
System.out.print("#set : going to " + DIRECTIVE );
stateStackPush();
@@ -561,7 +564,7 @@
{
inReference = true;
- if ( bDebugPrint_ )
+ if ( debugPrint )
System.out.print( "$ : going to " + REFERENCE );
stateStackPush();
@@ -575,7 +578,7 @@
{
inReference = true;
- if ( bDebugPrint_ )
+ if ( debugPrint )
System.out.print( "$! : going to " + REFERENCE );
stateStackPush();
@@ -627,7 +630,7 @@
inDirective = true;
- if ( bDebugPrint_ )
+ if ( debugPrint )
System.out.print("# : going to " + DIRECTIVE );
stateStackPush();
@@ -724,7 +727,7 @@
{
<NEWLINE: "\n" | "\r" | "\r\n" >
{
- if ( bDebugPrint_ )
+ if ( debugPrint )
System.out.println(" NEWLINE :");
stateStackPop();
@@ -858,7 +861,7 @@
matchedToken.image = ".";
- if ( bDebugPrint_ )
+ if ( debugPrint )
System.out.print("DOT : switching to " + REFMODIFIER);
SwitchTo(REFMODIFIER);
@@ -883,7 +886,7 @@
inReference = false;
- if ( bDebugPrint_ )
+ if ( debugPrint )
System.out.print("REF_TERM :");
stateStackPop();
@@ -895,7 +898,7 @@
{
<DIRECTIVE_TERMINATOR: ~[] >
{
- if ( bDebugPrint_ )
+ if ( debugPrint )
System.out.print("DIRECTIVE_TERM :");
input_stream.backup(1);
@@ -1023,13 +1026,13 @@
/*@egen*/
{
Token t = null;
- int iCount = 0;
- boolean bControl = false;
+ int count = 0;
+ boolean control = false;
}
( LOOKAHEAD(2) t = <DOUBLE_ESCAPE>
{
- iCount++;
+ count++;
}
)+/*@bgen(jjtree)*/
{
@@ -1047,7 +1050,7 @@
case ELSEIF_DIRECTIVE :
case END :
case STOP_DIRECTIVE :
- bControl = true;
+ control = true;
break;
}
@@ -1056,14 +1059,14 @@
*/
if ( isDirective( t.next.image.substring(1)))
- bControl = true;
- else if ( Runtime.isVelocimacro( t.next.image.substring(1), strCurrentTemplateName))
- bControl = true;
+ control = true;
+ else if ( Runtime.isVelocimacro( t.next.image.substring(1), currentTemplateName))
+ control = true;
t.image = "";
- for( int i = 0; i < iCount; i++)
- t.image += (bControl ? "\\" : "\\\\");
+ for( int i = 0; i < count; i++)
+ t.image += ( control ? "\\" : "\\\\");
}/*@bgen(jjtree)*/
} finally {
if (jjtc000) {
@@ -1200,7 +1203,7 @@
/*@egen*/
Token t = null;
Directive d;
- boolean bDoItNow = false;
+ boolean doItNow = false;
}
{/*@bgen(jjtree) Directive */
try {
@@ -1211,9 +1214,9 @@
*/
t = <WORD>
{
- String strDirectiveName = t.image.substring(1);
+ String directiveName = t.image.substring(1);
- d = (Directive) directives.get( strDirectiveName );
+ d = (Directive) directives.get( directiveName );
/*
* Velocimacro support : if the directive is macro directive
@@ -1221,9 +1224,9 @@
* right then. (So available if used w/in the current template )
*/
- if ( strDirectiveName.equals("macro"))
+ if ( directiveName.equals("macro"))
{
- bDoItNow = true;
+ doItNow = true;
}
/*
@@ -1231,7 +1234,7 @@
* about parser tokens
*/
- jjtn000.setDirectiveName( strDirectiveName );
+ jjtn000.setDirectiveName( directiveName );
if ( d == null)
{
@@ -1239,7 +1242,7 @@
* if null, then not a real directive, but maybe a Velocimacro
*/
- d = (Directive) Runtime.getVelocimacro( strDirectiveName, strCurrentTemplateName );
+ d = (Directive) Runtime.getVelocimacro( directiveName, currentTemplateName );
if (d == null)
{
@@ -1313,10 +1316,10 @@
* we don't have to worry about forward references and such...
*/
- if (bDoItNow)
+ if ( doItNow )
{
Macro m = new Macro();
- m.processAndRegister( jjtn000, strCurrentTemplateName );
+ m.processAndRegister( jjtn000, currentTemplateName );
}
/*
1.41 +58 -55 jakarta-velocity/src/java/org/apache/velocity/runtime/parser/Parser.jjt
Index: Parser.jjt
===================================================================
RCS file: /home/cvs/jakarta-velocity/src/java/org/apache/velocity/runtime/parser/Parser.jjt,v
retrieving revision 1.40
retrieving revision 1.41
diff -u -r1.40 -r1.41
--- Parser.jjt 2000/12/10 04:49:33 1.40
+++ Parser.jjt 2000/12/11 04:26:23 1.41
@@ -120,7 +120,7 @@
*
* @author <a href="mailto:jvanzyl@periapt.com">Jason van Zyl</a>
* @author <a href="mailto:geirm@optonline.net">Geir Magnusson Jr.</a>
- * @version $Id: Parser.jjt,v 1.40 2000/12/10 04:49:33 geirm Exp $
+ * @version $Id: Parser.jjt,v 1.41 2000/12/11 04:26:23 geirm Exp $
*/
public class Parser
{
@@ -133,7 +133,7 @@
* Name of current template we are parsing. Passed to us in parse()
*/
- String strCurrentTemplateName = "";
+ String currentTemplateName = "";
/**
* This constructor was added to allow the re-use of parsers.
@@ -156,11 +156,12 @@
* method and re-initializing the lexer with
* the new stream that we want parsed.
*/
- public SimpleNode parse(InputStream stream, String strTemplateName ) throws ParseException
+ public SimpleNode parse(InputStream stream, String templateName )
+ throws ParseException
{
SimpleNode sn = null;
- strCurrentTemplateName = strTemplateName;
+ currentTemplateName = templateName;
/*
* clearing the VM namespace for this template
@@ -169,7 +170,7 @@
* that it should be done.
*/
- Runtime.dumpVMNamespace( strCurrentTemplateName );
+ Runtime.dumpVMNamespace( currentTemplateName );
try
{
@@ -179,16 +180,16 @@
}
catch (ParseException pe)
{
- Runtime.error ("Parser Exception: " + strTemplateName + " : " + StringUtils.stackTrace(pe));
+ Runtime.error ("Parser Exception: " + templateName + " : " + StringUtils.stackTrace(pe));
throw new ParseException (pe.currentToken,
pe.expectedTokenSequences, pe.tokenImage);
}
catch (Exception e)
{
- Runtime.error ("Parser Error: " + strTemplateName + " : " + StringUtils.stackTrace(e));
+ Runtime.error ("Parser Error: " + templateName + " : " + StringUtils.stackTrace(e));
}
- strCurrentTemplateName = "";
+ currentTemplateName = "";
return sn;
}
@@ -242,7 +243,7 @@
{
bRecognizedDirective = true;
}
- else if (Runtime.isVelocimacro( strDirective.substring(1), strCurrentTemplateName))
+ else if (Runtime.isVelocimacro( strDirective.substring(1), currentTemplateName))
{
bRecognizedDirective = true;
}
@@ -300,7 +301,7 @@
private int rparen = 0;
Stack stateStack = new Stack();
- public boolean bDebugPrint_ = false;
+ public boolean debugPrint = false;
private boolean inReference;
public boolean inDirective;
@@ -318,11 +319,11 @@
public boolean stateStackPop()
{
- Hashtable hStack;
+ Hashtable h;
try
{
- hStack = (Hashtable) stateStack.pop();
+ h = (Hashtable) stateStack.pop();
}
catch( EmptyStackException e)
{
@@ -331,16 +332,16 @@
return false;
}
- if( bDebugPrint_ )
+ if( debugPrint )
System.out.println(
" stack pop (" + stateStack.size() + ") : lparen=" +
- ( (Integer) hStack.get("lparen")).intValue() +
- " newstate=" + ( (Integer) hStack
- .get("lexstate")).intValue() );
+ ( (Integer) h.get("lparen")).intValue() +
+ " newstate=" + ( (Integer) h.get("lexstate")).intValue() );
- lparen = ( (Integer) hStack.get("lparen")).intValue();
- rparen = ( (Integer) hStack.get("rparen")).intValue();
- SwitchTo( ( (Integer) hStack.get("lexstate")).intValue() );
+ lparen = ( (Integer) h.get("lparen")).intValue();
+ rparen = ( (Integer) h.get("rparen")).intValue();
+
+ SwitchTo( ( (Integer) h.get("lexstate")).intValue() );
return true;
}
@@ -352,17 +353,19 @@
*/
public boolean stateStackPush()
{
- if( bDebugPrint_ )
+ if( debugPrint )
System.out.println(" (" + stateStack.size() + ") pushing cur state : " +
curLexState );
- Hashtable hStack = new Hashtable();
- hStack.put("lexstate", new Integer( curLexState ) );
- hStack.put("lparen", new Integer( lparen ));
- hStack.put("rparen", new Integer( rparen ));
+ Hashtable h = new Hashtable();
+
+ h.put("lexstate", new Integer( curLexState ) );
+ h.put("lparen", new Integer( lparen ));
+ h.put("rparen", new Integer( rparen ));
+
lparen = 0;
- stateStack.push( hStack );
+ stateStack.push( h );
return true;
}
@@ -400,12 +403,12 @@
*
*/
- boolean bClosed = false;
+ boolean closed = false;
if (inComment)
- bClosed = true;
+ closed = true;
- while( !bClosed)
+ while( !closed )
{
/*
* look at current state. If we haven't seen a lparen
@@ -429,7 +432,7 @@
rparen++;
}
- bClosed = true;
+ closed = true;
}
else
{
@@ -559,7 +562,7 @@
{
inDirective = true;
- if ( bDebugPrint_ )
+ if ( debugPrint )
System.out.print("#set : going to " + DIRECTIVE );
stateStackPush();
@@ -582,7 +585,7 @@
{
inReference = true;
- if ( bDebugPrint_ )
+ if ( debugPrint )
System.out.print( "$ : going to " + REFERENCE );
stateStackPush();
@@ -596,7 +599,7 @@
{
inReference = true;
- if ( bDebugPrint_ )
+ if ( debugPrint )
System.out.print( "$! : going to " + REFERENCE );
stateStackPush();
@@ -648,7 +651,7 @@
inDirective = true;
- if ( bDebugPrint_ )
+ if ( debugPrint )
System.out.print("# : going to " + DIRECTIVE );
stateStackPush();
@@ -745,7 +748,7 @@
{
<NEWLINE: "\n" | "\r" | "\r\n" >
{
- if ( bDebugPrint_ )
+ if ( debugPrint )
System.out.println(" NEWLINE :");
stateStackPop();
@@ -879,7 +882,7 @@
matchedToken.image = ".";
- if ( bDebugPrint_ )
+ if ( debugPrint )
System.out.print("DOT : switching to " + REFMODIFIER);
SwitchTo(REFMODIFIER);
@@ -904,7 +907,7 @@
inReference = false;
- if ( bDebugPrint_ )
+ if ( debugPrint )
System.out.print("REF_TERM :");
stateStackPop();
@@ -916,7 +919,7 @@
{
<DIRECTIVE_TERMINATOR: ~[] >
{
- if ( bDebugPrint_ )
+ if ( debugPrint )
System.out.print("DIRECTIVE_TERM :");
input_stream.backup(1);
@@ -990,13 +993,13 @@
{
{
Token t = null;
- int iCount = 0;
- boolean bControl = false;
+ int count = 0;
+ boolean control = false;
}
( LOOKAHEAD(2) t = <DOUBLE_ESCAPE>
{
- iCount++;
+ count++;
}
)+
{
@@ -1009,7 +1012,7 @@
case ELSEIF_DIRECTIVE :
case END :
case STOP_DIRECTIVE :
- bControl = true;
+ control = true;
break;
}
@@ -1018,14 +1021,14 @@
*/
if ( isDirective( t.next.image.substring(1)))
- bControl = true;
- else if ( Runtime.isVelocimacro( t.next.image.substring(1), strCurrentTemplateName))
- bControl = true;
+ control = true;
+ else if ( Runtime.isVelocimacro( t.next.image.substring(1), currentTemplateName))
+ control = true;
t.image = "";
- for( int i = 0; i < iCount; i++)
- t.image += (bControl ? "\\" : "\\\\");
+ for( int i = 0; i < count; i++)
+ t.image += ( control ? "\\" : "\\\\");
}
}
@@ -1092,7 +1095,7 @@
{
Token t = null;
Directive d;
- boolean bDoItNow = false;
+ boolean doItNow = false;
}
{
/*
@@ -1101,9 +1104,9 @@
*/
t = <WORD>
{
- String strDirectiveName = t.image.substring(1);
+ String directiveName = t.image.substring(1);
- d = (Directive) directives.get( strDirectiveName );
+ d = (Directive) directives.get( directiveName );
/*
* Velocimacro support : if the directive is macro directive
@@ -1111,9 +1114,9 @@
* right then. (So available if used w/in the current template )
*/
- if ( strDirectiveName.equals("macro"))
+ if ( directiveName.equals("macro"))
{
- bDoItNow = true;
+ doItNow = true;
}
/*
@@ -1121,7 +1124,7 @@
* about parser tokens
*/
- jjtThis.setDirectiveName( strDirectiveName );
+ jjtThis.setDirectiveName( directiveName );
if ( d == null)
{
@@ -1129,7 +1132,7 @@
* if null, then not a real directive, but maybe a Velocimacro
*/
- d = (Directive) Runtime.getVelocimacro( strDirectiveName, strCurrentTemplateName );
+ d = (Directive) Runtime.getVelocimacro( directiveName, currentTemplateName );
if (d == null)
{
@@ -1171,10 +1174,10 @@
* we don't have to worry about forward references and such...
*/
- if (bDoItNow)
+ if ( doItNow )
{
Macro m = new Macro();
- m.processAndRegister( jjtThis, strCurrentTemplateName );
+ m.processAndRegister( jjtThis, currentTemplateName );
}
/*
1.33 +31 -29 jakarta-velocity/src/java/org/apache/velocity/runtime/parser/ParserTokenManager.java
Index: ParserTokenManager.java
===================================================================
RCS file: /home/cvs/jakarta-velocity/src/java/org/apache/velocity/runtime/parser/ParserTokenManager.java,v
retrieving revision 1.32
retrieving revision 1.33
diff -u -r1.32 -r1.33
--- ParserTokenManager.java 2000/12/06 19:50:06 1.32
+++ ParserTokenManager.java 2000/12/11 04:26:23 1.33
@@ -16,7 +16,7 @@
private int rparen = 0;
Stack stateStack = new Stack();
- public boolean bDebugPrint_ = false;
+ public boolean debugPrint = false;
private boolean inReference;
public boolean inDirective;
@@ -34,11 +34,11 @@
public boolean stateStackPop()
{
- Hashtable hStack;
+ Hashtable h;
try
{
- hStack = (Hashtable) stateStack.pop();
+ h = (Hashtable) stateStack.pop();
}
catch( EmptyStackException e)
{
@@ -47,17 +47,17 @@
return false;
}
- if( bDebugPrint_ )
+ if( debugPrint )
System.out.println(
" stack pop (" + stateStack.size() + ") : lparen=" +
- ( (Integer) hStack.get("lparen")).intValue() +
- " newstate=" + ( (Integer) hStack
- .get("lexstate")).intValue() );
-
- lparen = ( (Integer) hStack.get("lparen")).intValue();
- rparen = ( (Integer) hStack.get("rparen")).intValue();
- SwitchTo( ( (Integer) hStack.get("lexstate")).intValue() );
+ ( (Integer) h.get("lparen")).intValue() +
+ " newstate=" + ( (Integer) h.get("lexstate")).intValue() );
+ lparen = ( (Integer) h.get("lparen")).intValue();
+ rparen = ( (Integer) h.get("rparen")).intValue();
+
+ SwitchTo( ( (Integer) h.get("lexstate")).intValue() );
+
return true;
}
@@ -68,17 +68,19 @@
*/
public boolean stateStackPush()
{
- if( bDebugPrint_ )
+ if( debugPrint )
System.out.println(" (" + stateStack.size() + ") pushing cur state : " +
curLexState );
+
+ Hashtable h = new Hashtable();
+
+ h.put("lexstate", new Integer( curLexState ) );
+ h.put("lparen", new Integer( lparen ));
+ h.put("rparen", new Integer( rparen ));
- Hashtable hStack = new Hashtable();
- hStack.put("lexstate", new Integer( curLexState ) );
- hStack.put("lparen", new Integer( lparen ));
- hStack.put("rparen", new Integer( rparen ));
lparen = 0;
- stateStack.push( hStack );
+ stateStack.push( h );
return true;
}
@@ -116,12 +118,12 @@
*
*/
- boolean bClosed = false;
+ boolean closed = false;
if (inComment)
- bClosed = true;
+ closed = true;
- while( !bClosed)
+ while( !closed )
{
/*
* look at current state. If we haven't seen a lparen
@@ -145,7 +147,7 @@
rparen++;
}
- bClosed = true;
+ closed = true;
}
else
{
@@ -3221,7 +3223,7 @@
inReference = false;
- if ( bDebugPrint_ )
+ if ( debugPrint )
System.out.print("REF_TERM :");
stateStackPop();
@@ -3231,7 +3233,7 @@
image = new StringBuffer(new String(input_stream.GetSuffix(jjimageLen + (lengthOfMatch = jjmatchedPos + 1))));
else
image.append(new String(input_stream.GetSuffix(jjimageLen + (lengthOfMatch = jjmatchedPos + 1))));
- if ( bDebugPrint_ )
+ if ( debugPrint )
System.out.print("DIRECTIVE_TERM :");
input_stream.backup(1);
@@ -3257,7 +3259,7 @@
{
inReference = true;
- if ( bDebugPrint_ )
+ if ( debugPrint )
System.out.print( "$ : going to " + REFERENCE );
stateStackPush();
@@ -3274,7 +3276,7 @@
{
inReference = true;
- if ( bDebugPrint_ )
+ if ( debugPrint )
System.out.print( "$! : going to " + REFERENCE );
stateStackPush();
@@ -3338,7 +3340,7 @@
inDirective = true;
- if ( bDebugPrint_ )
+ if ( debugPrint )
System.out.print("# : going to " + DIRECTIVE );
stateStackPush();
@@ -3398,7 +3400,7 @@
{
inDirective = true;
- if ( bDebugPrint_ )
+ if ( debugPrint )
System.out.print("#set : going to " + DIRECTIVE );
stateStackPush();
@@ -3452,7 +3454,7 @@
image = new StringBuffer(new String(input_stream.GetSuffix(jjimageLen + (lengthOfMatch = jjmatchedPos + 1))));
else
image.append(new String(input_stream.GetSuffix(jjimageLen + (lengthOfMatch = jjmatchedPos + 1))));
- if ( bDebugPrint_ )
+ if ( debugPrint )
System.out.println(" NEWLINE :");
stateStackPop();
@@ -3534,7 +3536,7 @@
matchedToken.image = ".";
- if ( bDebugPrint_ )
+ if ( debugPrint )
System.out.print("DOT : switching to " + REFMODIFIER);
SwitchTo(REFMODIFIER);
break;