Search in sources :

Example 61 with EPackage

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

the class SubTestLanguageSemanticSequencer 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 == SubPackagePackage.eINSTANCE)
        switch(semanticObject.eClass().getClassifierID()) {
            case SubPackagePackage.ANOTHER_SUPER_MAIN:
                sequence_AnotherSuperMain(context, (AnotherSuperMain) semanticObject);
                return;
            case SubPackagePackage.SUB_MAIN:
                sequence_SubMain(context, (SubMain) semanticObject);
                return;
        }
    else if (epackage == SuperPackagePackage.eINSTANCE)
        switch(semanticObject.eClass().getClassifierID()) {
            case SuperPackagePackage.SUPER_MAIN:
                sequence_SuperMain(context, (SuperMain) semanticObject);
                return;
        }
    if (errorAcceptor != null)
        errorAcceptor.accept(diagnosticProvider.createInvalidContextOrTypeDiagnostic(semanticObject, context));
}
Also used : ParserRule(org.eclipse.xtext.ParserRule) Action(org.eclipse.xtext.Action) Parameter(org.eclipse.xtext.Parameter) SubMain(org.eclipse.xtext.generator.ecore.subPackage.SubMain) AnotherSuperMain(org.eclipse.xtext.generator.ecore.subPackage.AnotherSuperMain) EPackage(org.eclipse.emf.ecore.EPackage)

Example 62 with EPackage

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

the class GrammarAccessTestLanguageSemanticSequencer 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 == AsubpackagePackage.eINSTANCE)
        switch(semanticObject.eClass().getClassifierID()) {
            case AsubpackagePackage.AMODEL:
                sequence_Root(context, (AModel) semanticObject);
                return;
            case AsubpackagePackage.ATYPE:
                sequence_AType(context, (AType) semanticObject);
                return;
        }
    else if (epackage == SubsubpackagePackage.eINSTANCE)
        switch(semanticObject.eClass().getClassifierID()) {
            case SubsubpackagePackage.ANOTHER_TYPE:
                sequence_AnotherType(context, (AnotherType) semanticObject);
                return;
        }
    if (errorAcceptor != null)
        errorAcceptor.accept(diagnosticProvider.createInvalidContextOrTypeDiagnostic(semanticObject, context));
}
Also used : AType(org.eclipse.xtext.generator.grammarAccess.ametamodel.asubpackage.AType) ParserRule(org.eclipse.xtext.ParserRule) Action(org.eclipse.xtext.Action) AModel(org.eclipse.xtext.generator.grammarAccess.ametamodel.asubpackage.AModel) Parameter(org.eclipse.xtext.Parameter) EPackage(org.eclipse.emf.ecore.EPackage)

Example 63 with EPackage

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

the class AbstractAbstractTestLanguageSemanticSequencer 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 == AmetamodelPackage.eINSTANCE)
        switch(semanticObject.eClass().getClassifierID()) {
            case AmetamodelPackage.AMODEL:
                if (rule == grammarAccess.getAbstractCallExtendedParserRuleRule()) {
                    sequence_AbstractCallExtendedParserRule(context, (AModel) semanticObject);
                    return;
                } else if (rule == grammarAccess.getAbstractCallOverridenParserRuleRule()) {
                    sequence_AbstractCallOverridenParserRule(context, (AModel) semanticObject);
                    return;
                } else
                    break;
            case AmetamodelPackage.ATYPE:
                if (rule == grammarAccess.getExtendableParserRuleRule()) {
                    sequence_ExtendableParserRule(context, (AType) semanticObject);
                    return;
                } else if (rule == grammarAccess.getInheritedParserRuleRule()) {
                    sequence_InheritedParserRule(context, (AType) semanticObject);
                    return;
                } else if (rule == grammarAccess.getOverridableParserRule2Rule()) {
                    sequence_OverridableParserRule2(context, (AType) semanticObject);
                    return;
                } else if (rule == grammarAccess.getOverridableParserRuleRule()) {
                    sequence_OverridableParserRule(context, (AType) semanticObject);
                    return;
                } else
                    break;
        }
    if (errorAcceptor != null)
        errorAcceptor.accept(diagnosticProvider.createInvalidContextOrTypeDiagnostic(semanticObject, context));
}
Also used : AType(org.eclipse.xtext.grammarinheritance.ametamodel.AType) ParserRule(org.eclipse.xtext.ParserRule) Action(org.eclipse.xtext.Action) AModel(org.eclipse.xtext.grammarinheritance.ametamodel.AModel) Parameter(org.eclipse.xtext.Parameter) EPackage(org.eclipse.emf.ecore.EPackage)

Example 64 with EPackage

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

the class InheritanceTest3LanguageSemanticSequencer 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 == InheritanceTestPackage.eINSTANCE)
        switch(semanticObject.eClass().getClassifierID()) {
            case InheritanceTestPackage.ELEMENT:
                if (rule == grammarAccess.getInheritanceTestLanguageElementRule()) {
                    sequence_Element(context, (Element) semanticObject);
                    return;
                } else if (rule == grammarAccess.getElementRule()) {
                    sequence_Element_Element(context, (Element) semanticObject);
                    return;
                } else
                    break;
            case InheritanceTestPackage.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) Element(org.eclipse.xtext.grammarinheritance.inheritanceTest.Element) Model(org.eclipse.xtext.grammarinheritance.inheritanceTest.Model) Parameter(org.eclipse.xtext.Parameter) EPackage(org.eclipse.emf.ecore.EPackage)

Example 65 with EPackage

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

the class MetamodelRefTestLanguageSemanticSequencer 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 == AnotherSimpleTestPackage.eINSTANCE)
        switch(semanticObject.eClass().getClassifierID()) {
            case AnotherSimpleTestPackage.FOO:
                sequence_Foo(context, (Foo) semanticObject);
                return;
        }
    else if (epackage == XtextPackage.eINSTANCE)
        switch(semanticObject.eClass().getClassifierID()) {
            case XtextPackage.PARSER_RULE:
                sequence_MyRule(context, (ParserRule) semanticObject);
                return;
            case XtextPackage.RULE_CALL:
                sequence_NameRef(context, (RuleCall) semanticObject);
                return;
        }
    if (errorAcceptor != null)
        errorAcceptor.accept(diagnosticProvider.createInvalidContextOrTypeDiagnostic(semanticObject, context));
}
Also used : ParserRule(org.eclipse.xtext.ParserRule) Action(org.eclipse.xtext.Action) Foo(org.eclipse.xtext.metamodelreferencing.tests.anotherSimpleTest.Foo) 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