org.eclipse.xtext.Condition Java Examples

The following examples show how to use org.eclipse.xtext.Condition. 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: NamedArgumentImpl.java    From xtext-core with Eclipse Public License 2.0 6 votes vote down vote up
/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
@Override
public void eUnset(int featureID) {
	switch (featureID) {
		case XtextPackage.NAMED_ARGUMENT__PARAMETER:
			setParameter((Parameter)null);
			return;
		case XtextPackage.NAMED_ARGUMENT__VALUE:
			setValue((Condition)null);
			return;
		case XtextPackage.NAMED_ARGUMENT__CALLED_BY_NAME:
			setCalledByName(CALLED_BY_NAME_EDEFAULT);
			return;
	}
	super.eUnset(featureID);
}
 
Example #2
Source File: NamedArgumentImpl.java    From xtext-core with Eclipse Public License 2.0 6 votes vote down vote up
/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
@Override
public void eSet(int featureID, Object newValue) {
	switch (featureID) {
		case XtextPackage.NAMED_ARGUMENT__PARAMETER:
			setParameter((Parameter)newValue);
			return;
		case XtextPackage.NAMED_ARGUMENT__VALUE:
			setValue((Condition)newValue);
			return;
		case XtextPackage.NAMED_ARGUMENT__CALLED_BY_NAME:
			setCalledByName((Boolean)newValue);
			return;
	}
	super.eSet(featureID, newValue);
}
 
Example #3
Source File: AbstractAntlrGrammarWithActionsGenerator.java    From xtext-core with Eclipse Public License 2.0 6 votes vote down vote up
@Override
protected String _dataTypeEbnf2(final Group it, final boolean supportActions) {
  String _xifexpression = null;
  Condition _guardCondition = it.getGuardCondition();
  boolean _tripleEquals = (_guardCondition == null);
  if (_tripleEquals) {
    _xifexpression = super._dataTypeEbnf2(it, supportActions);
  } else {
    String _guardConditionToAntlr = AntlrGrammarGenUtil.guardConditionToAntlr(it);
    String _plus = (_guardConditionToAntlr + "(");
    String __dataTypeEbnf2 = super._dataTypeEbnf2(it, supportActions);
    String _plus_1 = (_plus + __dataTypeEbnf2);
    _xifexpression = (_plus_1 + ")");
  }
  return _xifexpression;
}
 
Example #4
Source File: XtextLinkerTest.java    From xtext-core with Eclipse Public License 2.0 6 votes vote down vote up
@Test
public void testGuardLinking() throws Exception {
  StringConcatenation _builder = new StringConcatenation();
  _builder.append("grammar test.Lang with org.eclipse.xtext.common.Terminals");
  _builder.newLine();
  _builder.append("generate test \'http://test\'");
  _builder.newLine();
  _builder.append("Root<MyArg>: <MyArg> name=ID | <!MyArg> name=STRING;");
  _builder.newLine();
  final String grammarAsString = _builder.toString();
  EObject _model = this.getModel(grammarAsString);
  final Grammar grammar = ((Grammar) _model);
  AbstractRule _head = IterableExtensions.<AbstractRule>head(grammar.getRules());
  final ParserRule rootRule = ((ParserRule) _head);
  AbstractElement _alternatives = rootRule.getAlternatives();
  final Alternatives alternatives = ((Alternatives) _alternatives);
  AbstractElement _head_1 = IterableExtensions.<AbstractElement>head(alternatives.getElements());
  Condition _guardCondition = ((Group) _head_1).getGuardCondition();
  final ParameterReference firstGuard = ((ParameterReference) _guardCondition);
  Assert.assertEquals(IterableExtensions.<Parameter>head(rootRule.getParameters()), firstGuard.getParameter());
  AbstractElement _last = IterableExtensions.<AbstractElement>last(alternatives.getElements());
  Condition _guardCondition_1 = ((Group) _last).getGuardCondition();
  final Negation secondGuard = ((Negation) _guardCondition_1);
  Condition _value = secondGuard.getValue();
  Assert.assertEquals(IterableExtensions.<Parameter>head(rootRule.getParameters()), ((ParameterReference) _value).getParameter());
}
 
