Return values in a public lexer rule
1 posts in topic
Flat View  Flat View

Posted By:   Anonymous
Posted On:   Tuesday, July 23, 2002 11:05 AM


I'm using ANTLR 2.7.1... I've tried to return values from a public lexer rule and the antlr tool returned me a message that says that public lexer rules can't return values , and I need these values in a syntactic rule that use that lexer rule.

My question is: isn't there a way to return a value from a lexer rule to use it in a syntactic (parser) rule?

I'll really be thankful for your answer... I'm almost desperate!

    José Ravelo

Re: Return values in a public lexer rule

Posted By:   Monty_Zukowski  
Posted On:   Wednesday, July 24, 2002 07:30 AM

Return values for lexer rules would only be used in the lexer. Parsers don't call lexer rules, they act on Tokens the lexer creates. So you can attach the value you need to your own Token class and then pull it out of the Token in the parser.
About | Sitemap | Contact