use of org.eclipse.xtext.Alternatives in project xtext-core by eclipse.
the class GrammarParserTest method testPrecedencies_02.
@Test
public void testPrecedencies_02() throws Exception {
UnorderedGroup group = (UnorderedGroup) getModel("('keyword' | 'keyword') & ('keyword' | 'keyword')");
assertNotNull(group);
assertEquals(2, group.getElements().size());
assertTrue(group.getElements().get(0) instanceof Alternatives);
assertTrue(group.getElements().get(1) instanceof Alternatives);
}
use of org.eclipse.xtext.Alternatives in project xtext-core by eclipse.
the class GrammarParserTest method testAlternatives.
@Test
public void testAlternatives() throws Exception {
Alternatives alternatives = (Alternatives) getModel("'keyword'|'keyword'");
assertNotNull(alternatives);
assertEquals(2, alternatives.getElements().size());
}
use of org.eclipse.xtext.Alternatives in project xtext-core by eclipse.
the class TreeConstTest method testMultiAction4.
@Test
public void testMultiAction4() throws Exception {
AbstractRule rule = parseRule("Model: 'a' {Type1} | 'b' {Type2} | 'c' | name=ID;");
Alternatives alt = (Alternatives) rule.getAlternatives();
assertTypes(nfa.getNFA(alt).getTypes(), "Type1", "Type2", "Model", "null");
assertTypes(nfa.getNFA(alt.getElements().get(0)).getTypesToCheck(), "Type1");
assertTypes(nfa.getNFA(alt.getElements().get(1)).getTypesToCheck(), "Type2");
assertTypes(nfa.getNFA(alt.getElements().get(2)).getTypesToCheck());
assertTypes(nfa.getNFA(alt.getElements().get(3)).getTypesToCheck(), "Model");
}
Aggregations