At 20:47 1/12/2008, chain one wrote:
>entity_id returns [String eid]
>@init{ eid=null; }
>     : { isFirst }? id=IDENT { eid=id.getText(); 
> /*addId(eid,ENTITY_IDENT);*/ }-> ^(ENTITY_ID[]  $id)
>              |  id2=ENTITY_IDENT { 
> eid=id2.getText();$id2.setType(IDENT);} -> ^(ENTITY_IDENT[] $id2)
>              ;
>
>variable eid would be undefined when compiling the generated Java 
>code.
[...]
>I am looking for a method that could avoid this kind of problem 
>(not modify the Java code directly : ) )

Whenever you refer to a label, parameter, rule, or return value 
(something defined in ANTLR space) in a code fragment, you need to 
use $.

So using $eid will solve your problem.

(And instead of using id.getText() etc, you should be using 
$id.text.) 


List: http://www.antlr.org:8080/mailman/listinfo/antlr-interest
Unsubscribe: 
http://www.antlr.org:8080/mailman/options/antlr-interest/your-email-address


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"il-antlr-interest" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/il-antlr-interest?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to