Hi, I'm trying to parse Java and it's going ok so far, except for one
problem that I just can't solve, regarding the > token.
Consider the following 3 lines:
someType<anotherType>> a;
if (b > c)
d >> e;
If I define shift-right as:
SHR: '>>'
expression: var SHR var
then the lexer will match the template code, and the parser will break.
But If I define:
GT: '>'
expression: var GT GT var
then the lexer is fine, but the parser chokes on 'b > c', expecting another
> to follow.
Perhaps there is a way to get the parser to behave?
Here is the relevant grammar:
relationalexpression : shiftexpression
| shiftexpression GT
relationalexpression
shiftexpression : additiveexpression
| additiveexpression GT GT shiftexpression
And here is the code that breaks it:
a > b;
And here is the debug info:
State : 140
Stack : packagedeclaration _anon_0_star modifiers CLASS identifier
IMPLEMENTS typelist LBRACE _anon_10_star modifiers VOID identifier
formalparameters LBRACE additiveexpression . LexToken(GT,'>',73,2318)
Action : Shift and goto state 254
State : 254
Stack : packagedeclaration _anon_0_star modifiers CLASS identifier
IMPLEMENTS typelist LBRACE _anon_10_star modifiers VOID identifier
formalparameters LBRACE additiveexpression GT .
LexToken(IDENTIFIER,'b',73,2320)
ERROR: Error : packagedeclaration _anon_0_star modifiers CLASS
identifier IMPLEMENTS typelist LBRACE _anon_10_star modifiers VOID
identifier formalparameters LBRACE additiveexpression GT .
LexToken(IDENTIFIER,'b',73,2320)
Pleas help me, thank you!
--
You received this message because you are subscribed to the Google Groups
"ply-hack" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
To view this discussion on the web visit
https://groups.google.com/d/msg/ply-hack/-/SmlFGUBxU4cJ.
For more options, visit https://groups.google.com/groups/opt_out.