[antlr-interest] [Antlr novice]: cannot insert "optional action"
mbtmbt
mbt at alum.mit.edu
Mon Jul 12 18:09:47 PDT 2004
I'm trying to add member variable and methods to my TreeParser-
derived class. Both the doc (see below) and FAQs tell me that all I
need to do is put my member variables and methods into { } after the
options statement. Yet antlr (2.7.4, Windows, C++) seems to ignore
them completely. Any ideas what may be going wrong?
class BlahBlahGenerator extends TreeParser;
options {
importVocab=MyVocab;
}
{
int XXXXX; <====== is not included in either .hpp or .cpp file
}
====================================
Documentation:
All parser rules must be associated with a parser class. A grammar
(.g) file may contain only one parser class definitions (along with
lexers and tree-parsers). A parser class specification precedes the
options and rule definitions of the parser. A parser specification
in a grammar file often looks like:
{ optional class code preamble }
class YourParserClass extends Parser;
options
tokens
{ optional action for instance vars/methods } <=============
parser rules...
===================================
I must be missing something simple :-(
Thank you so very much!
--Mark
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