C# NullReferenceException Rows.g4 example from "The Definitive ANTLR 4 Reference"

67 views
Skip to first unread message

shea.ar...@gmail.com

unread,
Sep 8, 2013, 3:07:46 PM9/8/13
to antlr-di...@googlegroups.com
Hello,

I am encountering a problem running the Rows.g4 example from The Definitive ANTLR 4 reference.

Specifically, I am getting a NullReferenceException on (line 82) of RowParser.cs:

_errHandler.Sync(this);

_errHandler is an instance of DefaultErrorStrategy and the NullReferenceException is occurring somewhere in the Sync method.

Has any encountered this before?

Thanks,

Shea

shea.ar...@gmail.com

unread,
Sep 8, 2013, 3:17:42 PM9/8/13
to antlr-di...@googlegroups.com, shea.ar...@gmail.com

I found a solution (but don't understand the innards of the DefaultErrorStrategy class so I'm not sure why it fixes the problem). You must insert:

_interp = new ParserATNSimulator(this, _ATN);

into the RowsParser constructor defined in Rows.g4

Regards,

Shea

Reply all
Reply to author
Forward
0 new messages