Why am I getting an NPE on the following test grammar?  Thanks.
I am having a hard time getting the @header into my grammar without
getting a NPE error.  What am I doing wrong?  Thanks for the help.

(ANTLR Parser Generator  Version 3.3 Nov 30, 2010 12:45:30)

THE FOLLOWING test GRAMMAR:

grammar test;

options {
language=Java;
}

@header {
package org.antlr.test;
}

tokens {
TEST='test';
}

INT     :       '0'..'9'+ ;

GAVE THIS ERROR:

error(100): test.g:11:1: syntax error: antlr: test.g:11:1: unexpected
token: tokens {
error(150):  grammar file test.g has no rules
error(100): test.g:0:0: syntax error: assign.types: <AST>:0:0:
unexpected end of subtree
error(100): test.g:0:0: syntax error: define: <AST>:0:0: unexpected
end of subtree
error(10):  internal error: test.g : java.lang.NullPointerException
org.antlr.grammar.v2.DefineGrammarItemsWalker.trimGrammar(DefineGrammarItemsWalker.java:94)
org.antlr.grammar.v2.DefineGrammarItemsWalker.finish(DefineGrammarItemsWalker.java:77)
org.antlr.grammar.v2.DefineGrammarItemsWalker.grammar(DefineGrammarItemsWalker.java:206)
org.antlr.tool.Grammar.defineGrammarSymbols(Grammar.java:707)
org.antlr.tool.CompositeGrammar.defineGrammarSymbols(CompositeGrammar.java:352)
org.antlr.Tool.process(Tool.java:452)
org.antlr.Tool.main(Tool.java:89)

List: http://www.antlr.org/mailman/listinfo/antlr-interest
Unsubscribe: 
http://www.antlr.org/mailman/options/antlr-interest/your-email-address

-- 
You received this message because you are subscribed to the Google Groups 
"il-antlr-interest" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/il-antlr-interest?hl=en.

Reply via email to