[antlr-interest] (no subject)

Greg Clemenson greg at onvoq.com
Wed Aug 2 10:17:19 PDT 2006


Hi,

I am a bit new, but I am having a problem with getting the packages  
statement emitted in the generated lexer.  It is probably just some  
piece of documentation I can't find or have somehow overlooked.   
Here's what I am doing now.  I have a *.g file that looks like this:

grammar Xyz;

@header {

package com.path.parser;

import com.path.cmplr.ConstNode;
import com.path.cmplr.ICmplrNode;
...
}


Among other things, this generates files Xyz.java and XyzLexer.java.   
I use the -o to generate the output files in the correct Java source  
directory.  Xyz.java starts out like this, with the correct package:

// $ANTLR 3.0b3 ogrammar.g 2006-08-02 09:47:56

package com.path.parser;

import com.path.cmplr.ConstNode;
import com.path.cmplr.ICmplrNode;
...
import org.antlr.runtime.*;
import java.util.Stack;
import java.util.List;
import java.util.ArrayList;

However XyzLexer.java starts out like this, without a package  
statement, causing a compiler error:

// $ANTLR 3.0b3 ogrammar.g 2006-08-02 09:47:58

import org.antlr.runtime.*;
import java.util.Stack;
import java.util.List;
import java.util.ArrayList;
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20060802/0f7bca36/attachment-0001.html


More information about the antlr-interest mailing list