[antlr-interest] "PageLexer.cpp", line 89 # ';' expected befo re '}'

mzukowski at yci.com mzukowski at yci.com
Thu Mar 18 09:45:55 PST 2004


OTAGBEGIN: '<' ('/' {$setType(CTAGBEGIN)})?
Should be
OTAGBEGIN: '<' ('/' {$setType(CTAGBEGIN)};)?

You need a complete statement in an action, which for cpp means semicolon
termination.

Monty
-----Original Message-----
From: Jerry Dy [mailto:jerrydy at sbcglobal.net] 
Sent: Thursday, March 18, 2004 9:23 AM
To: antlr-interest at yahoogroups.com
Subject: [antlr-interest] "PageLexer.cpp", line 89 # ';' expected before '}'

Ric,

I have the following grammar and the generated cpp and hpp files will 
not compile with error "PageLexer.cpp", line 89 # ';' expected 
before '}'

options { language="Cpp"; }
class PageParser extends Parser;
test: CTAGBEGIN
        ;

class PageLexer extends Lexer;
OTAGBEGIN: '<' ('/' {$setType(CTAGBEGIN)})?
        ;


The relevant lines are as follows:
#line 8 "test.g"
  _ttype = CTAGBEGIN           // <== does not have ';' at the end
#line 89 PageLexer.cpp

It works after I manually add the ';' at the end of the statement. Is 
this a bug in the lexer generator? Thanks!

-Jerry



 
Yahoo! Groups Links



 


 
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