Search in sources :

Example 56 with AbstractRule

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

the class TreeConstTest method testMultiAction1.

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

Example 57 with AbstractRule

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

the class TreeConstTest method testAssignedAction2.

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

Example 58 with AbstractRule

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

the class TreeConstTest method testAssignedRuleCall.

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

Example 59 with AbstractRule

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

the class TreeConstTest method testSingleAction1.

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

Example 60 with AbstractRule

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

the class TreeConstTest method testSingleAction2.

@Test
public void testSingleAction2() throws Exception {
    AbstractRule rule = parseRule("Model: 'someKeyword' {TypeRestriction};");
    assertTypes(nfa.getNFA(rule.getAlternatives()).getTypes(), "TypeRestriction");
}
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