[antlr-interest] semantic predicate does not work
    mzukowski at yci.com 
    mzukowski at yci.com
       
    Tue Jan 21 09:10:41 PST 2003
    
    
  
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/ 
    
    
More information about the antlr-interest
mailing list