Isn't this when the grammar is trying to use a token that the lexer has not defined?
Jim > -----Original Message----- > From: [email protected] [mailto:antlr-interest- > [email protected]] On Behalf Of Terence Parr > Sent: Tuesday, November 30, 2010 1:08 PM > To: Bill Lear > Cc: [email protected] > Subject: Re: [antlr-interest] Island grammar for reading shell commands > > Wow. input.LT(1) or LT(-1) is returning null. > > I'd turn on -trace option of antlr then recompile and retry. that may > say more T On Nov 30, 2010, at 12:59 PM, Bill Lear wrote: > > > On Tuesday, November 30, 2010 at 11:25:18 (-0800) Terence Parr > writes: > >> > >> On Nov 29, 2010, at 7:00 PM, Bill Lear wrote: > >> > >>> I've followed the sensible advice to create an island grammar to > >>> deal with parsing an unstructured shell command along with more > >>> structured input. Unfortunately, when I follow the examples as > >>> given in the Antlr examples zip file, I get very close, but then > >>> either a NULL pointer exception bites, or I can only parse one line > of "island" > >>> input --- I can't figure out how to return control back to the > "sea" > >>> parser and have it read more input. > >> > >> Can you tell us where it gets null ptr? > > > > Surely. Here you go: > > > > % cat input | java Command > > Got shell. Going native. > > Exception in thread "main" java.lang.NullPointerException > > at org.antlr.runtime.Parser.getMissingSymbol(Parser.java:70) > > at > org.antlr.runtime.BaseRecognizer.recoverFromMismatchedToken(BaseRecogni > zer.java:604) > > at > org.antlr.runtime.BaseRecognizer.match(BaseRecognizer.java:115) > > at ShellParser.shell(ShellParser.java:48) > > at CommandLexer.mSHELL(CommandLexer.java:57) > > at CommandLexer.mTokens(CommandLexer.java:688) > > at org.antlr.runtime.Lexer.nextToken(Lexer.java:84) > > at > org.antlr.runtime.CommonTokenStream.fillBuffer(CommonTokenStream.java:9 > 5) > > at > org.antlr.runtime.CommonTokenStream.LT(CommonTokenStream.java:238) > > at > org.antlr.runtime.CommonTokenStream.LA(CommonTokenStream.java:300) > > at CommandParser.commands(CommandParser.java:56) > > at Command.main(Command.java:8) > > > > Let me know if I can do anything further to narrow it down for you. > > > > > > Bill > > > List: http://www.antlr.org/mailman/listinfo/antlr-interest > Unsubscribe: http://www.antlr.org/mailman/options/antlr-interest/your- > email-address 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.