Example #5
Source File: AbstractAntlrGrammarWithActionsGenerator.java    From xtext-core with Eclipse Public License 2.0 6 votes vote down vote up
@Override
protected String _ebnf2(final Group it, final AntlrOptions options, final boolean supportActions) {
  String _xifexpression = null;
  Condition _guardCondition = it.getGuardCondition();
  boolean _tripleEquals = (_guardCondition == null);
  if (_tripleEquals) {
    _xifexpression = super._ebnf2(it, options, supportActions);
  } else {
    String _guardConditionToAntlr = AntlrGrammarGenUtil.guardConditionToAntlr(it);
    String _plus = (_guardConditionToAntlr + "(");
    String __ebnf2 = super._ebnf2(it, options, supportActions);
    String _plus_1 = (_plus + __ebnf2);
    _xifexpression = (_plus_1 + ")");
  }
  return _xifexpression;
}
 
Example #6
Source File: CompositeConditionImpl.java    From xtext-core with Eclipse Public License 2.0 5 votes vote down vote up
/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public void setRight(Condition newRight) {
	if (newRight != right) {
		NotificationChain msgs = null;
		if (right != null)
			msgs = ((InternalEObject)right).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - XtextPackage.COMPOSITE_CONDITION__RIGHT, null, msgs);
		if (newRight != null)
			msgs = ((InternalEObject)newRight).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - XtextPackage.COMPOSITE_CONDITION__RIGHT, null, msgs);
		msgs = basicSetRight(newRight, msgs);
		if (msgs != null) msgs.dispatch();
	}
	else if (eNotificationRequired())
		eNotify(new ENotificationImpl(this, Notification.SET, XtextPackage.COMPOSITE_CONDITION__RIGHT, newRight, newRight));
}
 
Example #7
Source File: AntlrGrammarGenUtil.java    From xtext-core with Eclipse Public License 2.0 5 votes vote down vote up
/**
 * @since 2.9
 */
public static String guardConditionToAntlr(Group group) {
	Condition condition = group.getGuardCondition();
	if (condition == null) {
		return "";
	}
	return "{" + conditionToAntlr(condition, false) + "}?=>";
}
 
Example #8
Source File: NamedArgumentImpl.java    From xtext-core with Eclipse Public License 2.0 5 votes vote down vote up
/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public void setValue(Condition newValue) {
	if (newValue != value) {
		NotificationChain msgs = null;
		if (value != null)
			msgs = ((InternalEObject)value).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - XtextPackage.NAMED_ARGUMENT__VALUE, null, msgs);
		if (newValue != null)
			msgs = ((InternalEObject)newValue).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - XtextPackage.NAMED_ARGUMENT__VALUE, null, msgs);
		msgs = basicSetValue(newValue, msgs);
		if (msgs != null) msgs.dispatch();
	}
	else if (eNotificationRequired())
		eNotify(new ENotificationImpl(this, Notification.SET, XtextPackage.NAMED_ARGUMENT__VALUE, newValue, newValue));
}
 
Example #9
Source File: NamedArgumentImpl.java    From xtext-core with Eclipse Public License 2.0 5 votes vote down vote up
/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public NotificationChain basicSetValue(Condition newValue, NotificationChain msgs) {
	Condition oldValue = value;
	value = newValue;
	if (eNotificationRequired()) {
		ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, XtextPackage.NAMED_ARGUMENT__VALUE, oldValue, newValue);
		if (msgs == null) msgs = notification; else msgs.add(notification);
	}
	return msgs;
}
 
Example #10
Source File: NegationImpl.java    From xtext-core with Eclipse Public License 2.0 5 votes vote down vote up
/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
@Override
public void eUnset(int featureID) {
	switch (featureID) {
		case XtextPackage.NEGATION__VALUE:
			setValue((Condition)null);
			return;
	}
	super.eUnset(featureID);
}
 
Example #11
Source File: NegationImpl.java    From xtext-core with Eclipse Public License 2.0 5 votes vote down vote up
/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
@Override
public void eSet(int featureID, Object newValue) {
	switch (featureID) {
		case XtextPackage.NEGATION__VALUE:
			setValue((Condition)newValue);
			return;
	}
	super.eSet(featureID, newValue);
}
 
