[antlr-interest] Re: Return value warning?
kozchris
csnyder at alumni.ncsu.edu
Tue Oct 5 16:22:59 PDT 2004
You are fine. I don't think you can suppress this message (at least I
haven't found a way).
The warning is useful for checking why you haven't used the value
returned when calling a subrule. In those cases I suppress the
warnings by assigning the return value of the rule to a dummy variable.
Using your example
mainRule {String temp;}:
temp=positiveNumeric
;
Chris
--- In antlr-interest at yahoogroups.com, "codeteacher"
<codeteacher at t...> wrote:
>
> Hi all,
>
> I've got the following rule:
>
> positiveNumeric returns [String value] :
> ( i:NUM_INT {value = i.getText();}
> | f:NUM_FLOAT {value = f.getText();} );
>
> But ANTLR gave me this warning:
> warning:Rule 'positiveNumeric' returns a value
>
> I thought that "returns" is indeed a keyword and is fully supported by
> ANTLR. I looked at the generated code and it seemed okay. Is it that
> return values in grammar rules are discouraged in ANTLR? If not, how
> can I suppress this message? Or did I do something wrong?
>
> Thanks a lot.
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/antlr-interest/
<*> To unsubscribe from this group, send an email to:
antlr-interest-unsubscribe at yahoogroups.com
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/
More information about the antlr-interest
mailing list