[antlr-interest] Fwd: NullPointer exception and inline template

The Researcher researcher0x00 at gmail.com
Thu Sep 22 16:44:37 PDT 2011


---------- Forwarded message ----------
From: The Researcher <researcher0x00 at gmail.com>
Date: Thu, Sep 22, 2011 at 4:22 PM
Subject: Re: [antlr-interest] NullPointer exception and inline template
To: Gabriel Miro <gsmiro at gmail.com>




On Thu, Sep 22, 2011 at 3:46 PM, Gabriel Miro <gsmiro at gmail.com> wrote:

>  It gives me a NullPointerException and I'm unable to compile the parser
> code.
>

Try using with the -Xsavelexer option to see more of the error.

 student at antlr:~/projects/antlr/mail/Gabriel$ java org.antlr.Tool
-Xsavelexer test.g

error(100): test__.g:20:26: syntax error: antlr: NoViableAltException(
75@[921:1: rewrite_alternative options {k=1; } : ({...}? => rewrite_template
| {...}? => ( rewrite_element )+ -> {!stream_rewrite_element.hasNext()}? ^(
ALT[LT(1),"ALT"] EPSILON["epsilon"] EOA["<end-of-alt>"] ) -> ^(
ALT[LT(1),"ALT"] ( rewrite_element )+ EOA["<end-of-alt>"] ) | -> ^(
ALT[LT(1),"ALT"] EPSILON["epsilon"] EOA["<end-of-alt>"] ) | {...}? ETC );])
error(100): test__.g:20:26: syntax error: antlr: NoViableAltException(75@[])
error(100): test.g:0:1: syntax error: assign.types:
MismatchedTreeNodeException(0!=18)
error(10):  internal error: test.g : java.lang.NullPointerException
org.antlr.grammar.v3.DefineGrammarItemsWalker.countAltsForRule(DefineGrammarItemsWalker.java:153)
org.antlr.grammar.v3.DefineGrammarItemsWalker.rule(DefineGrammarItemsWalker.java:1546)
org.antlr.grammar.v3.DefineGrammarItemsWalker.rules(DefineGrammarItemsWalker.java:1190)
org.antlr.grammar.v3.DefineGrammarItemsWalker.grammarSpec(DefineGrammarItemsWalker.java:623)
org.antlr.grammar.v3.DefineGrammarItemsWalker.grammar_(DefineGrammarItemsWalker.java:255)
org.antlr.tool.Grammar.defineGrammarSymbols(Grammar.java:748)
org.antlr.tool.CompositeGrammar.defineGrammarSymbols(CompositeGrammar.java:369)
org.antlr.Tool.process(Tool.java:521)
org.antlr.Tool.main(Tool.java:93)

Hope that helps.

Eric


More information about the antlr-interest mailing list