Example #12
Source File: NegationImpl.java    From xtext-core with Eclipse Public License 2.0 5 votes vote down vote up
/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public void setValue(Condition newValue) {
	if (newValue != value) {
		NotificationChain msgs = null;
		if (value != null)
			msgs = ((InternalEObject)value).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - XtextPackage.NEGATION__VALUE, null, msgs);
		if (newValue != null)
			msgs = ((InternalEObject)newValue).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - XtextPackage.NEGATION__VALUE, null, msgs);
		msgs = basicSetValue(newValue, msgs);
		if (msgs != null) msgs.dispatch();
	}
	else if (eNotificationRequired())
		eNotify(new ENotificationImpl(this, Notification.SET, XtextPackage.NEGATION__VALUE, newValue, newValue));
}
 
Example #13
Source File: NegationImpl.java    From xtext-core with Eclipse Public License 2.0 5 votes vote down vote up
/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public NotificationChain basicSetValue(Condition newValue, NotificationChain msgs) {
	Condition oldValue = value;
	value = newValue;
	if (eNotificationRequired()) {
		ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, XtextPackage.NEGATION__VALUE, oldValue, newValue);
		if (msgs == null) msgs = notification; else msgs.add(notification);
	}
	return msgs;
}
 
Example #14
Source File: CompositeConditionImpl.java    From xtext-core with Eclipse Public License 2.0 5 votes vote down vote up
/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
@Override
public void eUnset(int featureID) {
	switch (featureID) {
		case XtextPackage.COMPOSITE_CONDITION__LEFT:
			setLeft((Condition)null);
			return;
		case XtextPackage.COMPOSITE_CONDITION__RIGHT:
			setRight((Condition)null);
			return;
	}
	super.eUnset(featureID);
}
 
Example #15
Source File: CompositeConditionImpl.java    From xtext-core with Eclipse Public License 2.0 5 votes vote down vote up
/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
@Override
public void eSet(int featureID, Object newValue) {
	switch (featureID) {
		case XtextPackage.COMPOSITE_CONDITION__LEFT:
			setLeft((Condition)newValue);
			return;
		case XtextPackage.COMPOSITE_CONDITION__RIGHT:
			setRight((Condition)newValue);
			return;
	}
	super.eSet(featureID, newValue);
}
 
Example #16
Source File: CompositeConditionImpl.java    From xtext-core with Eclipse Public License 2.0 5 votes vote down vote up
/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public NotificationChain basicSetRight(Condition newRight, NotificationChain msgs) {
	Condition oldRight = right;
	right = newRight;
	if (eNotificationRequired()) {
		ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, XtextPackage.COMPOSITE_CONDITION__RIGHT, oldRight, newRight);
		if (msgs == null) msgs = notification; else msgs.add(notification);
	}
	return msgs;
}
 
Example #17
Source File: CompositeConditionImpl.java    From xtext-core with Eclipse Public License 2.0 5 votes vote down vote up
/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public void setLeft(Condition newLeft) {
	if (newLeft != left) {
		NotificationChain msgs = null;
		if (left != null)
			msgs = ((InternalEObject)left).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - XtextPackage.COMPOSITE_CONDITION__LEFT, null, msgs);
		if (newLeft != null)
			msgs = ((InternalEObject)newLeft).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - XtextPackage.COMPOSITE_CONDITION__LEFT, null, msgs);
		msgs = basicSetLeft(newLeft, msgs);
		if (msgs != null) msgs.dispatch();
	}
	else if (eNotificationRequired())
		eNotify(new ENotificationImpl(this, Notification.SET, XtextPackage.COMPOSITE_CONDITION__LEFT, newLeft, newLeft));
}
 
Example #18
Source File: CompositeConditionImpl.java    From xtext-core with Eclipse Public License 2.0 5 votes vote down vote up
/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public NotificationChain basicSetLeft(Condition newLeft, NotificationChain msgs) {
	Condition oldLeft = left;
	left = newLeft;
	if (eNotificationRequired()) {
		ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, XtextPackage.COMPOSITE_CONDITION__LEFT, oldLeft, newLeft);
		if (msgs == null) msgs = notification; else msgs.add(notification);
	}
	return msgs;
}
 
