Java Code Examples for org.eclipse.xtext.xtext.generator.parser.antlr.AntlrGrammarGenUtil#getContentAssistRuleName()
The following examples show how to use
org.eclipse.xtext.xtext.generator.parser.antlr.AntlrGrammarGenUtil#getContentAssistRuleName() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AntlrContentAssistGrammarGenerator.java From xtext-core with Eclipse Public License 2.0 | 5 votes |
protected CharSequence _compileRule(final Assignment it, final Grammar grammar, final AntlrOptions options) { StringConcatenation _builder = new StringConcatenation(); String _contentAssistRuleName = AntlrGrammarGenUtil.getContentAssistRuleName(GrammarUtil.containingRule(it)); _builder.append(_contentAssistRuleName); _builder.append("__"); String _gaElementIdentifier = this._grammarAccessExtensions.gaElementIdentifier(AntlrGrammarGenUtil.<Assignment>getOriginalElement(it)); _builder.append(_gaElementIdentifier); _builder.newLineIfNotEmpty(); _builder.append("\t"); _builder.append("@init {"); _builder.newLine(); _builder.append("\t\t"); _builder.append("int stackSize = keepStackSize();"); _builder.newLine(); _builder.append("\t"); _builder.append("}"); _builder.newLine(); _builder.append(":"); _builder.newLine(); _builder.append("\t"); String _assignmentEbnf = this.assignmentEbnf(it.getTerminal(), it, options, false); _builder.append(_assignmentEbnf, "\t"); _builder.newLineIfNotEmpty(); _builder.append(";"); _builder.newLine(); _builder.append("finally {"); _builder.newLine(); _builder.append("\t"); _builder.append("restoreStackSize(stackSize);"); _builder.newLine(); _builder.append("}"); _builder.newLine(); return _builder; }
Example 2
Source File: AntlrContentAssistGrammarGenerator.java From xtext-core with Eclipse Public License 2.0 | 5 votes |
@Override protected String _assignmentEbnf(final Alternatives it, final Assignment assignment, final AntlrOptions options, final boolean supportsActions) { StringConcatenation _builder = new StringConcatenation(); _builder.append("("); _builder.newLine(); _builder.append("\t"); _builder.append("{ before(grammarAccess."); String _grammarElementAccess = this._grammarAccessExtensions.grammarElementAccess(AntlrGrammarGenUtil.<Alternatives>getOriginalElement(it)); _builder.append(_grammarElementAccess, "\t"); _builder.append("); }"); _builder.newLineIfNotEmpty(); _builder.append("\t"); _builder.append("("); String _contentAssistRuleName = AntlrGrammarGenUtil.getContentAssistRuleName(GrammarUtil.containingRule(it)); _builder.append(_contentAssistRuleName, "\t"); _builder.append("__"); String _gaElementIdentifier = this._grammarAccessExtensions.gaElementIdentifier(AntlrGrammarGenUtil.<Alternatives>getOriginalElement(it)); _builder.append(_gaElementIdentifier, "\t"); _builder.append(")"); _builder.newLineIfNotEmpty(); _builder.append("\t"); _builder.append("{ after(grammarAccess."); String _grammarElementAccess_1 = this._grammarAccessExtensions.grammarElementAccess(AntlrGrammarGenUtil.<Alternatives>getOriginalElement(it)); _builder.append(_grammarElementAccess_1, "\t"); _builder.append("); }"); _builder.newLineIfNotEmpty(); _builder.append(")"); _builder.newLine(); return _builder.toString(); }
Example 3
Source File: AntlrContentAssistGrammarGenerator.java From xtext-core with Eclipse Public License 2.0 | 5 votes |
@Override protected String _ebnf2(final Alternatives it, final AntlrOptions options, final boolean supportActions) { StringConcatenation _builder = new StringConcatenation(); String _contentAssistRuleName = AntlrGrammarGenUtil.getContentAssistRuleName(GrammarUtil.containingRule(it)); _builder.append(_contentAssistRuleName); _builder.append("__"); String _gaElementIdentifier = this._grammarAccessExtensions.gaElementIdentifier(AntlrGrammarGenUtil.<Alternatives>getOriginalElement(it)); _builder.append(_gaElementIdentifier); return _builder.toString(); }
Example 4
Source File: AntlrContentAssistGrammarGenerator.java From xtext-core with Eclipse Public License 2.0 | 5 votes |
@Override protected String _ebnf2(final Assignment it, final AntlrOptions options, final boolean supportActions) { StringConcatenation _builder = new StringConcatenation(); String _contentAssistRuleName = AntlrGrammarGenUtil.getContentAssistRuleName(GrammarUtil.containingRule(it)); _builder.append(_contentAssistRuleName); _builder.append("__"); String _gaElementIdentifier = this._grammarAccessExtensions.gaElementIdentifier(AntlrGrammarGenUtil.<Assignment>getOriginalElement(it)); _builder.append(_gaElementIdentifier); return _builder.toString(); }
Example 5
Source File: AntlrContentAssistGrammarGenerator.java From xtext-core with Eclipse Public License 2.0 | 5 votes |
@Override protected String _ebnf2(final Group it, final AntlrOptions options, final boolean supportActions) { StringConcatenation _builder = new StringConcatenation(); String _contentAssistRuleName = AntlrGrammarGenUtil.getContentAssistRuleName(GrammarUtil.containingRule(it)); _builder.append(_contentAssistRuleName); _builder.append("__"); String _gaElementIdentifier = this._grammarAccessExtensions.gaElementIdentifier(AntlrGrammarGenUtil.<Group>getOriginalElement(it)); _builder.append(_gaElementIdentifier); _builder.append("__0"); return _builder.toString(); }
Example 6
Source File: AntlrContentAssistGrammarGenerator.java From xtext-core with Eclipse Public License 2.0 | 5 votes |
@Override protected String _ebnf2(final UnorderedGroup it, final AntlrOptions options, final boolean supportActions) { StringConcatenation _builder = new StringConcatenation(); String _contentAssistRuleName = AntlrGrammarGenUtil.getContentAssistRuleName(GrammarUtil.containingRule(it)); _builder.append(_contentAssistRuleName); _builder.append("__"); String _gaElementIdentifier = this._grammarAccessExtensions.gaElementIdentifier(AntlrGrammarGenUtil.<UnorderedGroup>getOriginalElement(it)); _builder.append(_gaElementIdentifier); return _builder.toString(); }
Example 7
Source File: XtextAntlrGeneratorFragment2.java From xtext-core with Eclipse Public License 2.0 | 5 votes |
/** * @since 2.14 */ protected StringConcatenationClient initNameMappings(final List<AbstractElement> partition) { StringConcatenationClient _client = new StringConcatenationClient() { @Override protected void appendTo(StringConcatenationClient.TargetStringConcatenation _builder) { { for(final AbstractElement element : partition) { _builder.append("builder.put(grammarAccess."); String _grammarElementAccess = XtextAntlrGeneratorFragment2.this.grammarUtil.grammarElementAccess(AntlrGrammarGenUtil.<AbstractElement>getOriginalElement(element)); _builder.append(_grammarElementAccess); _builder.append(", \""); String _contentAssistRuleName = AntlrGrammarGenUtil.getContentAssistRuleName(GrammarUtil.containingRule(AntlrGrammarGenUtil.<AbstractElement>getOriginalElement(element))); _builder.append(_contentAssistRuleName); _builder.append("__"); String _gaElementIdentifier = XtextAntlrGeneratorFragment2.this.grammarUtil.gaElementIdentifier(AntlrGrammarGenUtil.<AbstractElement>getOriginalElement(element)); _builder.append(_gaElementIdentifier); { if ((element instanceof Group)) { _builder.append("__0"); } } _builder.append("\");"); _builder.newLineIfNotEmpty(); } } } }; return _client; }
Example 8
Source File: AntlrContentAssistGrammarGenerator.java From xtext-core with Eclipse Public License 2.0 | 4 votes |
protected CharSequence _compileRule(final Alternatives it, final Grammar grammar, final AntlrOptions options) { StringConcatenation _builder = new StringConcatenation(); String _contentAssistRuleName = AntlrGrammarGenUtil.getContentAssistRuleName(GrammarUtil.containingRule(it)); _builder.append(_contentAssistRuleName); _builder.append("__"); String _gaElementIdentifier = this._grammarAccessExtensions.gaElementIdentifier(AntlrGrammarGenUtil.<Alternatives>getOriginalElement(it)); _builder.append(_gaElementIdentifier); _builder.newLineIfNotEmpty(); _builder.append("\t"); _builder.append("@init {"); _builder.newLine(); _builder.append("\t\t"); _builder.append("int stackSize = keepStackSize();"); _builder.newLine(); _builder.append("\t"); _builder.append("}"); _builder.newLine(); _builder.append(":"); _builder.newLine(); _builder.append("\t"); { EList<AbstractElement> _elements = it.getElements(); boolean _hasElements = false; for(final AbstractElement element : _elements) { if (!_hasElements) { _hasElements = true; } else { _builder.appendImmediate("\n|", "\t"); } String _ebnf = this.ebnf(element, options, false); _builder.append(_ebnf, "\t"); } } _builder.newLineIfNotEmpty(); _builder.append(";"); _builder.newLine(); _builder.append("finally {"); _builder.newLine(); _builder.append("\t"); _builder.append("restoreStackSize(stackSize);"); _builder.newLine(); _builder.append("}"); _builder.newLine(); return _builder; }
Example 9
Source File: AntlrContentAssistGrammarGenerator.java From xtext-core with Eclipse Public License 2.0 | 4 votes |
protected CharSequence _compileRule(final UnorderedGroup it, final Grammar grammar, final AntlrOptions options) { CharSequence _xblockexpression = null; { final Function1<AbstractElement, Boolean> _function = (AbstractElement it_1) -> { boolean _isOptionalCardinality = GrammarUtil.isOptionalCardinality(it_1); return Boolean.valueOf((!_isOptionalCardinality)); }; final boolean hasMandatoryContent = IterableExtensions.<AbstractElement>exists(it.getElements(), _function); StringConcatenation _builder = new StringConcatenation(); String _contentAssistRuleName = AntlrGrammarGenUtil.getContentAssistRuleName(GrammarUtil.containingRule(it)); _builder.append(_contentAssistRuleName); _builder.append("__"); String _gaElementIdentifier = this._grammarAccessExtensions.gaElementIdentifier(AntlrGrammarGenUtil.<UnorderedGroup>getOriginalElement(it)); _builder.append(_gaElementIdentifier); _builder.newLineIfNotEmpty(); _builder.append("\t"); _builder.append("@init {"); _builder.newLine(); _builder.append("\t\t"); _builder.append("int stackSize = keepStackSize();"); _builder.newLine(); _builder.append("\t\t"); _builder.append("getUnorderedGroupHelper().enter(grammarAccess."); String _gaRuleElementAccessor = this._grammarAccessExtensions.gaRuleElementAccessor(AntlrGrammarGenUtil.<UnorderedGroup>getOriginalElement(it)); _builder.append(_gaRuleElementAccessor, "\t\t"); _builder.append(");"); _builder.newLineIfNotEmpty(); _builder.append("\t"); _builder.append("}"); _builder.newLine(); _builder.append(":"); _builder.newLine(); _builder.append("\t"); String _contentAssistRuleName_1 = AntlrGrammarGenUtil.getContentAssistRuleName(GrammarUtil.containingRule(it)); _builder.append(_contentAssistRuleName_1, "\t"); _builder.append("__"); String _gaElementIdentifier_1 = this._grammarAccessExtensions.gaElementIdentifier(AntlrGrammarGenUtil.<UnorderedGroup>getOriginalElement(it)); _builder.append(_gaElementIdentifier_1, "\t"); _builder.append("__0"); _builder.newLineIfNotEmpty(); { if (hasMandatoryContent) { _builder.append("\t"); _builder.append("{getUnorderedGroupHelper().canLeave(grammarAccess."); String _gaRuleElementAccessor_1 = this._grammarAccessExtensions.gaRuleElementAccessor(AntlrGrammarGenUtil.<UnorderedGroup>getOriginalElement(it)); _builder.append(_gaRuleElementAccessor_1, "\t"); _builder.append(")}?"); _builder.newLineIfNotEmpty(); } else { _builder.append("\t"); _builder.append("?"); _builder.newLine(); } } _builder.append(";"); _builder.newLine(); _builder.append("finally {"); _builder.newLine(); _builder.append("\t"); _builder.append("getUnorderedGroupHelper().leave(grammarAccess."); String _gaRuleElementAccessor_2 = this._grammarAccessExtensions.gaRuleElementAccessor(AntlrGrammarGenUtil.<UnorderedGroup>getOriginalElement(it)); _builder.append(_gaRuleElementAccessor_2, "\t"); _builder.append(");"); _builder.newLineIfNotEmpty(); _builder.append("\t"); _builder.append("restoreStackSize(stackSize);"); _builder.newLine(); _builder.append("}"); _builder.newLine(); _builder.newLine(); CharSequence _ruleImpl = this.ruleImpl(it, grammar, options); _builder.append(_ruleImpl); _builder.newLineIfNotEmpty(); _builder.newLine(); CharSequence _ruleImpl_1 = this.ruleImpl(it, grammar, options, 0); _builder.append(_ruleImpl_1); _builder.newLineIfNotEmpty(); _xblockexpression = _builder; } return _xblockexpression; }
Example 10
Source File: AntlrContentAssistGrammarGenerator.java From xtext-core with Eclipse Public License 2.0 | 4 votes |
protected CharSequence ruleImpl(final UnorderedGroup it, final Grammar grammar, final AntlrOptions options, final int index) { StringConcatenation _builder = new StringConcatenation(); String _contentAssistRuleName = AntlrGrammarGenUtil.getContentAssistRuleName(GrammarUtil.containingRule(it)); _builder.append(_contentAssistRuleName); _builder.append("__"); String _gaElementIdentifier = this._grammarAccessExtensions.gaElementIdentifier(AntlrGrammarGenUtil.<UnorderedGroup>getOriginalElement(it)); _builder.append(_gaElementIdentifier); _builder.append("__"); _builder.append(index); _builder.newLineIfNotEmpty(); _builder.append("\t"); _builder.append("@init {"); _builder.newLine(); _builder.append("\t\t"); _builder.append("int stackSize = keepStackSize();"); _builder.newLine(); _builder.append("\t"); _builder.append("}"); _builder.newLine(); _builder.append(":"); _builder.newLine(); _builder.append("\t"); String _contentAssistRuleName_1 = AntlrGrammarGenUtil.getContentAssistRuleName(GrammarUtil.containingRule(it)); _builder.append(_contentAssistRuleName_1, "\t"); _builder.append("__"); String _gaElementIdentifier_1 = this._grammarAccessExtensions.gaElementIdentifier(AntlrGrammarGenUtil.<UnorderedGroup>getOriginalElement(it)); _builder.append(_gaElementIdentifier_1, "\t"); _builder.append("__Impl"); _builder.newLineIfNotEmpty(); { int _size = it.getElements().size(); boolean _greaterThan = (_size > (index + 1)); if (_greaterThan) { _builder.append("\t"); String _contentAssistRuleName_2 = AntlrGrammarGenUtil.getContentAssistRuleName(GrammarUtil.containingRule(it)); _builder.append(_contentAssistRuleName_2, "\t"); _builder.append("__"); String _gaElementIdentifier_2 = this._grammarAccessExtensions.gaElementIdentifier(AntlrGrammarGenUtil.<UnorderedGroup>getOriginalElement(it)); _builder.append(_gaElementIdentifier_2, "\t"); _builder.append("__"); _builder.append((index + 1), "\t"); _builder.append("?"); _builder.newLineIfNotEmpty(); } } _builder.append(";"); _builder.newLine(); _builder.append("finally {"); _builder.newLine(); _builder.append("\t"); _builder.append("restoreStackSize(stackSize);"); _builder.newLine(); _builder.append("}"); _builder.newLine(); _builder.newLine(); { int _size_1 = it.getElements().size(); boolean _greaterThan_1 = (_size_1 > (index + 1)); if (_greaterThan_1) { CharSequence _ruleImpl = this.ruleImpl(it, grammar, options, (index + 1)); _builder.append(_ruleImpl); _builder.newLineIfNotEmpty(); } } return _builder; }
Example 11
Source File: AntlrContentAssistGrammarGenerator.java From xtext-core with Eclipse Public License 2.0 | 4 votes |
protected CharSequence ruleImpl(final Group it, final Grammar grammar, final AntlrOptions options, final int index) { StringConcatenation _builder = new StringConcatenation(); String _contentAssistRuleName = AntlrGrammarGenUtil.getContentAssistRuleName(GrammarUtil.containingRule(it)); _builder.append(_contentAssistRuleName); _builder.append("__"); String _gaElementIdentifier = this._grammarAccessExtensions.gaElementIdentifier(AntlrGrammarGenUtil.<Group>getOriginalElement(it)); _builder.append(_gaElementIdentifier); _builder.append("__"); _builder.append(index); _builder.newLineIfNotEmpty(); _builder.append("\t"); _builder.append("@init {"); _builder.newLine(); _builder.append("\t\t"); _builder.append("int stackSize = keepStackSize();"); _builder.newLine(); _builder.append("\t"); _builder.append("}"); _builder.newLine(); _builder.append(":"); _builder.newLine(); _builder.append("\t"); String _contentAssistRuleName_1 = AntlrGrammarGenUtil.getContentAssistRuleName(GrammarUtil.containingRule(it)); _builder.append(_contentAssistRuleName_1, "\t"); _builder.append("__"); String _gaElementIdentifier_1 = this._grammarAccessExtensions.gaElementIdentifier(AntlrGrammarGenUtil.<Group>getOriginalElement(it)); _builder.append(_gaElementIdentifier_1, "\t"); _builder.append("__"); _builder.append(index, "\t"); _builder.append("__Impl"); _builder.newLineIfNotEmpty(); { int _size = it.getElements().size(); boolean _greaterThan = (_size > (index + 1)); if (_greaterThan) { _builder.append("\t"); String _contentAssistRuleName_2 = AntlrGrammarGenUtil.getContentAssistRuleName(GrammarUtil.containingRule(it)); _builder.append(_contentAssistRuleName_2, "\t"); _builder.append("__"); String _gaElementIdentifier_2 = this._grammarAccessExtensions.gaElementIdentifier(AntlrGrammarGenUtil.<Group>getOriginalElement(it)); _builder.append(_gaElementIdentifier_2, "\t"); _builder.append("__"); _builder.append((index + 1), "\t"); _builder.newLineIfNotEmpty(); } } _builder.append(";"); _builder.newLine(); _builder.append("finally {"); _builder.newLine(); _builder.append("\t"); _builder.append("restoreStackSize(stackSize);"); _builder.newLine(); _builder.append("}"); _builder.newLine(); _builder.newLine(); String _contentAssistRuleName_3 = AntlrGrammarGenUtil.getContentAssistRuleName(GrammarUtil.containingRule(it)); _builder.append(_contentAssistRuleName_3); _builder.append("__"); String _gaElementIdentifier_3 = this._grammarAccessExtensions.gaElementIdentifier(AntlrGrammarGenUtil.<Group>getOriginalElement(it)); _builder.append(_gaElementIdentifier_3); _builder.append("__"); _builder.append(index); _builder.append("__Impl"); _builder.newLineIfNotEmpty(); _builder.append("\t"); _builder.append("@init {"); _builder.newLine(); _builder.append("\t\t"); _builder.append("int stackSize = keepStackSize();"); _builder.newLine(); _builder.append("\t"); _builder.append("}"); _builder.newLine(); _builder.append(":"); _builder.newLine(); String _ebnf = this.ebnf(it.getElements().get(index), options, false); _builder.append(_ebnf); _builder.newLineIfNotEmpty(); _builder.append(";"); _builder.newLine(); _builder.append("finally {"); _builder.newLine(); _builder.append("\t"); _builder.append("restoreStackSize(stackSize);"); _builder.newLine(); _builder.append("}"); _builder.newLine(); _builder.newLine(); { int _size_1 = it.getElements().size(); boolean _greaterThan_1 = (_size_1 > (index + 1)); if (_greaterThan_1) { CharSequence _ruleImpl = this.ruleImpl(it, grammar, options, (index + 1)); _builder.append(_ruleImpl); _builder.newLineIfNotEmpty(); } } return _builder; }