[
https://issues.apache.org/jira/browse/VELOCITY-631?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12640759#action_12640759
]
byronvf edited comment on VELOCITY-631 at 10/18/08 3:03 AM:
-----------------------------------------------------------------
Ok, here's a fix. the issue from the comments I added to Parser.jjt:
I added the lexical states REFERENCE, REFMODIFIER, REFMOD2 to the
SET_DIRECTIVE. With SET_DIRECTIVE only in the DEFAULT lexical state the
following VTL fails "a$#set(b$ = 1)" because the Reference token uses
LOOKAHEAD(2) combined with the fact that we explicity set the lex state to
REFERENCE with the $ token, which means we would never evaulate the
SET_DIRECTIVE token during the look ahead. This general issue is disscussed
here:
http://www.engr.mun.ca/~theo/JavaCC-FAQ/javacc-faq-ie.htm#tth_sEc3.12
The patch looks scarier then it really is because most of it is regenerated
files. The only explicit changes is the addition of the attached TestCase, and
a change to src/parser/Parser.jjt
was (Author: byronvf):
Ok, here's a fix. the issue from the comments I added to Parser.jjt:
I added the lexical states REFERENCE, REFMODIFIER, REFMOD2 to the
SET_DIRECTIVE. With SET_DIRECTIVE only in the DEFAULT lexical state the
following VTL fails "a$#set(b$ = 1)" because the Reference token uses
LOOKAHEAD(2) combined with the fact that we explicity set the lex state to
REFERENCE with the $ token, which means we would never evaulate this token
during the look ahead. This general issue is disscussed here:
http://www.engr.mun.ca/~theo/JavaCC-FAQ/javacc-faq-ie.htm#tth_sEc3.12
The patch looks scarier then it really is because most of it is regenerated
files. The only explicit changes is the addition of the attached TestCase, and
a change to src/parser/Parser.jjt
> VTL Creates parse error, but shouldn't
> --------------------------------------
>
> Key: VELOCITY-631
> URL: https://issues.apache.org/jira/browse/VELOCITY-631
> Project: Velocity
> Issue Type: Bug
> Components: Engine
> Affects Versions: 1.6-beta1
> Reporter: Byron Foster
> Priority: Minor
> Fix For: 1.6
>
> Attachments: fix631.patch, Velocity631TestCase.java
>
>
> The following creates a parse exception, but should not:
> #macro(test $x)$x#set($i=1)#end
> Exception:
> Threw: org.apache.velocity.exception.ParseErrorException
> msg: Encountered "=" at /foo.vm[line 2, column 25]
> Was expecting one of:
> <RPAREN> ...
> <WHITESPACE> ...
> <WHITESPACE> ...
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]