I have a rule
((cns=IDENT '->')* IDENT | (cns=IDENT '->')* 'STOP') -> ^(PREFIX ^(EVENTS $cns*) ^(ENDS $procn? STOP?) )
This will work correctly if cns=IDENT is replaced by ‘cns+=IDENT’. In that case how can I access cns as $cns.text.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
To store all IDENTs and not only last one
cns=IDENThas to be changed tocns+=IDENT.Now if you explore parser Java code generated by ANTLR
cnsis a genericArrayListwhere all stored items are of typeToken.Now this list can be iterated through using a loop and you can do anything with the items using code like
This item is of Object type though and can be Casted(is this correct terminology?) to
Tokenobject forTokenspecific tasks.