Search in sources :

Example 26 with ParserRule

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

the class EpatchTestLanguageSemanticSequencer 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 == EpatchTestLanguagePackage.eINSTANCE)
        switch(semanticObject.eClass().getClassifierID()) {
            case EpatchTestLanguagePackage.ASSIGNMENT_VALUE:
                if (rule == grammarAccess.getAssignmentValueRule()) {
                    sequence_AssignmentValue(context, (AssignmentValue) semanticObject);
                    return;
                } else if (rule == grammarAccess.getListAssignmentValueRule()) {
                    sequence_ListAssignmentValue(context, (AssignmentValue) semanticObject);
                    return;
                } else if (rule == grammarAccess.getSingleAssignmentValueRule()) {
                    sequence_SingleAssignmentValue(context, (AssignmentValue) semanticObject);
                    return;
                } else
                    break;
            case EpatchTestLanguagePackage.EPACKAGE_IMPORT:
                sequence_EPackageImport(context, (EPackageImport) semanticObject);
                return;
            case EpatchTestLanguagePackage.EPATCH:
                sequence_EPatch(context, (EPatch) semanticObject);
                return;
            case EpatchTestLanguagePackage.EXPRESSION_EXECUTABLE:
                sequence_ExpressionExecutable(context, (ExpressionExecutable) semanticObject);
                return;
            case EpatchTestLanguagePackage.EXTENSION_IMPORT:
                sequence_ExtensionImport(context, (ExtensionImport) semanticObject);
                return;
            case EpatchTestLanguagePackage.JAVA_EXECUTABLE:
                sequence_JavaExecutable(context, (JavaExecutable) semanticObject);
                return;
            case EpatchTestLanguagePackage.JAVA_IMPORT:
                sequence_JavaImport(context, (JavaImport) semanticObject);
                return;
            case EpatchTestLanguagePackage.LIST_ASSIGNMENT:
                if (rule == grammarAccess.getBiListAssignmentRule()) {
                    sequence_BiListAssignment(context, (ListAssignment) semanticObject);
                    return;
                } else if (rule == grammarAccess.getAssignmentRule()) {
                    sequence_BiListAssignment_MonoListAssignment(context, (ListAssignment) semanticObject);
                    return;
                } else if (rule == grammarAccess.getMonoListAssignmentRule()) {
                    sequence_MonoListAssignment(context, (ListAssignment) semanticObject);
                    return;
                } else
                    break;
            case EpatchTestLanguagePackage.MIGRATION:
                sequence_Migration(context, (Migration) semanticObject);
                return;
            case EpatchTestLanguagePackage.NAMED_RESOURCE:
                sequence_NamedResource(context, (NamedResource) semanticObject);
                return;
            case EpatchTestLanguagePackage.OBJECT_COPY:
                if (rule == grammarAccess.getNamedObjectRule() || rule == grammarAccess.getCreatedObjectRule()) {
                    sequence_CreatedObject_ObjectCopy(context, (ObjectCopy) semanticObject);
                    return;
                } else if (rule == grammarAccess.getObjectCopyRule()) {
                    sequence_ObjectCopy(context, (ObjectCopy) semanticObject);
                    return;
                } else
                    break;
            case EpatchTestLanguagePackage.OBJECT_NEW:
                if (rule == grammarAccess.getNamedObjectRule() || rule == grammarAccess.getCreatedObjectRule()) {
                    sequence_CreatedObject_ObjectNew(context, (ObjectNew) semanticObject);
                    return;
                } else if (rule == grammarAccess.getObjectNewRule()) {
                    sequence_ObjectNew(context, (ObjectNew) semanticObject);
                    return;
                } else
                    break;
            case EpatchTestLanguagePackage.OBJECT_REF:
                sequence_ObjectRef(context, (ObjectRef) semanticObject);
                return;
            case EpatchTestLanguagePackage.RESOURCE_IMPORT:
                sequence_ResourceImport(context, (ResourceImport) semanticObject);
                return;
            case EpatchTestLanguagePackage.SINGLE_ASSIGNMENT:
                if (rule == grammarAccess.getAssignmentRule()) {
                    sequence_BiSingleAssignment_MonoSingleAssignment(context, (SingleAssignment) semanticObject);
                    return;
                } else if (rule == grammarAccess.getBiSingleAssignmentRule()) {
                    sequence_BiSingleAssignment(context, (SingleAssignment) semanticObject);
                    return;
                } else if (rule == grammarAccess.getMonoSingleAssignmentRule()) {
                    sequence_MonoSingleAssignment(context, (SingleAssignment) semanticObject);
                    return;
                } else
                    break;
        }
    if (errorAcceptor != null)
        errorAcceptor.accept(diagnosticProvider.createInvalidContextOrTypeDiagnostic(semanticObject, context));
}
Also used : ParserRule(org.eclipse.xtext.ParserRule) Action(org.eclipse.xtext.Action) AssignmentValue(org.eclipse.xtext.parser.epatch.epatchTestLanguage.AssignmentValue) SingleAssignment(org.eclipse.xtext.parser.epatch.epatchTestLanguage.SingleAssignment) Migration(org.eclipse.xtext.parser.epatch.epatchTestLanguage.Migration) EPackageImport(org.eclipse.xtext.parser.epatch.epatchTestLanguage.EPackageImport) ObjectNew(org.eclipse.xtext.parser.epatch.epatchTestLanguage.ObjectNew) ListAssignment(org.eclipse.xtext.parser.epatch.epatchTestLanguage.ListAssignment) JavaExecutable(org.eclipse.xtext.parser.epatch.epatchTestLanguage.JavaExecutable) EPackage(org.eclipse.emf.ecore.EPackage) EPatch(org.eclipse.xtext.parser.epatch.epatchTestLanguage.EPatch) ExpressionExecutable(org.eclipse.xtext.parser.epatch.epatchTestLanguage.ExpressionExecutable) JavaImport(org.eclipse.xtext.parser.epatch.epatchTestLanguage.JavaImport) NamedResource(org.eclipse.xtext.parser.epatch.epatchTestLanguage.NamedResource) ObjectCopy(org.eclipse.xtext.parser.epatch.epatchTestLanguage.ObjectCopy) Parameter(org.eclipse.xtext.Parameter) ObjectRef(org.eclipse.xtext.parser.epatch.epatchTestLanguage.ObjectRef) ExtensionImport(org.eclipse.xtext.parser.epatch.epatchTestLanguage.ExtensionImport) ResourceImport(org.eclipse.xtext.parser.epatch.epatchTestLanguage.ResourceImport)

