mirror of
https://github.com/sigmasternchen/xtext-core
synced 2025-03-16 00:38:56 +00:00
added hosting test for unordered groups
This commit is contained in:
parent
ef91f872ef
commit
5110d180b7
1 changed files with 18 additions and 0 deletions
|
@ -272,6 +272,24 @@ public class HoistingProcessorTest extends AbstractXtextTests {
|
|||
assertEquals("((" + getSyntaxForKeywordToken("s", 1) + " || (p1)) && (" + getSyntaxForKeywordToken("a", 1) + " || (p0)))", guard.render());
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void testUnorderedGroups() throws Exception {
|
||||
// @formatter:off
|
||||
String model =
|
||||
MODEL_PREAMBLE +
|
||||
"S: (($$ p0 $$?=> 'a') & ($$ p1 $$?=> 'b')) $$ p2 $$?=> 's';";
|
||||
// @formatter:off
|
||||
XtextResource resource = getResourceFromString(model);
|
||||
Grammar grammar = ((Grammar) resource.getContents().get(0));
|
||||
AbstractRule rule = getRule(grammar, "S");
|
||||
|
||||
HoistingGuard guard = hoistingProcessor.findGuardForElement(rule.getAlternatives());
|
||||
assertFalse(guard.isTrivial());
|
||||
assertTrue(guard.hasTerminal());
|
||||
assertEquals("((" + getSyntaxForKeywordToken("a", 1) + " || (p0)) && (" + getSyntaxForKeywordToken("b", 1) + " || (p1)) && (" + getSyntaxForKeywordToken("c", 1) + " || (p2)))", guard.render());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testAlternativeNoToken() throws Exception {
|
||||
// @formatter:off
|
||||
|
|
Loading…
Reference in a new issue