Example #19
Source File: XtextLinkerTest.java    From xtext-core with Eclipse Public License 2.0 5 votes vote down vote up
@Test
public void testNamedParameterLinking() throws Exception {
  StringConcatenation _builder = new StringConcatenation();
  _builder.append("grammar test.Lang with org.eclipse.xtext.common.Terminals");
  _builder.newLine();
  _builder.append("generate test \'http://test\'");
  _builder.newLine();
  _builder.append("Root<MyArg>: rule=Rule<MyArg>;");
  _builder.newLine();
  _builder.append("Rule<MyParam>: name=ID child=Root<MyArg=MyParam>?;");
  _builder.newLine();
  final String grammarAsString = _builder.toString();
  EObject _model = this.getModel(grammarAsString);
  final Grammar grammar = ((Grammar) _model);
  AbstractRule _head = IterableExtensions.<AbstractRule>head(grammar.getRules());
  final ParserRule rootRule = ((ParserRule) _head);
  AbstractRule _last = IterableExtensions.<AbstractRule>last(grammar.getRules());
  final ParserRule lastRule = ((ParserRule) _last);
  AbstractElement _alternatives = lastRule.getAlternatives();
  AbstractElement _last_1 = IterableExtensions.<AbstractElement>last(((Group) _alternatives).getElements());
  final Assignment lastAssignment = ((Assignment) _last_1);
  AbstractElement _terminal = lastAssignment.getTerminal();
  final RuleCall ruleCall = ((RuleCall) _terminal);
  final NamedArgument argument = IterableExtensions.<NamedArgument>head(ruleCall.getArguments());
  Assert.assertEquals(IterableExtensions.<Parameter>head(rootRule.getParameters()), argument.getParameter());
  Condition _value = argument.getValue();
  Assert.assertEquals(IterableExtensions.<Parameter>head(lastRule.getParameters()), ((ParameterReference) _value).getParameter());
}
 
Example #20
Source File: GroupImpl.java    From xtext-core with Eclipse Public License 2.0 5 votes vote down vote up
/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
@Override
public void eUnset(int featureID) {
	switch (featureID) {
		case XtextPackage.GROUP__GUARD_CONDITION:
			setGuardCondition((Condition)null);
			return;
	}
	super.eUnset(featureID);
}
 
Example #21
Source File: GroupImpl.java    From xtext-core with Eclipse Public License 2.0 5 votes vote down vote up
/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
@SuppressWarnings("unchecked")
@Override
public void eSet(int featureID, Object newValue) {
	switch (featureID) {
		case XtextPackage.GROUP__GUARD_CONDITION:
			setGuardCondition((Condition)newValue);
			return;
	}
	super.eSet(featureID, newValue);
}
 
Example #22
Source File: GroupImpl.java    From xtext-core with Eclipse Public License 2.0 5 votes vote down vote up
/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public void setGuardCondition(Condition newGuardCondition) {
	if (newGuardCondition != guardCondition) {
		NotificationChain msgs = null;
		if (guardCondition != null)
			msgs = ((InternalEObject)guardCondition).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - XtextPackage.GROUP__GUARD_CONDITION, null, msgs);
		if (newGuardCondition != null)
			msgs = ((InternalEObject)newGuardCondition).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - XtextPackage.GROUP__GUARD_CONDITION, null, msgs);
		msgs = basicSetGuardCondition(newGuardCondition, msgs);
		if (msgs != null) msgs.dispatch();
	}
	else if (eNotificationRequired())
		eNotify(new ENotificationImpl(this, Notification.SET, XtextPackage.GROUP__GUARD_CONDITION, newGuardCondition, newGuardCondition));
}
 
