use of org.eclipse.xtext.UnorderedGroup in project xtext-core by eclipse.
the class GrammarParserTest method testPrecedencies_05.
@Test
public void testPrecedencies_05() throws Exception {
UnorderedGroup group = (UnorderedGroup) getModel("name=ID & 'keyword'");
assertNotNull(group);
assertEquals(2, group.getElements().size());
assertTrue(group.getElements().get(0) instanceof Assignment);
assertTrue(group.getElements().get(1) instanceof Keyword);
}
use of org.eclipse.xtext.UnorderedGroup in project xtext-core by eclipse.
the class GrammarParserTest method testUnorderedGroup_02.
@Test
public void testUnorderedGroup_02() throws Exception {
UnorderedGroup group = (UnorderedGroup) getModel("'keyword' & 'keyword' & 'keyword'");
assertNotNull(group);
assertEquals(3, group.getElements().size());
}
use of org.eclipse.xtext.UnorderedGroup in project xtext-core by eclipse.
the class GrammarParserTest method testPrecedencies_04.
@Test
public void testPrecedencies_04() throws Exception {
Group group = (Group) getModel("'keyword' ('keyword' & 'keyword') 'keyword'");
assertNotNull(group);
assertEquals(3, group.getElements().size());
assertTrue(group.getElements().get(0) instanceof Keyword);
assertTrue(group.getElements().get(1) instanceof UnorderedGroup);
assertTrue(group.getElements().get(2) instanceof Keyword);
}
use of org.eclipse.xtext.UnorderedGroup in project xtext-core by eclipse.
the class XtextValidationTest method testCheckRuleCallInUnorderedGroup_03.
@Test
public void testCheckRuleCallInUnorderedGroup_03() throws Exception {
XtextValidator validator = get(XtextValidator.class);
UnorderedGroup unorderedGroup = XtextFactory.eINSTANCE.createUnorderedGroup();
RuleCall ruleCall = XtextFactory.eINSTANCE.createRuleCall();
EnumRule enumRule = XtextFactory.eINSTANCE.createEnumRule();
ruleCall.setRule(enumRule);
unorderedGroup.getElements().add(ruleCall);
ValidatingMessageAcceptor messageAcceptor = new ValidatingMessageAcceptor(null, false, false);
validator.setMessageAcceptor(messageAcceptor);
validator.checkRuleCallInUnorderedGroup(ruleCall);
messageAcceptor.validate();
}
use of org.eclipse.xtext.UnorderedGroup in project xtext-core by eclipse.
the class XtextValidationTest method testCheckRuleCallInUnorderedGroup_05.
@Test
public void testCheckRuleCallInUnorderedGroup_05() throws Exception {
XtextValidator validator = get(XtextValidator.class);
UnorderedGroup unorderedGroup = XtextFactory.eINSTANCE.createUnorderedGroup();
RuleCall ruleCall = XtextFactory.eINSTANCE.createRuleCall();
TypeRef typeRef = XtextFactory.eINSTANCE.createTypeRef();
typeRef.setClassifier(EcorePackage.Literals.EOBJECT);
ParserRule parserRule = XtextFactory.eINSTANCE.createParserRule();
parserRule.setType(typeRef);
ruleCall.setRule(parserRule);
Assignment assignment = XtextFactory.eINSTANCE.createAssignment();
assignment.setTerminal(ruleCall);
unorderedGroup.getElements().add(assignment);
ValidatingMessageAcceptor messageAcceptor = new ValidatingMessageAcceptor(null, false, false);
validator.setMessageAcceptor(messageAcceptor);
validator.checkRuleCallInUnorderedGroup(ruleCall);
messageAcceptor.validate();
}
Aggregations