On Fri, Jan 23, 2009 at 12:51 PM, thesp0nge <
thes...@gmail.com> wrote:
>
> Hi list.
>
> I uploaded an hacked version from php.jj file you can find in javacc
> site. I hacked the grammar so freecc can generate the files, compile
> goes well but the parser doesn't work.
>
> I mean trying to parse a very simple php script it fails with the
> following error (it gave the same error for every PHP file). It sounds
> so odd that I suspect that something went wrong with the grammar.
It looks to me like your grammar is starting in the wrong lexical
state. It probably needs to start in HTML_STATE, just from what I see.
So, if you have code that starts the parser, that looks something like:
PhpParser parser = new PhpParser(someReader);
etcetera...
you need that to be now:
PhpLexer lexer = new PhpLexer(someReader);
lexer.SwitchTo(PhpConstants.HTML_STATE);
PhpParser parser = new PhpParser(lexer);
etcetera...
I hope that's helpful,
JR