[antlr-interest] superClass usage

Oti ohumbel at gmail.com
Thu Nov 1 14:56:28 PDT 2007


Paul,

for the parser superclass, it is really that easy as described in section 5.7.
Currently there is no way of specifiying the lexer superclass. But you
can use a package trick in Foo.g:

@lexer::header {
package my.lexer;
}

If you create a class named "Lexer" (which extends
org.antlr.runtime.Lexer) in package my.lexer, your own Lexer will be
the superclass. That's because ANTLR generates:

package my.lexer;
import org.antlr.runtime.*;
public class FooLexer extends Lexer {...

Hope this helps a little,
Oti.


On 10/28/07, Paul Keir <paul at paulkeir.com> wrote:
> Hi all,
>
> Does anyone have an example using the superClass option described in
> section 5.7 of the ANTLR ref. book? I'd like to extend an existing
> combined grammar.
>
> Thanks in advance,
> Paul
>
>


More information about the antlr-interest mailing list