Example #23
Source File: GroupImpl.java    From xtext-core with Eclipse Public License 2.0 5 votes vote down vote up
/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public NotificationChain basicSetGuardCondition(Condition newGuardCondition, NotificationChain msgs) {
	Condition oldGuardCondition = guardCondition;
	guardCondition = newGuardCondition;
	if (eNotificationRequired()) {
		ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, XtextPackage.GROUP__GUARD_CONDITION, oldGuardCondition, newGuardCondition);
		if (msgs == null) msgs = notification; else msgs.add(notification);
	}
	return msgs;
}
 
Example #24
Source File: XtextLinkerTest.java    From xtext-core with Eclipse Public License 2.0 5 votes vote down vote up
@Test
public void testImplicitNamedParameterLinking_01() throws Exception {
  StringConcatenation _builder = new StringConcatenation();
  _builder.append("grammar test.Lang with org.eclipse.xtext.common.Terminals");
  _builder.newLine();
  _builder.append("generate test \'http://test\'");
  _builder.newLine();
  _builder.append("Root<MyParam>: rule=Rule<MyParam>;");
  _builder.newLine();
  _builder.append("Rule<MyParam>: name=ID child=Root<MyParam>?;");
  _builder.newLine();
  final String grammarAsString = _builder.toString();
  EObject _model = this.getModel(grammarAsString);
  final Grammar grammar = ((Grammar) _model);
  AbstractRule _head = IterableExtensions.<AbstractRule>head(grammar.getRules());
  final ParserRule rootRule = ((ParserRule) _head);
  AbstractRule _last = IterableExtensions.<AbstractRule>last(grammar.getRules());
  final ParserRule lastRule = ((ParserRule) _last);
  AbstractElement _alternatives = lastRule.getAlternatives();
  AbstractElement _last_1 = IterableExtensions.<AbstractElement>last(((Group) _alternatives).getElements());
  final Assignment lastAssignment = ((Assignment) _last_1);
  AbstractElement _terminal = lastAssignment.getTerminal();
  final RuleCall ruleCall = ((RuleCall) _terminal);
  final NamedArgument argument = IterableExtensions.<NamedArgument>head(ruleCall.getArguments());
  Assert.assertEquals(IterableExtensions.<Parameter>head(rootRule.getParameters()), argument.getParameter());
  Condition _value = argument.getValue();
  Assert.assertEquals(IterableExtensions.<Parameter>head(lastRule.getParameters()), ((ParameterReference) _value).getParameter());
}
 
Example #25
Source File: XtextLinkerTest.java    From xtext-core with Eclipse Public License 2.0 5 votes vote down vote up
@Test
public void testImplicitNamedParameterLinking_02() throws Exception {
  StringConcatenation _builder = new StringConcatenation();
  _builder.append("grammar test.Lang with org.eclipse.xtext.common.Terminals");
  _builder.newLine();
  _builder.append("generate test \'http://test\'");
  _builder.newLine();
  _builder.append("Root<MyParam>: rule=Rule<true>;");
  _builder.newLine();
  _builder.append("Rule<MyParam>: name=ID child=Root<false>?;");
  _builder.newLine();
  final String grammarAsString = _builder.toString();
  EObject _model = this.getModel(grammarAsString);
  final Grammar grammar = ((Grammar) _model);
  AbstractRule _head = IterableExtensions.<AbstractRule>head(grammar.getRules());
  final ParserRule rootRule = ((ParserRule) _head);
  AbstractRule _last = IterableExtensions.<AbstractRule>last(grammar.getRules());
  final ParserRule lastRule = ((ParserRule) _last);
  AbstractElement _alternatives = lastRule.getAlternatives();
  AbstractElement _last_1 = IterableExtensions.<AbstractElement>last(((Group) _alternatives).getElements());
  final Assignment lastAssignment = ((Assignment) _last_1);
  AbstractElement _terminal = lastAssignment.getTerminal();
  final RuleCall ruleCall = ((RuleCall) _terminal);
  final NamedArgument argument = IterableExtensions.<NamedArgument>head(ruleCall.getArguments());
  Assert.assertEquals(IterableExtensions.<Parameter>head(rootRule.getParameters()), argument.getParameter());
  Condition _value = argument.getValue();
  Assert.assertFalse(((LiteralCondition) _value).isTrue());
}
 
