use of org.eclipse.xtext.xtextTest.AbstractRule in project xtext-core by eclipse.
the class RuleCallImpl method setRule.
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setRule(AbstractRule newRule) {
AbstractRule oldRule = rule;
rule = newRule;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, XtextTestPackage.RULE_CALL__RULE, oldRule, rule));
}
use of org.eclipse.xtext.xtextTest.AbstractRule in project xtext-core by eclipse.
the class ParseErrorHandlingTest method testParseError2.
@Test
public void testParseError2() throws Exception {
Grammar grammar = (Grammar) getModelAndExpect("grammar a import 'holla' foo returns y::Z : name=foo #;", 4);
AbstractRule rule = grammar.getRules().get(0);
Assignment assignment = (Assignment) rule.getAlternatives();
RuleCall call = (RuleCall) assignment.getTerminal();
assertSame(rule, call.getRule());
// assertWithXtend("'foo'", "rules.first().eAllContents().typeSelect(RuleCall).first().rule.name", grammar);
}
use of org.eclipse.xtext.xtextTest.AbstractRule in project xtext-core by eclipse.
the class ParseErrorHandlingTest method testParseError3.
@Test
public void testParseError3() throws Exception {
Grammar grammar = (Grammar) getModelAndExpect("grammar a import 'holla' foo returns y::Z : name=foo #############", 4);
AbstractRule rule = grammar.getRules().get(0);
Assignment assignment = (Assignment) rule.getAlternatives();
RuleCall call = (RuleCall) assignment.getTerminal();
assertSame(rule, call.getRule());
// assertWithXtend("'foo'", "rules.first().eAllContents().typeSelect(RuleCall).first().rule.name", grammar);
}
use of org.eclipse.xtext.xtextTest.AbstractRule in project xtext-core by eclipse.
the class ParseErrorHandlingTest method testParseError4.
@Test
public void testParseError4() throws Exception {
Grammar grammar = (Grammar) getModelAndExpect("grammar a import 'holla' foo returns y::Z : name=foo # 'foo'; bar : 'stuff'", 5);
AbstractRule rule = grammar.getRules().get(0);
Assignment assignment = (Assignment) rule.getAlternatives();
RuleCall call = (RuleCall) assignment.getTerminal();
assertSame(rule, call.getRule());
// assertWithXtend("'foo'", "rules.first().eAllContents().typeSelect(RuleCall).first().rule.name", grammar);
AbstractRule secondRule = grammar.getRules().get(1);
Keyword stuff = (Keyword) secondRule.getAlternatives();
assertEquals("stuff", stuff.getValue());
// assertWithXtend("'stuff'", "rules.get(1).eAllContents().typeSelect(Keyword).first().value", grammar);
}
Aggregations