use of org.eclipse.xtend2.lib.StringConcatenation in project xtext-eclipse by eclipse.
the class DefaultAntlrGrammarGenerator method _ebnf2.
protected String _ebnf2(final Assignment it, final AntlrOptions options, final boolean supportActions) {
StringConcatenation _builder = new StringConcatenation();
_builder.append("(");
_builder.newLine();
_builder.append("\t");
String _assignmentEbnf = this.assignmentEbnf(it.getTerminal(), it, options, supportActions);
_builder.append(_assignmentEbnf, "\t");
_builder.newLineIfNotEmpty();
_builder.append(")");
_builder.newLine();
return _builder.toString();
}
use of org.eclipse.xtend2.lib.StringConcatenation in project xtext-eclipse by eclipse.
the class DefaultAntlrGrammarGenerator method _dataTypeEbnf2.
protected String _dataTypeEbnf2(final AbstractElement it, final boolean supportActions) {
StringConcatenation _builder = new StringConcatenation();
_builder.append("ERROR ");
String _name = it.eClass().getName();
_builder.append(_name);
_builder.append(" not matched");
return _builder.toString();
}
use of org.eclipse.xtend2.lib.StringConcatenation in project xtext-eclipse by eclipse.
the class DefaultAntlrGrammarGenerator method dataTypeEbnf.
protected String dataTypeEbnf(final AbstractElement it, final boolean supportActions) {
StringConcatenation _builder = new StringConcatenation();
{
boolean _mustBeParenthesized = this._grammarAccessExtensions.mustBeParenthesized(it);
if (_mustBeParenthesized) {
_builder.append("(");
_builder.newLineIfNotEmpty();
_builder.append("\t");
String _dataTypeEbnfPredicate = this.dataTypeEbnfPredicate(it);
_builder.append(_dataTypeEbnfPredicate, "\t");
String _dataTypeEbnf2 = this.dataTypeEbnf2(it, supportActions);
_builder.append(_dataTypeEbnf2, "\t");
_builder.newLineIfNotEmpty();
_builder.append(")");
} else {
String _dataTypeEbnf2_1 = this.dataTypeEbnf2(it, supportActions);
_builder.append(_dataTypeEbnf2_1);
}
}
String _cardinality = it.getCardinality();
_builder.append(_cardinality);
_builder.newLineIfNotEmpty();
return _builder.toString();
}
use of org.eclipse.xtend2.lib.StringConcatenation in project xtext-eclipse by eclipse.
the class DefaultAntlrGrammarGenerator method _ebnf2.
protected String _ebnf2(final Alternatives it, final AntlrOptions options, final boolean supportActions) {
StringConcatenation _builder = new StringConcatenation();
{
EList<AbstractElement> _elements = it.getElements();
boolean _hasElements = false;
for (final AbstractElement element : _elements) {
if (!_hasElements) {
_hasElements = true;
} else {
_builder.appendImmediate("\n |", "");
}
String _ebnf = this.ebnf(element, options, supportActions);
_builder.append(_ebnf);
}
}
_builder.newLineIfNotEmpty();
return _builder.toString();
}
use of org.eclipse.xtend2.lib.StringConcatenation in project xtext-eclipse by eclipse.
the class DefaultAntlrGrammarGenerator method compile.
protected CharSequence compile(final Grammar it, final AntlrOptions options) {
StringConcatenation _builder = new StringConcatenation();
String _fileHeader = this._naming.fileHeader();
_builder.append(_fileHeader);
_builder.newLineIfNotEmpty();
_builder.append("grammar ");
String _simpleName = this._naming.toSimpleName(this.getGrammarFileName(it));
_builder.append(_simpleName);
_builder.append(";");
_builder.newLineIfNotEmpty();
String _compileOptions = this.compileOptions(it, options);
_builder.append(_compileOptions);
_builder.newLineIfNotEmpty();
String _compileTokens = this.compileTokens(it, options);
_builder.append(_compileTokens);
_builder.newLineIfNotEmpty();
CharSequence _compileLexerHeader = this.compileLexerHeader(it, options);
_builder.append(_compileLexerHeader);
_builder.newLineIfNotEmpty();
CharSequence _compileParserHeader = this.compileParserHeader(it, options);
_builder.append(_compileParserHeader);
_builder.newLineIfNotEmpty();
String _compileParserMembers = this.compileParserMembers(it, options);
_builder.append(_compileParserMembers);
_builder.newLineIfNotEmpty();
String _compileRuleCatch = this.compileRuleCatch(it, options);
_builder.append(_compileRuleCatch);
_builder.newLineIfNotEmpty();
CharSequence _compileRules = this.compileRules(it, options);
_builder.append(_compileRules);
_builder.newLineIfNotEmpty();
return _builder;
}
Aggregations