[antlr-interest] TreeParser doubt
cintyram
cintyram at yahoo.com
Mon Mar 10 08:01:40 PST 2003
hi,
i had a tree parser lilke this ..
rule1 : # ( ID ID rule2 ) ;
rule2 : # ( ASSIGN ID ( COMMA ID )* ) ;
but because i have to extract the values of the matched text,
into the data structures in the main program i modified the rules as
follows ..
rule1
[
std::string & name ,
std::string & value ,
std::vector<std::string> & list
]
: #( nam:ID {name = nam->getText() ; }
val:ID {value = nam->getText() ; }
{ rule2(list) ; }
) /// wrong code .. tule2 shud get the tree it should mtch ..
;
rule2
[
std::vector<std::string> & list
]
: # ( ASSIGN i:ID{list.push_back(i->getText() );}
( COMMA id:ID {list.push_back(id->getText() );}
)*
)
;
as stated in the comment, rule2 has to be passed the tree it is
supposed to match, if used as a function ..
so what should i do now?
Thanks in advance
cheers
ram
Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
More information about the antlr-interest
mailing list