[antlr-interest] How to get Parser rule's return value?
    Xue Yong Zhi 
    zhixueyong at hotmail.com
       
    Thu Feb 15 11:03:22 PST 2007
    
    
  
Shaoting Cai wrote:
> Hi, I'm a beginner.  Could you tell me how to get parser rule's return 
> value?
> eg: I have this parser rule...
>  
> *variable* [int iPos] returns [int iOffset]
>     : IDENT { iOffset= 1; }
>     ;
> *declare*
>     : "var" variable /{ /* I need return value here */ }/
>     ;
>  
declare
{int v;}
      : "var" v=variable {/*use v here*/}
      ;
See http://www.antlr.org/doc/metalang.html#_bb1
-- 
Xue Yong Zhi
XRuby (Ruby to Java bytecode compiler):
http://xruby.blogspot.com
    
    
More information about the antlr-interest
mailing list