Search in sources :

Example 51 with TerminalRule

use of org.eclipse.xtext.TerminalRule in project xtext-core by eclipse.

the class XtextSerializerTest method testFQNInSuper_02.

@Ignore("Serialization does not have the correct context information")
@Test
public void testFQNInSuper_02() {
    Grammar grammar = load(URI.createURI("classpath:/org/eclipse/xtext/grammarinheritance/InheritanceTestLanguage.xtext"));
    AbstractRule rule = GrammarUtil.findRuleForName(grammar, "FQN");
    Assert.assertNotNull(rule);
    Group group = (Group) rule.getAlternatives();
    RuleCall ruleCall = (RuleCall) group.getElements().get(0);
    TerminalRule id = (TerminalRule) ruleCall.getRule();
    Assert.assertSame(grammar, GrammarUtil.getGrammar(id));
    String string = get(ISerializer.class).serialize(rule.getAlternatives());
    Assert.assertEquals("ID (\".\" ID)*", string);
    // currently wrong result is
    Assert.assertEquals("super::ID (\".\" super::ID)*", string);
}
Also used : Group(org.eclipse.xtext.Group) Grammar(org.eclipse.xtext.Grammar) TerminalRule(org.eclipse.xtext.TerminalRule) AbstractRule(org.eclipse.xtext.AbstractRule) RuleCall(org.eclipse.xtext.RuleCall) Ignore(org.junit.Ignore) Test(org.junit.Test)

Aggregations

TerminalRule (org.eclipse.xtext.TerminalRule)51 ParserRule (org.eclipse.xtext.ParserRule)21 AbstractRule (org.eclipse.xtext.AbstractRule)20 RuleCall (org.eclipse.xtext.RuleCall)19 EnumRule (org.eclipse.xtext.EnumRule)17 Grammar (org.eclipse.xtext.Grammar)17 Test (org.junit.Test)16 StringConcatenation (org.eclipse.xtend2.lib.StringConcatenation)12 AbstractElement (org.eclipse.xtext.AbstractElement)10 EObject (org.eclipse.emf.ecore.EObject)6 Action (org.eclipse.xtext.Action)6 StringConcatenationClient (org.eclipse.xtend2.lib.StringConcatenationClient)5 Assignment (org.eclipse.xtext.Assignment)5 Function1 (org.eclipse.xtext.xbase.lib.Functions.Function1)5 ArrayList (java.util.ArrayList)4 List (java.util.List)4 EClass (org.eclipse.emf.ecore.EClass)4 Alternatives (org.eclipse.xtext.Alternatives)4 Group (org.eclipse.xtext.Group)4 Keyword (org.eclipse.xtext.Keyword)4