mirror of
https://github.com/sigmasternchen/xtext-core
synced 2025-03-15 08:18:55 +00:00
added hoisted predicates to unordered group rendering
This commit is contained in:
parent
f23274e072
commit
2303cce7c4
4 changed files with 31 additions and 8 deletions
|
@ -336,7 +336,9 @@ abstract class AbstractAntlrGrammarGenerator {
|
|||
protected dispatch def String dataTypeEbnf2(AbstractElement it, boolean supportActions) '''ERROR «eClass.name» not matched'''
|
||||
|
||||
protected dispatch def String dataTypeEbnf2(Alternatives it, boolean supportActions) '''
|
||||
«FOR e:elements SEPARATOR '\n |'»«e.findHoistingGuard.renderPredicate»«e.dataTypeEbnf(supportActions)»«ENDFOR»
|
||||
«FOR e:elements SEPARATOR '\n |'»«e.findHoistingGuard.renderPredicate»
|
||||
«e.dataTypeEbnf(supportActions)»
|
||||
«ENDFOR»
|
||||
'''
|
||||
|
||||
protected dispatch def String dataTypeEbnf2(Group it, boolean supportActions) '''
|
||||
|
@ -358,7 +360,9 @@ abstract class AbstractAntlrGrammarGenerator {
|
|||
protected dispatch def String ebnf2(AbstractElement it, AntlrOptions options, boolean supportActions) '''ERROR «eClass.name» not matched'''
|
||||
|
||||
protected dispatch def String ebnf2(Alternatives it, AntlrOptions options, boolean supportActions) '''
|
||||
«FOR element:elements SEPARATOR '\n |'»«element.findHoistingGuard.renderPredicate»«element.ebnf(options, supportActions)»«ENDFOR»
|
||||
«FOR element:elements SEPARATOR '\n |'»«element.findHoistingGuard.renderPredicate»
|
||||
«element.ebnf(options, supportActions)»
|
||||
«ENDFOR»
|
||||
'''
|
||||
|
||||
protected dispatch def String ebnf2(Group it, AntlrOptions options, boolean supportActions) '''
|
||||
|
@ -366,7 +370,9 @@ abstract class AbstractAntlrGrammarGenerator {
|
|||
'''
|
||||
|
||||
protected dispatch def String ebnf2(UnorderedGroup it, AntlrOptions options, boolean supportActions) '''
|
||||
(«FOR element:elements SEPARATOR '\n |'»«element.ebnf(options, supportActions)»«ENDFOR»)*
|
||||
(«FOR element:elements SEPARATOR '\n |'»«element.findHoistingGuard.renderPredicate»
|
||||
«element.ebnf(options, supportActions)»
|
||||
«ENDFOR»)*
|
||||
'''
|
||||
|
||||
protected dispatch def String ebnf2(Assignment it, AntlrOptions options, boolean supportActions) '''
|
||||
|
|
|
@ -107,6 +107,7 @@ abstract class AbstractAntlrGrammarWithActionsGenerator extends AbstractAntlrGra
|
|||
(
|
||||
(
|
||||
«FOR element:elements.indexed SEPARATOR '|'»
|
||||
«element.value.findHoistingGuard.renderPredicate»
|
||||
(
|
||||
{getUnorderedGroupHelper().canSelect(grammarAccess.«(originalElement as AbstractElement).gaRuleElementAccessor», «element.key»)}?=>(
|
||||
{
|
||||
|
@ -151,6 +152,7 @@ abstract class AbstractAntlrGrammarWithActionsGenerator extends AbstractAntlrGra
|
|||
(
|
||||
(
|
||||
«FOR element:elements.indexed SEPARATOR '|'»
|
||||
«element.value.findHoistingGuard.renderPredicate»
|
||||
(
|
||||
{getUnorderedGroupHelper().canSelect(grammarAccess.«(originalElement as AbstractElement).gaRuleElementAccessor», «element.key»)}?=>(
|
||||
{
|
||||
|
|
|
@ -820,11 +820,13 @@ public abstract class AbstractAntlrGrammarGenerator {
|
|||
}
|
||||
String _renderPredicate = this._hoistingProcessor.findHoistingGuard(e).renderPredicate();
|
||||
_builder.append(_renderPredicate);
|
||||
_builder.newLineIfNotEmpty();
|
||||
_builder.append("\t");
|
||||
String _dataTypeEbnf = this.dataTypeEbnf(e, supportActions);
|
||||
_builder.append(_dataTypeEbnf);
|
||||
_builder.append(_dataTypeEbnf, "\t");
|
||||
_builder.newLineIfNotEmpty();
|
||||
}
|
||||
}
|
||||
_builder.newLineIfNotEmpty();
|
||||
return _builder.toString();
|
||||
}
|
||||
|
||||
|
@ -892,11 +894,13 @@ public abstract class AbstractAntlrGrammarGenerator {
|
|||
}
|
||||
String _renderPredicate = this._hoistingProcessor.findHoistingGuard(element).renderPredicate();
|
||||
_builder.append(_renderPredicate);
|
||||
_builder.newLineIfNotEmpty();
|
||||
_builder.append("\t");
|
||||
String _ebnf = this.ebnf(element, options, supportActions);
|
||||
_builder.append(_ebnf);
|
||||
_builder.append(_ebnf, "\t");
|
||||
_builder.newLineIfNotEmpty();
|
||||
}
|
||||
}
|
||||
_builder.newLineIfNotEmpty();
|
||||
return _builder.toString();
|
||||
}
|
||||
|
||||
|
@ -925,8 +929,13 @@ public abstract class AbstractAntlrGrammarGenerator {
|
|||
} else {
|
||||
_builder.appendImmediate("\n |", "");
|
||||
}
|
||||
String _renderPredicate = this._hoistingProcessor.findHoistingGuard(element).renderPredicate();
|
||||
_builder.append(_renderPredicate);
|
||||
_builder.newLineIfNotEmpty();
|
||||
_builder.append("\t");
|
||||
String _ebnf = this.ebnf(element, options, supportActions);
|
||||
_builder.append(_ebnf);
|
||||
_builder.append(_ebnf, "\t");
|
||||
_builder.newLineIfNotEmpty();
|
||||
}
|
||||
}
|
||||
_builder.append(")*");
|
||||
|
|
|
@ -261,6 +261,9 @@ public abstract class AbstractAntlrGrammarWithActionsGenerator extends AbstractA
|
|||
} else {
|
||||
_builder.appendImmediate("|", "");
|
||||
}
|
||||
String _renderPredicate = this._hoistingProcessor.findHoistingGuard(element.getValue()).renderPredicate();
|
||||
_builder.append(_renderPredicate);
|
||||
_builder.newLineIfNotEmpty();
|
||||
_builder.append("(");
|
||||
_builder.newLine();
|
||||
_builder.append("\t");
|
||||
|
@ -424,6 +427,9 @@ public abstract class AbstractAntlrGrammarWithActionsGenerator extends AbstractA
|
|||
} else {
|
||||
_builder.appendImmediate("|", "");
|
||||
}
|
||||
String _renderPredicate = this._hoistingProcessor.findHoistingGuard(element.getValue()).renderPredicate();
|
||||
_builder.append(_renderPredicate);
|
||||
_builder.newLineIfNotEmpty();
|
||||
_builder.append("(");
|
||||
_builder.newLine();
|
||||
_builder.append("\t");
|
||||
|
|
Loading…
Reference in a new issue