geirm 01/02/28 19:31:13
Modified: src/java/org/apache/velocity/runtime/parser Parser.jjt
Log:
Fixed bug submitted by John McNally <[EMAIL PROTECTED]> (thanks John).
The upshot is that because of the cherished and beloved <MORE> mechanism,
we weren't correctly indicating the demark between references in a construct
like $b${b}, do the parser would get confused...
Revision Changes Path
1.56 +48 -4
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.55
retrieving revision 1.56
diff -u -r1.55 -r1.56
--- Parser.jjt 2001/02/07 17:27:07 1.55
+++ Parser.jjt 2001/03/01 03:31:13 1.56
@@ -120,7 +120,7 @@
*
* @author <a href="mailto:[EMAIL PROTECTED]">Jason van Zyl</a>
* @author <a href="mailto:[EMAIL PROTECTED]">Geir Magnusson Jr.</a>
- * @version $Id: Parser.jjt,v 1.55 2001/02/07 17:27:07 geirm Exp $
+ * @version $Id: Parser.jjt,v 1.56 2001/03/01 03:31:13 geirm Exp $
*/
public class Parser
{
@@ -565,9 +565,20 @@
{
if (! inComment)
{
+ /*
+ * if we find ourselves in REFERENCE, we need to pop down
+ * to end the previous ref
+ */
+
+ if (curLexState == REFERENCE)
+ {
+ inReference = false;
+ stateStackPop();
+ }
+
inReference = true;
- if ( debugPrint )
+ if ( debugPrint )
System.out.print( "$ : going to " + REFERENCE );
stateStackPush();
@@ -579,9 +590,20 @@
{
if (! inComment)
{
+ /*
+ * if we find ourselves in REFERENCE, we need to pop down
+ * to end the previous ref
+ */
+
+ if (curLexState == REFERENCE)
+ {
+ inReference = false;
+ stateStackPop();
+ }
+
inReference = true;
- if ( debugPrint )
+ if ( debugPrint )
System.out.print( "$! : going to " + REFERENCE );
stateStackPush();
@@ -706,7 +728,29 @@
<DIRECTIVE,REFMOD2>
TOKEN :
{
- <STRING_LITERAL: ( "\"" ( ~["\"","\n","\r"] )* "\"" ) | ( "'" ( ~["'","\n","\r"]
)* "'" ) >
+// <STRING_LITERAL: ( "\"" ( ~["\"","\n","\r"] )* "\"" ) | ( "'" (
~["'","\n","\r"] )* "'" ) >
+ < STRING_LITERAL:
+ ("\""
+ ( (~["\"","\\","\n","\r"])
+ | ("\\"
+ ( ["n","t","b","r","f","\\","'","\""]
+ | ["0"-"7"] ( ["0"-"7"] )?
+ | ["0"-"3"] ["0"-"7"] ["0"-"7"]
+ )
+ )
+ | ( "\\" (" ")* "\n")
+ )*
+ "\""
+ )
+ |
+ ("\'"
+ ( (~["\'","\n","\r"])
+ | ( "\\" (" ")* "\n")
+ )*
+ "\'"
+ )
+ >
+
{
/*
* - if we are in DIRECTIVE and haven't seen ( yet, then also drop out.