[antlr-interest] Predicate Syntax Problem
Terence Parr
parrt at cs.usfca.edu
Fri Jan 12 10:17:26 PST 2007
On Jan 11, 2007, at 11:34 PM, Bill Venners wrote:
> Hello,
>
> I am not sure how to add a predicate to one element of an OR
> expression in ANLTR 3.
>
> passedDecl
> : 'not-null'? ('byte' | 'short' | 'int' | 'long' | 'boolean'
> | 'float' | 'double'
> | 'char' | ID_UP )^ { isTypeName($ID_UP.getText()) }?
> ID_DOWN { isVarName($ID_DOWN.getText()) }?
> ;
>
> This is apparently valid grammar syntax, but the $ID_UP doesn't
> work. I get:
>
> com/artima/view/ViewParser.java:497: cannot find symbol
> symbol : variable $ID_UP
> location: class com.artima.view.ViewParser
> if ( !( isTypeName($ID_UP.getText()) ) ) {
>
> I am unable to find any help in the documentation I can find. Can
> someone help me understand what I should do here? What I'd like to
> accomplish is to kill the parse if the ID_UP variable returns false
> when passed to isTypeName().
Hi Bill,
Have you tried the latest jar in file sharing area? It should fix
lots of these. Do you want the {...}? to validate input or
disambiguate? If the latter, they should go on the left edge. :)
Ter
More information about the antlr-interest
mailing list