you have a decision in your grammar which requires a very large amount of lookahead and/or is ambiguous or context-sensitive
Did you try using SLL mode first?
parser.getInterpreter().setSLL(true);
try {
parser.*yourrule()*;
...
}
catch (RuntimeException ....
However, I think that it might be as simple as a little left factoring. as with markup languages and HTML etc a lot of your constructs start with the same sequence of tokens. For instance OPEN, so you can use:
tags: OPEN (td | ....
And take the OPEN out of each of the tags.
That simple factoring is probably not what your issue is, but look for all the places you can do that. Out of interest I will copy your parser and lexer and look at the generated code. It might be obvious where your issue is and I’ll report back.
Jim
--
You received this message because you are subscribed to the Google Groups "antlr-discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to antlr-discussi...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
If you don't need the CHAR, then just remove the text rule altogether and add skip to CHAR and WS.
you can possibly just change it to:
text : WS | CHAR ;
| |--TEXT -> My [1:0]| | |--CHAR -> M [1:0]| | |--CHAR -> y [1:1]| | `--WS -> [1:2]
| |--TEXT -> M [1:0]| | `--CHAR -> M [1:0]| |--TEXT -> y [1:1]| | `--CHAR -> y [1:1]| |--TEXT -> [1:2]| | `--WS -> [1:2]
tags seem to repeat exactly the same alts ls...javadocInLineTag. Why not factor those out in to one rule?
I don't have time to go through all your uses of the text rule.
optimising the loops that were calling it as per above will solve your issues.