[antlr-interest] how can i get a return string from the parser

Gavin Lambert antlr at mirality.co.nz
Sun Nov 23 11:51:19 PST 2008


At 06:52 24/11/2008, Su Zhang wrote:
>My program needs a string from Parser, but there is not any 
>function provided in the public class parser, how can I get the 
>string outside? I mean I want to get the string generated from 
>the rules of antlr(functions in parser), and I have 
>written  "returns[String s]" to indicate that I need the value, 
>but how can i get the String? does anybody familiar with this 
>kind of problem?

It's a return value.  That means it's actually returned from the 
parser method.  (Depending on your grammar, it might be returned 
directly or inside a structure.  Examine the generated code.)



More information about the antlr-interest mailing list