I'm using antlr-3.2 with Java and have an grammar with options
{output=template}.

Any test for the rule without template's closure fails because of
NullPointerException in org.antlr.gunit.gUnitExecutor:
                     ....
                     else if (method.getName().equals("getTemplate"))
                     {
                        final Method returnName =
_return.getMethod("getTemplate");
                        final StringTemplate st = (StringTemplate)
returnName.invoke(ruleReturn);
                        stString = st.toString(); //here comes
NullPointerException
                        //must be stString = (st!=null ? st.toString() :
null);
                     }
                     ....

If a grammar has a rewritable=true option all tests have got a
ClassCastException when Parser is trying to rewrite the input because of the
next line in org.antlr.gunit.gUnitExecutor:

   protected gUnitTestResult runParser(final String parserName, final String
lexerName, final String testRuleName,
         final gUnitTestInput testInput) throws Exception
   {
      ....
         final CommonTokenStream tokens = new CommonTokenStream ((Lexer)
lexObj); //Hier must be a TokenRewriteStream!
      .....

Thanks

Andriy Binetskyy
_______________________________________________
antlr-dev mailing list
[email protected]
http://www.antlr.org/mailman/listinfo/antlr-dev

Reply via email to