[antlr-interest] semantic predicate does not work
Smith, Eric V.
ericsmith at windsor.com
Tue Jan 21 09:25:57 PST 2003
Doesn't it need to be
d1=identifier
since it's a non-terminal?
> -----Original Message-----
> From: mzukowski at yci.com [mailto:mzukowski at yci.com]
> Sent: Tuesday, January 21, 2003 12:11 PM
> To: antlr-interest at yahoogroups.com
> Subject: RE: [antlr-interest] semantic predicate does not work
>
>
> Try putting spaces between your operators, like
> {System.out.println("found identifier " + d1.getText());}
>
> Does that work?
>
> Monty
>
>
> -----Original Message-----
> From: weberjn <weberjn at yahoo.com> [mailto:weberjn at yahoo.com]
> Sent: Tuesday, January 21, 2003 8:00 AM
> To: antlr-interest at yahoogroups.com
> Subject: [antlr-interest] semantic predicate does not work
>
>
> Hi,
>
> on Terence Parr's Getting Started With ANTLR there is a rule with
> a semantic predicate
>
> startRule
> : n:NAME
> {System.out.println("Hi there, "+n.getText());};
>
>
>
> I tried to insert something like that into the IDL grammar:
>
> module
> : "module"
> d1:identifier
> {System.out.println("found identifier "+d1.getText());}
> LCURLY definition_list RCURLY
> ;
>
>
> but the java compile complains of
>
> [javac] C:\myjava\antlridl\gensrc\IDLParser.java:268: cannot
> resolve symbol
> [javac] symbol : variable d1
> [javac] location: class IDLParser
> [javac] System.out.println("found identifier
> "+d1.getText());
>
>
> What is the trick?
>
> Thanks for any hints,
> Juergen
>
>
>
>
>
> Your use of Yahoo! Groups is subject to
> http://docs.yahoo.com/info/terms/
>
>
>
>
> Your use of Yahoo!
> Groups is subject to http://docs.yahoo.com/info/terms/
>
>
>
Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
More information about the antlr-interest
mailing list