Is there a reason you can't make LEXERRULE a parser rule? parserrule: (parserrule2); parserrule2: (LEXERRULE1) (LEXERRULE2) (LEXERRULE3); Then you can do exactly what you want. Dave
_____ From: antlr-interest-boun...@antlr.org [mailto:antlr-interest-boun...@antlr.org] On Behalf Of Raghavendra Anjana (RBEI/EMT2) Sent: Tuesday, June 02, 2009 4:27 AM To: antlr-inter...@antlr.org Subject: [antlr-interest] Regarding lexer rules return values Hello, I have a grammar with a parser rule as shown below parserrule: (LEXERRULE); LEXERRULE: (LEXERRULE1)(LEXERRULE2)(LEXERRULE3); Whenever my parser rule is recognized I want to return the text identified for LEXERRULE1,2,3 separately. But I believe that we cannot return values from a lexer rule. Is there a way so that I can get the LEXERRULE1,2,3 from LEXERRULE. i.e. Something like Parserrule return [x,y,z]: (LEXERRULE) {$x= LEXERRULE.LEXERRULE1;$y =LEXERRULE.LEXERRULE2;$z=LEXERRULE.LEXERRULE3 }; LEXERRULE: (LEXERRULE1)(LEXERRULE2)(LEXERRULE3); LEXERRULE1:'ab'; LEXERRULE2:'xy'; LEXERRULE3:'12'; The input for this parser is abxy12 The scenario is that whenver this text is recognized or matched then I want ab, xy and 12 to be return back from the parser rule each separately. Thanks a lot in advance. Thanks and Regards Raghavendra --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "il-antlr-interest" group. To post to this group, send email to il-antlr-interest@googlegroups.com To unsubscribe from this group, send email to il-antlr-interest+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/il-antlr-interest?hl=en -~----------~----~----~----~------~----~------~--~---
List: http://www.antlr.org/mailman/listinfo/antlr-interest Unsubscribe: http://www.antlr.org/mailman/options/antlr-interest/your-email-address