options
{
output=AST;
}

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 checked the Java code, and found the reason was because eid was a member
variable of the return struct, so variable eid could not be used in method
directly,check the following code out:

//code start
   public static class entity_id_return extends ParserRuleReturnScope {
        public String eid;
        Object tree;
        public Object getTree() { return tree; }
    };

    public final testbasetypeParser.entity_id_return entity_id() throws
RecognitionException {
         eid=null;

//code end


I am looking for a method that could avoid this kind of problem (not modify
the Java code directly : ) )
Anyone who knows this kind of method please let me know, your help is
appreciated.
Thanks very much.


Best Regards,
chainone

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

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

Reply via email to