[antlr-interest] Declaring globals
Xue Yong Zhi
zhixueyong at hotmail.com
Thu Feb 8 12:15:26 PST 2007
Definately you can. If you want to add fields to the parser, just insert
code block after options and before parser rules:
...
class FooParser extends Parser;
options {
}
{
//you code here: fields, methods
}
first_rule:
...
Jono Juggler wrote:
> Hey all,
>
> I am a Antlr gnub with a quick question. Is there a way to declare
> globals or something within the scope of the main class that can be
> accessed by the parser? I want a way to count language features (ie - if
> statements, for loops, method calls) in Java source.
>
--
Xue Yong Zhi
http://xruby.blogspot.com
More information about the antlr-interest
mailing list