Search in sources :

Example 76 with EPackage

use of org.eclipse.emf.ecore.EPackage 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 77 with EPackage

use of org.eclipse.emf.ecore.EPackage 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 78 with EPackage

use of org.eclipse.emf.ecore.EPackage 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 79 with EPackage

use of org.eclipse.emf.ecore.EPackage 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)

Example 80 with EPackage

use of org.eclipse.emf.ecore.EPackage in project xtext-core by eclipse.

the class TerminalRulesTestLanguageSemanticSequencer 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 == TerminalRulesTestLanguagePackage.eINSTANCE)
        switch(semanticObject.eClass().getClassifierID()) {
            case TerminalRulesTestLanguagePackage.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.terminalRulesTestLanguage.Model) Parameter(org.eclipse.xtext.Parameter) EPackage(org.eclipse.emf.ecore.EPackage)

Aggregations

EPackage (org.eclipse.emf.ecore.EPackage)416 ParserRule (org.eclipse.xtext.ParserRule)194 Action (org.eclipse.xtext.Action)189 Parameter (org.eclipse.xtext.Parameter)189 Test (org.junit.Test)101 EClass (org.eclipse.emf.ecore.EClass)83 EClassifier (org.eclipse.emf.ecore.EClassifier)75 StringConcatenation (org.eclipse.xtend2.lib.StringConcatenation)60 Resource (org.eclipse.emf.ecore.resource.Resource)50 EObject (org.eclipse.emf.ecore.EObject)45 URI (org.eclipse.emf.common.util.URI)30 ResourceSet (org.eclipse.emf.ecore.resource.ResourceSet)23 Grammar (org.eclipse.xtext.Grammar)22 ResourceSetImpl (org.eclipse.emf.ecore.resource.impl.ResourceSetImpl)16 EStructuralFeature (org.eclipse.emf.ecore.EStructuralFeature)15 GenPackage (org.eclipse.emf.codegen.ecore.genmodel.GenPackage)14 AbstractMetamodelDeclaration (org.eclipse.xtext.AbstractMetamodelDeclaration)14 XtextResource (org.eclipse.xtext.resource.XtextResource)14 EEnum (org.eclipse.emf.ecore.EEnum)13 EReference (org.eclipse.emf.ecore.EReference)12