Example #26
Source File: CustomN4JSParser.java    From n4js with Eclipse Public License 1.0 5 votes vote down vote up
private Set<Parameter> getParamConfig(List<RuleCall> callStack) {
	Set<Parameter> assignedParams = new HashSet<>();
	for (int i = callStack.size() - 1; i >= 0; i--) {
		RuleCall rc = callStack.get(i);
		ConditionEvaluator evaluator = new ConditionEvaluator(assignedParams);
		assignedParams = new HashSet<>();
		for (NamedArgument arg : rc.getArguments()) {
			Condition value = arg.getValue();
			if (evaluator.evaluate(value)) {
				assignedParams.add(arg.getParameter());
			}
		}
	}
	return assignedParams;
}
 
Example #27
Source File: XtextLinkerTest.java    From xtext-core with Eclipse Public License 2.0 4 votes vote down vote up
@Test
public void testNamedParameterAdjustment() throws Exception {
  StringConcatenation _builder = new StringConcatenation();
  _builder.append("grammar test.Lang with org.eclipse.xtext.common.Terminals");
  _builder.newLine();
  _builder.append("generate test \'http://test\'");
  _builder.newLine();
  _builder.append("Root<MyParam>: rule=Rule<true>;");
  _builder.newLine();
  _builder.append("Rule<MyParam>: name=ID child=Root<false>?;");
  _builder.newLine();
  final String grammarAsString = _builder.toString();
  EObject _model = this.getModel(grammarAsString);
  final Grammar grammar = ((Grammar) _model);
  final ResourceSet resourceSet = grammar.eResource().getResourceSet();
  final Resource otherResource = resourceSet.createResource(URI.createURI("other.xtext"));
  StringConcatenation _builder_1 = new StringConcatenation();
  _builder_1.append("grammar test.SubLang with test.Lang");
  _builder_1.newLine();
  _builder_1.append("import \'http://test\'");
  _builder_1.newLine();
  _builder_1.append("Root<MyParam>: rule=super::Rule<true>;");
  _builder_1.newLine();
  LazyStringInputStream _lazyStringInputStream = new LazyStringInputStream(_builder_1.toString());
  otherResource.load(_lazyStringInputStream, null);
  EObject _head = IterableExtensions.<EObject>head(otherResource.getContents());
  final Grammar subGrammar = ((Grammar) _head);
  AbstractRule _head_1 = IterableExtensions.<AbstractRule>head(subGrammar.getRules());
  final ParserRule rootRule = ((ParserRule) _head_1);
  AbstractRule _last = IterableExtensions.<AbstractRule>last(grammar.getRules());
  final ParserRule parentRule = ((ParserRule) _last);
  AbstractElement _alternatives = parentRule.getAlternatives();
  AbstractElement _last_1 = IterableExtensions.<AbstractElement>last(((Group) _alternatives).getElements());
  final Assignment lastAssignment = ((Assignment) _last_1);
  AbstractElement _terminal = lastAssignment.getTerminal();
  final RuleCall ruleCall = ((RuleCall) _terminal);
  final NamedArgument argument = IterableExtensions.<NamedArgument>head(ruleCall.getArguments());
  Assert.assertEquals(IterableExtensions.<Parameter>head(rootRule.getParameters()), argument.getParameter());
  Condition _value = argument.getValue();
  Assert.assertFalse(((LiteralCondition) _value).isTrue());
}
 
Example #28
Source File: ConditionEvaluator.java    From xtext-core with Eclipse Public License 2.0 4 votes vote down vote up
public boolean evaluate(Condition condition) {
	return doSwitch(condition);
}
 
Example #29
Source File: AntlrGrammarGenUtil.java    From xtext-extras with Eclipse Public License 2.0 4 votes vote down vote up
/**
 * @since 2.9
 */
public static String conditionToAntlr(Condition condition, final boolean includeRuleName) {
	return org.eclipse.xtext.xtext.generator.parser.antlr.AntlrGrammarGenUtil.conditionToAntlr(condition, includeRuleName);
}
 
Example #30
Source File: NamedArgumentImpl.java    From xtext-core with Eclipse Public License 2.0 2 votes vote down vote up
/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public Condition getValue() {
	return value;
}