Cannot set backtrack to false [message #1823357] |
Wed, 25 March 2020 09:20  |
Eclipse User |
|
|
|
We have a problem with java.lang.IllegalStateException when auto formating a distinct dsl file.
I have read in some forum that this might be because of the use of backtracking, respectively left recursion grammar.
As we actually don't have such, I wanted to disable it with the statement
parserGenerator = {
options = {
ignoreCase = true // Case Insensitive Keywords
backtrack = false
}
}
just to be sure in the mwe2 file.
It seems that it doe not work properly because we still have the entry
in the InternalTabsParser.g file.
How comes? And how to check whether the backtrack option is switched off?
Thanks for help
Christian
|
|
|
|
|
|
|
|
Re: Cannot set backtrack to false [message #1823370 is a reply to message #1823362] |
Wed, 25 March 2020 11:30   |
Eclipse User |
|
|
|
Uhh. This looks like an xtend bug to me! I experienced this before but not with templates.
Bad I cannot include snapshots here, but here is the code sniplet from AbstractAntlrGrammarGenerator (sorry for the bad characters):
protected def compileParserOptions(Grammar it, AntlrOptions options) '''
options {
�IF !isCombinedGrammar�
tokenVocab=�grammarNaming.getLexerGrammar(it).simpleName�;
�ENDIF�
�IF grammarNaming.getInternalParserSuperClass(it) !== null�
superClass=�grammarNaming.getInternalParserSuperClass(it).simpleName�;
�ENDIF�
�IF isParserBackTracking(options) || options.memoize || options.k >= 0�
�IF isParserBackTracking(options)�
backtrack=true;
�ENDIF�
�IF options.memoize�
memoize=true;
�ENDIF�
�IF options.k >= 0�
memoize=�options.k�;
�ENDIF�
>>>> �ENDIF�
}
'''
protected def isParserBackTracking(Grammar it, AntlrOptions options) {
options.backtrack
}
When you come to the point marked with ">>>>" the output is (copied from variable _builder.segments[]:
[
, options {,
, , tokenVocab=, InternalTabsLexer, ;,
, , superClass=, AbstractInternalContentAssistParser, ;,
, , backtrack=true;, !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
]
Which is an error according to debugged variable options.backtrack which is false
so isParserBackTracking(options) should never return true!
Had this xtend error before in normal xtend code with nested ifs. If you insert "{}" after the condition everything is fine, if not sometimes it goes into the nested if, even if the condition is false.
But you cannot do this here with template syntax!
So I am really stuck :-(
PS: uploaded the screenshots
|
|
|
|
|
|
|
|
Re: Cannot set backtrack to false [message #1823414 is a reply to message #1823409] |
Thu, 26 March 2020 05:07  |
Eclipse User |
|
|
|
Well actually I just wanted to check our rather complicated grammar for left recursive. I have learned that this is not possible by just switching the parser generator via options to this state (backtrack=false), because this might be overwritten.
But if it is overwritten, then the grammar is left recursive.
[Updated on: Thu, 26 March 2020 05:30] by Moderator
|
|
|
Powered by
FUDForum. Page generated in 0.95081 seconds