Search in sources :

Example 16 with ParserRule

use of org.eclipse.xtext.ParserRule 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)

Example 17 with ParserRule

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

the class Bug287184TestLanguageSemanticSequencer 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 == Bug287184TestPackage.eINSTANCE)
        switch(semanticObject.eClass().getClassifierID()) {
            case Bug287184TestPackage.ASSOCIATED_DETAIL:
                sequence_AssociatedDetail(context, (AssociatedDetail) semanticObject);
                return;
            case Bug287184TestPackage.DETAIL:
                sequence_Detail(context, (Detail) semanticObject);
                return;
            case Bug287184TestPackage.MODEL:
                sequence_Model(context, (Model) semanticObject);
                return;
        }
    if (errorAcceptor != null)
        errorAcceptor.accept(diagnosticProvider.createInvalidContextOrTypeDiagnostic(semanticObject, context));
}
Also used : ParserRule(org.eclipse.xtext.ParserRule) AssociatedDetail(org.eclipse.xtext.parser.assignments.bug287184Test.AssociatedDetail) Action(org.eclipse.xtext.Action) Model(org.eclipse.xtext.parser.assignments.bug287184Test.Model) Parameter(org.eclipse.xtext.Parameter) AssociatedDetail(org.eclipse.xtext.parser.assignments.bug287184Test.AssociatedDetail) Detail(org.eclipse.xtext.parser.assignments.bug287184Test.Detail) EPackage(org.eclipse.emf.ecore.EPackage)

Example 18 with ParserRule

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

the class DatatypeRulesTestLanguageSemanticSequencer 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 == DatatypeRulesTestLanguagePackage.eINSTANCE)
        switch(semanticObject.eClass().getClassifierID()) {
            case DatatypeRulesTestLanguagePackage.COMPOSITE_MODEL:
                sequence_CompositeModel(context, (CompositeModel) semanticObject);
                return;
            case DatatypeRulesTestLanguagePackage.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) CompositeModel(org.eclipse.xtext.parser.datatyperules.datatypeRulesTestLanguage.CompositeModel) Model(org.eclipse.xtext.parser.datatyperules.datatypeRulesTestLanguage.Model) Parameter(org.eclipse.xtext.Parameter) CompositeModel(org.eclipse.xtext.parser.datatyperules.datatypeRulesTestLanguage.CompositeModel) EPackage(org.eclipse.emf.ecore.EPackage)

Example 19 with ParserRule

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

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

Example 20 with ParserRule

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

the class Bug289524ExTestLanguageSemanticSequencer 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 == Bug289524ExTestPackage.eINSTANCE)
        switch(semanticObject.eClass().getClassifierID()) {
            case Bug289524ExTestPackage.CONTAINED:
                sequence_Contained(context, (Contained) semanticObject);
                return;
            case Bug289524ExTestPackage.MODEL:
                sequence_Model(context, (Model) semanticObject);
                return;
            case Bug289524ExTestPackage.MODEL_ELEMENT:
                sequence_ModelElement(context, (ModelElement) semanticObject);
                return;
        }
    if (errorAcceptor != null)
        errorAcceptor.accept(diagnosticProvider.createInvalidContextOrTypeDiagnostic(semanticObject, context));
}
Also used : Contained(org.eclipse.xtext.parser.antlr.bug289524ExTest.Contained) ParserRule(org.eclipse.xtext.ParserRule) ModelElement(org.eclipse.xtext.parser.antlr.bug289524ExTest.ModelElement) Action(org.eclipse.xtext.Action) Model(org.eclipse.xtext.parser.antlr.bug289524ExTest.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