[antlr-interest] [Antlr novice]: cannot insert "optional action"

Monty Zukowski monty at codetransform.com
Mon Jul 12 22:27:14 PDT 2004


It's probably something simple.  Reduce it to the smallest complete .g 
file you can that demonstrates the problem and let us have a look at 
it.

Monty

On Jul 12, 2004, at 6:09 PM, mbtmbt wrote:

> 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
>
>
>
>
>
>
>
>

ANTLR & Java Consultant -- http://www.codetransform.com
ANSI C/GCC transformation toolkit -- 
http://www.codetransform.com/gcc.html
Embrace the Decay -- http://www.codetransform.com/EmbraceDecay.html



 
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