Java Code Examples for org.eclipse.xtext.AbstractElement#isFirstSetPredicated()

The following examples show how to use org.eclipse.xtext.AbstractElement#isFirstSetPredicated() . 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: AbstractAntlrGrammarGenerator.java    From xtext-core with Eclipse Public License 2.0 5 votes vote down vote up
protected String ebnfPredicate(final AbstractElement it, final AntlrOptions options) {
  StringConcatenation _builder = new StringConcatenation();
  {
    if ((this._grammarAccessExtensions.predicated(it) || it.isFirstSetPredicated())) {
      _builder.append("(");
      {
        boolean _predicated = this._grammarAccessExtensions.predicated(it);
        if (_predicated) {
          String _ebnf2 = this.ebnf2(this._grammarAccessExtensions.predicatedElement(it), options, false);
          _builder.append(_ebnf2);
        } else {
          {
            List<AbstractElement> _firstSet = AntlrGrammarGenUtil.getFirstSet(it);
            boolean _hasElements = false;
            for(final AbstractElement e : _firstSet) {
              if (!_hasElements) {
                _hasElements = true;
              } else {
                _builder.appendImmediate(" | ", "");
              }
              String _ebnf2_1 = this.ebnf2(e, options, false);
              _builder.append(_ebnf2_1);
            }
          }
        }
      }
      _builder.append(")=>");
    }
  }
  _builder.newLineIfNotEmpty();
  return _builder.toString();
}
 
Example 2
Source File: AbstractAntlrGrammarGenerator.java    From xtext-core with Eclipse Public License 2.0 5 votes vote down vote up
protected String dataTypeEbnfPredicate(final AbstractElement it) {
  StringConcatenation _builder = new StringConcatenation();
  {
    if ((this._grammarAccessExtensions.predicated(it) || it.isFirstSetPredicated())) {
      _builder.append("(");
      {
        boolean _predicated = this._grammarAccessExtensions.predicated(it);
        if (_predicated) {
          String _dataTypeEbnf2 = this.dataTypeEbnf2(this._grammarAccessExtensions.predicatedElement(it), false);
          _builder.append(_dataTypeEbnf2);
        } else {
          {
            List<AbstractElement> _firstSet = AntlrGrammarGenUtil.getFirstSet(it);
            boolean _hasElements = false;
            for(final AbstractElement e : _firstSet) {
              if (!_hasElements) {
                _hasElements = true;
              } else {
                _builder.appendImmediate(" | ", "");
              }
              String _dataTypeEbnf2_1 = this.dataTypeEbnf2(e, false);
              _builder.append(_dataTypeEbnf2_1);
            }
          }
        }
      }
      _builder.append(")=>");
    }
  }
  _builder.newLineIfNotEmpty();
  return _builder.toString();
}
 
Example 3
Source File: AbstractAntlrGrammarGenerator.java    From xtext-core with Eclipse Public License 2.0 4 votes vote down vote up
protected boolean _mustBeParenthesized(final AbstractElement it) {
  return (this._grammarAccessExtensions.predicated(it) || it.isFirstSetPredicated());
}