[antlr-interest] Trouble with ANTLR 3 grammar
Terence Parr
parrt at cs.usfca.edu
Wed Jul 5 10:26:20 PDT 2006
On Jul 4, 2006, at 12:41 AM, Emond Papegaaij wrote:
> It seems to be related to the ACTION tokens. Removing the tokens
> fixes the
> problem. WS was declared after the ACTION tokens, but moving it up
> didn't
> solve the problem. I've attached a minimised version of the first
> grammar
> that still shows WS tokens. The input is:
WS is attempted first hence it will always match before
METHOD_SIG_ACTION; unreachable. WS must be after.
Oh, I think I see the problem...hang on. Sure...cool. Change the
lexerRule template in Java.stg to wrap the emit code:
<execAction({
if ( token==null && ruleNestingLevel==1 ) {
emit(type,line,charPosition,channel,start,getCharIndex
()-1);
}<\n>
}
)>
in execAction template, which puts an IF around it.
Works now for me.
I should ship b2 today/tomrrow so you can wait if you want.
Ter
More information about the antlr-interest
mailing list