use of org.eclipse.xtext.serializer.analysis.ISyntacticSequencerPDAProvider.ISynTransition in project xtext-core by eclipse.
the class SyntacticSequencerPDAProviderNavigatorTest method testSimple.
@Test
public void testSimple() throws Exception {
ISynAbsorberState start = getParserRule("Rule: a1=ID 'kw1' a2=ID;");
ISynTransition trans = findTransition(start, "a1=ID", "a2=ID");
assertFalse(trans.involvesUnassignedTokenRuleCalls());
assertFalse(trans.isSyntacticallyAmbiguous());
// assertEquals(1, trans.getDistanceWithStackToAbsorber(newStack()));
assertEquals("['kw1']", trans.getShortestPathToAbsorber(newStack()).toString());
}
use of org.eclipse.xtext.serializer.analysis.ISyntacticSequencerPDAProvider.ISynTransition in project xtext-core by eclipse.
the class SyntacticSequencerPDAProviderNavigatorTest method testAmbiguousAlternative.
@Test
public void testAmbiguousAlternative() throws Exception {
ISynAbsorberState start = getParserRule("Rule: a1=ID ('kw1' 'kw2' | 'kw3') a2=ID;");
ISynTransition trans = findTransition(start, "a1=ID", "a2=ID");
assertFalse(trans.involvesUnassignedTokenRuleCalls());
assertTrue(trans.isSyntacticallyAmbiguous());
// assertEquals(1, trans.getDistanceWithStackToAbsorber(newStack()));
assertEquals("['kw3']", trans.getShortestPathToAbsorber(newStack()).toString());
}
use of org.eclipse.xtext.serializer.analysis.ISyntacticSequencerPDAProvider.ISynTransition in project xtext-core by eclipse.
the class SyntacticSequencerPDAProviderNavigatorTest method testTerminal.
@Test
public void testTerminal() throws Exception {
ISynAbsorberState start = getParserRule("Rule: a1=ID FOO a2=ID; terminal FOO: '$';");
ISynTransition trans = findTransition(start, "a1=ID", "a2=ID");
assertTrue(trans.involvesUnassignedTokenRuleCalls());
assertFalse(trans.isSyntacticallyAmbiguous());
// assertEquals(1, trans.getDistanceWithStackToAbsorber(newStack()));
assertEquals("[FOO]", trans.getShortestPathToAbsorber(newStack()).toString());
}
use of org.eclipse.xtext.serializer.analysis.ISyntacticSequencerPDAProvider.ISynTransition in project xtext-core by eclipse.
the class SyntacticSequencerPDAProviderNavigatorTest method testDatatype.
@Test
public void testDatatype() throws Exception {
ISynAbsorberState start = getParserRule("Rule: a1=ID Foo a2=ID; Foo: ID;");
ISynTransition trans = findTransition(start, "a1=ID", "a2=ID");
assertTrue(trans.involvesUnassignedTokenRuleCalls());
assertFalse(trans.isSyntacticallyAmbiguous());
// assertEquals(1, trans.getDistanceWithStackToAbsorber(newStack()));
assertEquals("[Foo]", trans.getShortestPathToAbsorber(newStack()).toString());
}
use of org.eclipse.xtext.serializer.analysis.ISyntacticSequencerPDAProvider.ISynTransition in project xtext-core by eclipse.
the class SyntacticSequencerPDAProviderNavigatorTest method testAmbiguousOptional.
@Test
public void testAmbiguousOptional() throws Exception {
ISynAbsorberState start = getParserRule("Rule: a1=ID 'kw1' 'kw2'? a2=ID;");
ISynTransition trans = findTransition(start, "a1=ID", "a2=ID");
assertFalse(trans.involvesUnassignedTokenRuleCalls());
assertTrue(trans.isSyntacticallyAmbiguous());
// assertEquals(1, trans.getDistanceWithStackToAbsorber(newStack()));
assertEquals("['kw1']", trans.getShortestPathToAbsorber(newStack()).toString());
}
Aggregations