use of org.eclipse.xtext.parser.fragments.fragmentTestLanguage.PRFNamedWithAction in project xtext-core by eclipse.
the class AbstractFragmentTestLanguageExSemanticSequencer method sequence.
@Override
public void sequence(ISerializationContext context, EObject semanticObject) {
EPackage epackage = semanticObject.eClass().getEPackage();
ParserRule rule = context.getParserRule();
Action action = context.getAssignedAction();
Set<Parameter> parameters = context.getEnabledBooleanParameters();
if (epackage == FragmentTestLanguagePackage.eINSTANCE)
switch(semanticObject.eClass().getClassifierID()) {
case FragmentTestLanguagePackage.PRF_NAMED:
if (rule == grammarAccess.getNamedByActionRule()) {
sequence_NamedByAction(context, (PRFNamed) semanticObject);
return;
} else if (rule == grammarAccess.getNamedInParenthesesRule()) {
sequence_NamedInParentheses(context, (PRFNamed) semanticObject);
return;
} else if (rule == grammarAccess.getPRFNamedRefFirstRule()) {
sequence_PRFNamedFragment_PRFNamedRefFirst(context, (PRFNamed) semanticObject);
return;
} else if (rule == grammarAccess.getPRFWithPredicateRule()) {
sequence_PRFNamedFragment_PRFNamedRef(context, (PRFNamed) semanticObject);
return;
} else if (rule == grammarAccess.getPRFNamedWithFQNRule()) {
sequence_PRFNamedWithFQN(context, (PRFNamed) semanticObject);
return;
} else if (rule == grammarAccess.getPRFNamedRule() || action == grammarAccess.getPRFNamedWithActionAccess().getPRFNamedWithActionPrevAction_1()) {
sequence_PRFNamed_PRFNamedFragment_PRFNamedRef(context, (PRFNamed) semanticObject);
return;
} else
break;
case FragmentTestLanguagePackage.PRF_NAMED_WITH_ACTION:
if (rule == grammarAccess.getPRFNamedRecursiveFragmentRule()) {
sequence_PRFNamedRecursiveFragment_RecursiveFragment(context, (PRFNamedWithAction) semanticObject);
return;
} else if (rule == grammarAccess.getPRFNamedRecursiveRule()) {
sequence_PRFNamedRecursive_RecursiveFromFragment(context, (PRFNamedWithAction) semanticObject);
return;
} else if (rule == grammarAccess.getPRFNamedWithActionRule()) {
sequence_PRFNamedWithAction(context, (PRFNamedWithAction) semanticObject);
return;
} else
break;
case FragmentTestLanguagePackage.PARSER_RULE_FRAGMENTS:
sequence_ParserRuleFragments(context, (ParserRuleFragments) semanticObject);
return;
}
if (errorAcceptor != null)
errorAcceptor.accept(diagnosticProvider.createInvalidContextOrTypeDiagnostic(semanticObject, context));
}
use of org.eclipse.xtext.parser.fragments.fragmentTestLanguage.PRFNamedWithAction in project xtext-core by eclipse.
the class AbstractFragmentTestLanguageSemanticSequencer method sequence.
@Override
public void sequence(ISerializationContext context, EObject semanticObject) {
EPackage epackage = semanticObject.eClass().getEPackage();
ParserRule rule = context.getParserRule();
Action action = context.getAssignedAction();
Set<Parameter> parameters = context.getEnabledBooleanParameters();
if (epackage == FragmentTestLanguagePackage.eINSTANCE)
switch(semanticObject.eClass().getClassifierID()) {
case FragmentTestLanguagePackage.PRF_NAMED:
if (rule == grammarAccess.getNamedByActionRule()) {
sequence_NamedByAction(context, (PRFNamed) semanticObject);
return;
} else if (rule == grammarAccess.getNamedInParenthesesRule()) {
sequence_NamedInParentheses(context, (PRFNamed) semanticObject);
return;
} else if (rule == grammarAccess.getPRFNamedRefFirstRule()) {
sequence_PRFNamedFragment_PRFNamedRefFirst(context, (PRFNamed) semanticObject);
return;
} else if (rule == grammarAccess.getPRFWithPredicateRule()) {
sequence_PRFNamedFragment_PRFNamedRef(context, (PRFNamed) semanticObject);
return;
} else if (rule == grammarAccess.getPRFNamedWithFQNRule()) {
sequence_PRFNamedWithFQN(context, (PRFNamed) semanticObject);
return;
} else if (rule == grammarAccess.getPRFNamedRule() || action == grammarAccess.getPRFNamedWithActionAccess().getPRFNamedWithActionPrevAction_1()) {
sequence_PRFNamed_PRFNamedFragment_PRFNamedRef(context, (PRFNamed) semanticObject);
return;
} else
break;
case FragmentTestLanguagePackage.PRF_NAMED_WITH_ACTION:
if (rule == grammarAccess.getPRFNamedRecursiveFragmentRule()) {
sequence_PRFNamedRecursiveFragment_RecursiveFragment(context, (PRFNamedWithAction) semanticObject);
return;
} else if (rule == grammarAccess.getPRFNamedRecursiveRule()) {
sequence_PRFNamedRecursive_RecursiveFromFragment(context, (PRFNamedWithAction) semanticObject);
return;
} else if (rule == grammarAccess.getPRFNamedWithActionRule()) {
sequence_PRFNamedWithAction(context, (PRFNamedWithAction) semanticObject);
return;
} else
break;
case FragmentTestLanguagePackage.PARSER_RULE_FRAGMENTS:
sequence_ParserRuleFragments(context, (ParserRuleFragments) semanticObject);
return;
}
if (errorAcceptor != null)
errorAcceptor.accept(diagnosticProvider.createInvalidContextOrTypeDiagnostic(semanticObject, context));
}
use of org.eclipse.xtext.parser.fragments.fragmentTestLanguage.PRFNamedWithAction in project xtext-core by eclipse.
the class AbstractFragmentsTest method testActionInFragmentAndReference_02.
@Test
@Ignore("Actions are currently not supported in fragments")
public void testActionInFragmentAndReference_02() {
final ParserRuleFragments fragments = this.parseAndValidate("#6 prev current current - prev");
Assert.assertNotNull(fragments);
final PRFNamed element = fragments.getElement();
Assert.assertEquals("current", element.getName());
final PRFNamed prev = ((PRFNamedWithAction) element).getPrev();
Assert.assertEquals("prev", prev.getName());
Assert.assertEquals(prev, element.getRef());
Assert.assertEquals(element, ((PRFNamedWithAction) element).getRef2());
}
use of org.eclipse.xtext.parser.fragments.fragmentTestLanguage.PRFNamedWithAction in project xtext-core by eclipse.
the class AbstractFragmentsTest method testFragmentRecursive_04.
@Test
public void testFragmentRecursive_04() {
final ParserRuleFragments fragments = this.parseAndValidate("#11 myName ((myPrev))");
Assert.assertNotNull(fragments);
Assert.assertEquals("myName", fragments.getElement().getName());
PRFNamed _element = fragments.getElement();
final PRFNamed prev = ((PRFNamedWithAction) _element).getPrev();
Assert.assertEquals("myPrev", prev.getName());
final ICompositeNode node = NodeModelUtils.findActualNodeFor(prev);
Assert.assertEquals("myPrev", node.getText());
final EObject lookup = NodeModelUtils.findActualSemanticObjectFor(node);
Assert.assertSame(prev, lookup);
}
use of org.eclipse.xtext.parser.fragments.fragmentTestLanguage.PRFNamedWithAction in project xtext-core by eclipse.
the class AbstractFragmentsTest method testActionInFragmentAndReferenceLoop.
@Test
@Ignore("Actions are currently not supported in fragments")
public void testActionInFragmentAndReferenceLoop() {
final ParserRuleFragments fragments = this.parseAndValidate("#7 root -> a a -> b b -> c c - root");
Assert.assertNotNull(fragments);
PRFNamed element = fragments.getElement();
while ((element instanceof PRFNamedWithAction)) {
{
Assert.assertEquals(element, ((PRFNamedWithAction) element).getRef2());
element = ((PRFNamedWithAction) element).getPrev();
}
}
Assert.assertEquals(element, element.getRef());
}
Aggregations