[antlr-interest] generated code not compilable - with paramet
ers.
mzukowski at yci.com
mzukowski at yci.com
Wed Oct 30 10:29:05 PST 2002
Where is that param coming from? nextToken() doesn't know anything about
it. It doesn't make sense to have a parameter passed in to a non-protected
rule in the lexer. Why don't you use an instance variable?
Monty
> -----Original Message-----
> From: praveen_c [mailto:praveen_c at yahoo.com]
> Sent: Wednesday, October 30, 2002 9:54 AM
> To: antlr-interest at yahoogroups.com
> Subject: [antlr-interest] generated code not compilable - with
> parameters.
>
>
> I got ANT 2.7.2 and got rid of the previous problem. Thanks guys.
>
> Looks like I'm onto the next one. I pasted the rule and code fragment
> at the end of this message. Line 15 of the generated code should have
> an additional boolean parameter. How do I tell ant to generate an
> additional param?? I don't think I've control on that.
>
> Please help.
>
> Thanks,
> Praveen.
>
> ------------------------GRAMMAR-----------------------
> TEXT [boolean stopAtEndingAngleBracket]: (END_LOOP) => END_LOOP {
> $setType(END_LOOP); } |
> (
> options
> {
> generateAmbigWarnings=false;
> }:
> ( { !isEndOfText(stopAtEndingAngleBracket) }? . )*
> );
> ------------------------END GRAMMAR-----------------------
>
> ------------------------GENERATED CODE--------------------
> 1 public Token nextToken() throws TokenStreamException {
> 2 Token theRetToken=null;
> 3 tryAgain:
> 4 for (;;) {
> 5 Token _token = null;
> 6 int _ttype = Token.INVALID_TYPE;
> 7 resetText();
> 8 try { // for char stream error handling
> 9 try { // for lexical error handling
> 10 if ((LA(1)=='<') && (LA(2)=='@')) {
> 11 mTAG(true);
> 12 theRetToken=_returnToken;
> 13 }
> 14 else {
> 15 mTEXT(true);
> 16 theRetToken=_returnToken;
> 17 }
> -------------------------------------------------------------
>
>
>
>
>
>
>
>
> Your use of Yahoo! Groups is subject to
http://docs.yahoo.com/info/terms/
Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
More information about the antlr-interest
mailing list