|
|
|
|
|
|
Re: Cannot set backtrack to false [message #1823370 is a reply to message #1823362] |
Wed, 25 March 2020 15:30 |
Christian Sodomka Messages: 19 Registered: May 2019 |
Junior Member |
|
|
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 #1823375 is a reply to message #1823370] |
Wed, 25 March 2020 16:42 |
|
if you debug you can click on the stackframe with the xtend file and select show source -> java from the context menu
then you should be able to see who adds the backtrace=true to the _builder/StringConcatenation
you can also debug the getter and setter in org.eclipse.xtext.xtext.generator.parser.antlr.AntlrOptions
(rightklick, open generated file to see the java code)
to see who calls setBacktrack with true
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
|
|
|
|
Re: Cannot set backtrack to false [message #1823377 is a reply to message #1823376] |
Wed, 25 March 2020 16:47 |
|
please also have a look at the subclass that customizeses
org.eclipse.xtext.xtext.generator.parser.antlr.AntlrContentAssistGrammarGenerator.isParserBackTracking(Grammar, AntlrOptions)
override protected isParserBackTracking(Grammar it, AntlrOptions options) {
super.isParserBackTracking(it, options) || !allPredicatedElements.isEmpty
}
=> i assume you have allPredicatedElements
and the content assist grammar uses that as criteria
to enable backtracking.
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
[Updated on: Wed, 25 March 2020 16:48] Report message to a moderator
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.04223 seconds