use of org.eclipse.xtext.AbstractRule in project xtext-core by eclipse.
the class TreeConstTest method testRuleCall4.
@Test
public void testRuleCall4() throws Exception {
AbstractRule rule = parseRule("Model: Foo | Bar; Foo: name=ID; Bar: val=INT;");
assertTypes(nfa.getNFA(rule.getAlternatives()).getTypes(), "Foo", "Bar");
}
use of org.eclipse.xtext.AbstractRule in project xtext-core by eclipse.
the class TreeConstTest method testMultiAction3.
@Test
public void testMultiAction3() throws Exception {
AbstractRule rule = parseRule("Model: 'a' {Type1} | 'b' {Type2} | 'c' name=ID;");
assertTypes(nfa.getNFA(rule.getAlternatives()).getTypes(), "Type1", "Type2", "Model");
}
use of org.eclipse.xtext.AbstractRule in project xtext-core by eclipse.
the class TreeConstTest method testRuleCall5.
@Test
public void testRuleCall5() throws Exception {
AbstractRule rule = parseRule("Model: (Foo | Bar) v2=ID v1=ID; Foo: name=ID; Bar: val=INT;");
assertTypes(nfa.getNFA(rule.getAlternatives()).getTypes(), "Foo", "Bar");
}
use of org.eclipse.xtext.AbstractRule in project xtext-core by eclipse.
the class XtextValidationTest method testBug_282852_06.
@Test
public void testBug_282852_06() throws Exception {
Grammar base = XtextFactory.eINSTANCE.createGrammar();
AbstractRule ruleFoo = XtextFactory.eINSTANCE.createParserRule();
ruleFoo.setName("Foo");
base.getRules().add(ruleFoo);
AbstractRule subRuleFoo = XtextFactory.eINSTANCE.createParserRule();
subRuleFoo.setName("Foo");
base.getRules().add(subRuleFoo);
XtextValidator validator = get(XtextValidator.class);
configureValidator(validator, this, subRuleFoo);
validator.checkRuleName(subRuleFoo);
assertEquals("A rule's name has to be unique.", lastMessage);
}
use of org.eclipse.xtext.AbstractRule in project xtext-core by eclipse.
the class XtextValidationTest method testBug_282852_05.
@Test
public void testBug_282852_05() throws Exception {
Grammar base = XtextFactory.eINSTANCE.createGrammar();
AbstractRule ruleFoo = XtextFactory.eINSTANCE.createParserRule();
ruleFoo.setName("Foo");
base.getRules().add(ruleFoo);
AbstractRule subRuleFoo = XtextFactory.eINSTANCE.createParserRule();
subRuleFoo.setName("foo");
base.getRules().add(subRuleFoo);
XtextValidator validator = get(XtextValidator.class);
configureValidator(validator, this, subRuleFoo);
validator.checkRuleName(subRuleFoo);
assertEquals("A rule's name has to be unique even case insensitive. This grammar contains another rule 'Foo'.", lastMessage);
}
Aggregations