Search in sources :

Example 51 with AbstractRule

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

the class TreeConstTest method testAssignedAction3.

@Test
public void testAssignedAction3() throws Exception {
    AbstractRule rule = parseRule("Model: 'a' {Type1.sub=current} | 'b' {Type2.sub=current};");
    assertTypes(nfa.getNFA(rule.getAlternatives()).getTypes(), "Type1", "Type2");
}
Also used : AbstractRule(org.eclipse.xtext.AbstractRule) Test(org.junit.Test)

Example 52 with AbstractRule

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

the class TreeConstTest method testRuleCall2.

@Test
public void testRuleCall2() throws Exception {
    AbstractRule rule = parseRule("Model: Foo | 'bar'; Foo: name=ID;");
    assertTypes(nfa.getNFA(rule.getAlternatives()).getTypes(), "Foo", "null");
}
Also used : AbstractRule(org.eclipse.xtext.AbstractRule) Test(org.junit.Test)

Example 53 with AbstractRule

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

the class TreeConstTest method testRuleCall3.

@Test
public void testRuleCall3() throws Exception {
    AbstractRule rule = parseRule("Model: Foo | 'bar' name=ID | 'null'; Foo: name=ID;");
    assertTypes(nfa.getNFA(rule.getAlternatives()).getTypes(), "Foo", "Model", "null");
}
Also used : AbstractRule(org.eclipse.xtext.AbstractRule) Test(org.junit.Test)

Example 54 with AbstractRule

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

the class TreeConstTest method testSingleAssignmentOrNull.

@Test
public void testSingleAssignmentOrNull() throws Exception {
    AbstractRule rule = parseRule("Model: 'foo' name=ID?;");
    Group group = (Group) rule.getAlternatives();
    assertTypes(nfa.getNFA(group).getTypes(), "Model", "null");
    assertTypes(nfa.getNFA(group.getElements().get(0)).getTypesToCheck());
}
Also used : Group(org.eclipse.xtext.Group) AbstractRule(org.eclipse.xtext.AbstractRule) Test(org.junit.Test)

Example 55 with AbstractRule

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

the class TreeConstTest method testRuleCall1.

@Test
public void testRuleCall1() throws Exception {
    AbstractRule rule = parseRule("Model: Foo; Foo: name=ID;");
    assertTypes(nfa.getNFA(rule.getAlternatives()).getTypes(), "Foo");
}
Also used : AbstractRule(org.eclipse.xtext.AbstractRule) Test(org.junit.Test)

Aggregations

AbstractRule (org.eclipse.xtext.AbstractRule)222 Test (org.junit.Test)128 Grammar (org.eclipse.xtext.Grammar)106 StringConcatenation (org.eclipse.xtend2.lib.StringConcatenation)96 ParserRule (org.eclipse.xtext.ParserRule)94 EObject (org.eclipse.emf.ecore.EObject)59 AbstractXtextRuleInspectorTest (org.eclipse.xtext.xtext.AbstractXtextRuleInspectorTest)49 RuleCall (org.eclipse.xtext.RuleCall)36 AbstractElement (org.eclipse.xtext.AbstractElement)34 TerminalRule (org.eclipse.xtext.TerminalRule)20 XtextResource (org.eclipse.xtext.resource.XtextResource)17 EClassifier (org.eclipse.emf.ecore.EClassifier)14 EnumRule (org.eclipse.xtext.EnumRule)14 ArrayList (java.util.ArrayList)12 Assignment (org.eclipse.xtext.Assignment)12 Group (org.eclipse.xtext.Group)12 InternalEObject (org.eclipse.emf.ecore.InternalEObject)11 IEObjectDescription (org.eclipse.xtext.resource.IEObjectDescription)11 EClass (org.eclipse.emf.ecore.EClass)10 StringConcatenationClient (org.eclipse.xtend2.lib.StringConcatenationClient)10