views:

34

answers:

1

By default, a parser generated using ANTLR-3 extends from org.antlr.runtime.Parser. How do I have it extend my custom class instead?

+1  A: 

You can do that by using the superClass option in your grammar:

grammar G;

options {
  superClass = YourCustomClass;
}

parse
  :  ...
  ;

which will generate:

public class GParser extends YourCustomClass {

    // ...

}
Bart Kiers
Perfect, thanks!
etheros
You're welcome etheros.
Bart Kiers