geirm 01/10/25 18:53:23
Modified: src/java/org/apache/velocity/runtime/parser Parser.jjt
Log:
Fix for the 'disappearing right curly' problem.
Revision Changes Path
1.68 +20 -11
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.67
retrieving revision 1.68
diff -u -r1.67 -r1.68
--- Parser.jjt 2001/10/22 03:53:24 1.67
+++ Parser.jjt 2001/10/26 01:53:23 1.68
@@ -16,7 +16,7 @@
* the documentation and/or other materials provided with the
* distribution.
*
- * 3. The end-user documentation included with the redistribution, if
+ * 3. The end-user documentation included with the redisstribution, if
* any, must include the following acknowlegement:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
@@ -108,8 +108,6 @@
*/
DEBUG_PARSER=false;
DEBUG_TOKEN_MANAGER=false;
-
-
}
PARSER_BEGIN(Parser)
@@ -136,7 +134,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.67 2001/10/22 03:53:24 jon Exp $
+ * @version $Id: Parser.jjt,v 1.68 2001/10/26 01:53:23 geirm Exp $
*/
public class Parser
{
@@ -1028,7 +1026,7 @@
{
IfStatement()
| StopStatement()
-| Reference()
+| LOOKAHEAD(2) Reference()
| Comment()
| SetDirective()
| EscapedDirective()
@@ -1330,12 +1328,21 @@
void Reference() : {}
{
- // This should be changed to Indentifier() now. Make
- // it easier to walk the AST.
- [<LCURLY>]
- <IDENTIFIER>
- [<RCURLY>]
- (LOOKAHEAD(2) <DOT> (LOOKAHEAD(3) Method() | Identifier() ) [<RCURLY>] )*
+ /*
+ * A reference is either ${<FOO>} or $<FOO>
+ */
+
+ (
+ <IDENTIFIER>
+ (LOOKAHEAD(2) <DOT> (LOOKAHEAD(3) Method() | Identifier() ))*
+ )
+ |
+ (
+ <LCURLY>
+ <IDENTIFIER>
+ (LOOKAHEAD(2) <DOT> (LOOKAHEAD(3) Method() | Identifier() ))*
+ <RCURLY>
+ )
}
void True() : {}
@@ -1362,6 +1369,8 @@
| <NUMBER_LITERAL>
| <STRING_LITERAL>
| <ESCAPE>
+| <LCURLY>
+| <RCURLY>
}
/* -----------------------------------------------------------------------