Example 27 with ParserRule

use of org.eclipse.xtext.ParserRule 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));
}
Also used : ParserRule(org.eclipse.xtext.ParserRule) PRFNamedWithAction(org.eclipse.xtext.parser.fragments.fragmentTestLanguage.PRFNamedWithAction) Action(org.eclipse.xtext.Action) PRFNamedWithAction(org.eclipse.xtext.parser.fragments.fragmentTestLanguage.PRFNamedWithAction) ParserRuleFragments(org.eclipse.xtext.parser.fragments.fragmentTestLanguage.ParserRuleFragments) Parameter(org.eclipse.xtext.Parameter) PRFNamed(org.eclipse.xtext.parser.fragments.fragmentTestLanguage.PRFNamed) EPackage(org.eclipse.emf.ecore.EPackage)

Example 28 with ParserRule

use of org.eclipse.xtext.ParserRule 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));
}
Also used : ParserRule(org.eclipse.xtext.ParserRule) PRFNamedWithAction(org.eclipse.xtext.parser.fragments.fragmentTestLanguage.PRFNamedWithAction) Action(org.eclipse.xtext.Action) PRFNamedWithAction(org.eclipse.xtext.parser.fragments.fragmentTestLanguage.PRFNamedWithAction) ParserRuleFragments(org.eclipse.xtext.parser.fragments.fragmentTestLanguage.ParserRuleFragments) Parameter(org.eclipse.xtext.Parameter) PRFNamed(org.eclipse.xtext.parser.fragments.fragmentTestLanguage.PRFNamed) EPackage(org.eclipse.emf.ecore.EPackage)

