[antlr-interest] @header package not generated for <T>Lexer.java

Micheal J open.zone at virgin.net
Wed Jun 6 15:48:13 PDT 2007


Hi,
 
You need to use a separate @lexer::header {...} 
 
<aside>
IMO, this should have been "fixed" during the beta cycle as per
<http://www.antlr.org:8888/browse/ANTLR-35>
http://www.antlr.org:8888/browse/ANTLR-35.
</aside>
 
Micheal

-----------------------
The best way to contact me is via the list/forum. My time is very limited. 

-----Original Message-----
From: antlr-interest-bounces at antlr.org
[mailto:antlr-interest-bounces at antlr.org] On Behalf Of Pranab Dhar
Sent: 06 June 2007 21:16
To: antlr-interest at antlr.org
Subject: [antlr-interest] @header package not generated for <T>Lexer.java



Hi,

       I was able to generate the Parser and the Lexer java code from the
grammar and the package defined in the @header section of the grammar does
not get generated in the Lexer code.

 

grammar Tql;

 

options {

      language=Java;

      output=AST;

      backtrack=true;

      k=2;

      memoize=true;

}

 

tokens {

      SELECT_EXPR;

      ..

}

 

@header {

      package com.xxx.yyy.query.parser;   

}

 

And the generated lexer code is something like

 

 

// $ANTLR 3.0
C:\\xxxx\\workspaces\\xxxxxx\\src\\com\\xxxxx\\xxxx\\query\\parser\\TOql.g
2007-06-06 12:05:44

 

import org.antlr.runtime.*;

import java.util.Stack;

import java.util.List;

import java.util.ArrayList;

 

public class TqlLexer extends Lexer {

 

And the Parser code looks like

 

// $ANTLR 3.0 C
C:\\xxxx\\workspaces\\xxxxxx\\src\\com\\xxxxx\\xxxx\\query\\parser\\TOql.g
2007-06-06 12:05:43

 

      package com.xxx.yyy.query.parser;   

 

 

import org.antlr.runtime.*;

import java.util.Stack;

import java.util.List;

import java.util.ArrayList;

import java.util.Map;

import java.util.HashMap;

 

import org.antlr.runtime.tree.*;

 

public class TqlParser extends Parser {

    public static final String[] tokenNames = new String[] {

 

Any help and guidance is appreciated.

 

Thanks,

 

Pranab

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20070606/86e87620/attachment-0001.html 


More information about the antlr-interest mailing list