Reputation: 77
I've got a large grammar in X-Text, and it's got some ambiguities. I'm fully aware of the problems this will cause, but I'd like to be able to test the grammar before I look at optimising it.
I've been trying to turn on backtrack in the X-Text workflow, and can't seem to manage it. I've got the following code in my mwe2 file, under the main project:
language = StandardLanguage {
fragment=parser.antlr.XtextAntlrGeneratorFragment2 auto-inject{
options = {
backtrack= true
}
}
fragment=idea.parser.antlr.XtextAntlrIDEAGeneratorFragment auto-inject{
options={
backtrack=true
}
}
...
But I still get errors in the form:
error(211): ../org.xtext.example.CSPTest/src-gen/org/xtext/example/mydsl/parser/antlr/internal/InternalMyDsl.g:1183:2: [fatal] rule ruleAny has non-LL(*) decision due to recursive rule invocations reachable from alts 1,2. Resolve by left-factoring or using syntactic predicates or using backtrack=true option.
How can I correctly turn on backtrack in order to prevent this?
Upvotes: 4
Views: 1245
Reputation: 3095
For the new generator the correct setting is :
parserGenerator = {
options = {
backtrack = true
}
}
Upvotes: 10