Example 29 with ParserRule

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

the class AbstractIndentationAwareTestLanguageSemanticSequencer 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 == IndentationAwareTestLanguagePackage.eINSTANCE)
        switch(semanticObject.eClass().getClassifierID()) {
            case IndentationAwareTestLanguagePackage.CHILD_LIST:
                sequence_ChildList(context, (ChildList) semanticObject);
                return;
            case IndentationAwareTestLanguagePackage.OTHER_TREE_NODE:
                sequence_OtherTreeNode(context, (OtherTreeNode) semanticObject);
                return;
            case IndentationAwareTestLanguagePackage.TREE:
                sequence_Tree(context, (Tree) semanticObject);
                return;
            case IndentationAwareTestLanguagePackage.TREE_NODE:
                sequence_TreeNode(context, (TreeNode) semanticObject);
                return;
        }
    if (errorAcceptor != null)
        errorAcceptor.accept(diagnosticProvider.createInvalidContextOrTypeDiagnostic(semanticObject, context));
}
Also used : OtherTreeNode(org.eclipse.xtext.parser.indentation.indentationAwareTestLanguage.OtherTreeNode) ParserRule(org.eclipse.xtext.ParserRule) Action(org.eclipse.xtext.Action) OtherTreeNode(org.eclipse.xtext.parser.indentation.indentationAwareTestLanguage.OtherTreeNode) TreeNode(org.eclipse.xtext.parser.indentation.indentationAwareTestLanguage.TreeNode) ChildList(org.eclipse.xtext.parser.indentation.indentationAwareTestLanguage.ChildList) Parameter(org.eclipse.xtext.Parameter) Tree(org.eclipse.xtext.parser.indentation.indentationAwareTestLanguage.Tree) EPackage(org.eclipse.emf.ecore.EPackage)

Example 30 with ParserRule

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

the class Bug292245TestLanguageSemanticSequencer 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 == Bug292245TestLanguagePackage.eINSTANCE)
        switch(semanticObject.eClass().getClassifierID()) {
            case Bug292245TestLanguagePackage.MODEL:
                sequence_Model(context, (Model) semanticObject);
                return;
        }
    if (errorAcceptor != null)
        errorAcceptor.accept(diagnosticProvider.createInvalidContextOrTypeDiagnostic(semanticObject, context));
}
Also used : ParserRule(org.eclipse.xtext.ParserRule) Action(org.eclipse.xtext.Action) Model(org.eclipse.xtext.parser.terminalrules.bug292245TestLanguage.Model) Parameter(org.eclipse.xtext.Parameter) EPackage(org.eclipse.emf.ecore.EPackage)

Aggregations

ParserRule (org.eclipse.xtext.ParserRule)380 Test (org.junit.Test)172 Grammar (org.eclipse.xtext.Grammar)151 Action (org.eclipse.xtext.Action)144 Parameter (org.eclipse.xtext.Parameter)137 EPackage (org.eclipse.emf.ecore.EPackage)126 AbstractRule (org.eclipse.xtext.AbstractRule)94 StringConcatenation (org.eclipse.xtend2.lib.StringConcatenation)74 AbstractXtextRuleInspectorTest (org.eclipse.xtext.xtext.AbstractXtextRuleInspectorTest)49 RuleCall (org.eclipse.xtext.RuleCall)41 EObject (org.eclipse.emf.ecore.EObject)27 EnumRule (org.eclipse.xtext.EnumRule)21 TerminalRule (org.eclipse.xtext.TerminalRule)21 AbstractElement (org.eclipse.xtext.AbstractElement)18 Assignment (org.eclipse.xtext.Assignment)15 UnorderedGroup (org.eclipse.xtext.UnorderedGroup)12 EClass (org.eclipse.emf.ecore.EClass)11 Group (org.eclipse.xtext.Group)11 NamedArgument (org.eclipse.xtext.NamedArgument)11 TypeRef (org.eclipse.xtext.TypeRef)11