Java Code Examples for org.eclipse.xtext.Group#getElements()

The following examples show how to use org.eclipse.xtext.Group#getElements() . 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: TerminalRuleInterpreter.java    From xtext-extras with Eclipse Public License 2.0 6 votes vote down vote up
@Override
public Boolean caseGroup(Group object) {
	boolean result = false;
	OUTER: do {
		IMarker marker = markerFactory.mark();
		for(AbstractElement element: object.getElements()) {
			if (!doSwitch(element)) {
				marker.rollback();
				break OUTER;
			}
		}
		result = true;
		continue OUTER;
	} while(GrammarUtil.isMultipleCardinality(object));
	return result || GrammarUtil.isOptionalCardinality(object);
}
 
Example 2
Source File: TerminalRuleToLexerBody.java    From xtext-extras with Eclipse Public License 2.0 5 votes vote down vote up
@Override
public String caseGroup(Group object) {
	if (!Strings.isEmpty(object.getCardinality()))
		result.append('(');
	boolean first = true;
	for (AbstractElement elem : object.getElements()) {
		if (!first) result.append(' ');
		first = false;
		doSwitch(elem);
	}
	if (!Strings.isEmpty(object.getCardinality()))
		result.append(')');
	result.append(Strings.emptyIfNull(object.getCardinality()));
	return "";
}
 
Example 3
Source File: ParserBasedContentAssistContextFactory.java    From xtext-eclipse with Eclipse Public License 2.0 5 votes vote down vote up
@Override
public Boolean caseGroup(Group object) {
	boolean more = true;
	if (object.getGuardCondition() != null) {
		Set<Parameter> parameterValues = getParameterValues(object);
		more = new ConditionEvaluator(parameterValues).evaluate(object.getGuardCondition());
	}
	if (more) {
		for(AbstractElement element: object.getElements()) {
			more = more && doSwitch(element);
		}
	}
	return more || isOptional(object);
}
 
Example 4
Source File: SLCommentPrefixCalculator.java    From xtext-eclipse with Eclipse Public License 2.0 5 votes vote down vote up
@Override
public Boolean caseGroup(Group object) {
	for (AbstractElement elem: object.getElements()) {
		if (!doSwitch(elem))
			return false;
	}
	return true;
}
 
Example 5
Source File: GrammarWithoutLeftRecursionInspector.java    From xtext-core with Eclipse Public License 2.0 5 votes vote down vote up
@Override
public Boolean caseGroup(Group object) {
	for(AbstractElement element: object.getElements()) {
		if (!doSwitch(element)) {
			return GrammarUtil.isOptionalCardinality(object);
		}
	}
	return Boolean.TRUE;
}
 
Example 6
Source File: FirstSetComputer.java    From xtext-core with Eclipse Public License 2.0 5 votes vote down vote up
@Override
public Boolean caseGroup(Group object) {
	for(AbstractElement element: object.getElements()) {
		if (!doSwitch(element)) {
			return GrammarUtil.isOptionalCardinality(object);
		}
	}
	return GrammarUtil.isOptionalCardinality(object);
}
 
Example 7
Source File: TerminalRuleToLexerBody.java    From xtext-core with Eclipse Public License 2.0 5 votes vote down vote up
@Override
public String caseGroup(Group object) {
	if (!Strings.isEmpty(object.getCardinality()))
		result.append('(');
	boolean first = true;
	for (AbstractElement elem : object.getElements()) {
		if (!first) result.append(' ');
		first = false;
		doSwitch(elem);
	}
	if (!Strings.isEmpty(object.getCardinality()))
		result.append(')');
	result.append(Strings.emptyIfNull(object.getCardinality()));
	return "";
}
 
Example 8
Source File: AbstractAntlrGrammarGenerator.java    From xtext-core with Eclipse Public License 2.0 5 votes vote down vote up
protected String _dataTypeEbnf2(final Group it, final boolean supportActions) {
  StringConcatenation _builder = new StringConcatenation();
  {
    EList<AbstractElement> _elements = it.getElements();
    for(final AbstractElement e : _elements) {
      String _dataTypeEbnf = this.dataTypeEbnf(e, supportActions);
      _builder.append(_dataTypeEbnf);
    }
  }
  _builder.newLineIfNotEmpty();
  return _builder.toString();
}
 
Example 9
Source File: AbstractAntlrGrammarGenerator.java    From xtext-core with Eclipse Public License 2.0 5 votes vote down vote up
protected String _ebnf2(final Group it, final AntlrOptions options, final boolean supportActions) {
  StringConcatenation _builder = new StringConcatenation();
  {
    EList<AbstractElement> _elements = it.getElements();
    for(final AbstractElement element : _elements) {
      String _ebnf = this.ebnf(element, options, supportActions);
      _builder.append(_ebnf);
    }
  }
  _builder.newLineIfNotEmpty();
  return _builder.toString();
}
 
Example 10
Source File: FollowElementCalculator.java    From xtext-core with Eclipse Public License 2.0 5 votes vote down vote up
@Override
public Boolean caseGroup(Group object) {
	boolean more = true;
	if (object.getGuardCondition() != null) {
		Set<Parameter> parameterValues = getParameterValues(object);
		more = new ConditionEvaluator(parameterValues).evaluate(object.getGuardCondition());
	}
	if (more) {
		for(AbstractElement element: object.getElements()) {
			more = more && doSwitch(element);
		}
	}
	return more || isOptional(object);
}
 
Example 11
Source File: KeywordCollector.java    From dsl-devkit with Eclipse Public License 1.0 5 votes vote down vote up
/** {@inheritDoc} */
@Override
public Boolean caseGroup(final Group group) {
  for (final AbstractElement element : group.getElements()) {
    if (!doSwitch(element)) {
      return false;
    }
  }
  return true;
}