Java Code Examples for org.eclipse.xtext.serializer.ISerializationContext#getParserRule()
The following examples show how to use
org.eclipse.xtext.serializer.ISerializationContext#getParserRule() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: NamedSerializationContextProvider.java From xtext-core with Eclipse Public License 2.0 | 6 votes |
public String getSignificantGrammarElement(final Iterable<ISerializationContext> contexts) { ParserRule rule = null; int index = Integer.MAX_VALUE; for (final ISerializationContext ctx : contexts) { { ParserRule pr = ctx.getParserRule(); if ((pr == null)) { final Action action = ctx.getAssignedAction(); if ((action != null)) { pr = GrammarUtil.containingParserRule(action); } } if ((pr != null)) { final Integer i = this.rules.get(pr); if (((i).intValue() < index)) { index = (i).intValue(); rule = pr; } } } } if ((rule != null)) { return rule.getName(); } return "unknown"; }
Example 2
Source File: Bug250313SemanticSequencer.java From xtext-core with Eclipse Public License 2.0 | 6 votes |
@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 == Bug250313Package.eINSTANCE) switch (semanticObject.eClass().getClassifierID()) { case Bug250313Package.CHILD1: sequence_Child1(context, (Child1) semanticObject); return; case Bug250313Package.CHILD2: sequence_Child2(context, (Child2) semanticObject); return; case Bug250313Package.MODEL: sequence_Model(context, (Model) semanticObject); return; } if (errorAcceptor != null) errorAcceptor.accept(diagnosticProvider.createInvalidContextOrTypeDiagnostic(semanticObject, context)); }
Example 3
Source File: ActionTestLanguage3SemanticSequencer.java From xtext-core with Eclipse Public License 2.0 | 6 votes |
@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 == ActionLang3Package.eINSTANCE) switch (semanticObject.eClass().getClassifierID()) { case ActionLang3Package.ENTRY: sequence_ProductionRule2(context, (Entry) semanticObject); return; case ActionLang3Package.P1: sequence_ProductionRule1_P2_2(context, (P1) semanticObject); return; case ActionLang3Package.P2: sequence_ProductionRule1_P3_4(context, (P2) semanticObject); return; case ActionLang3Package.P3: sequence_ProductionRule1(context, (P3) semanticObject); return; } if (errorAcceptor != null) errorAcceptor.accept(diagnosticProvider.createInvalidContextOrTypeDiagnostic(semanticObject, context)); }
Example 4
Source File: InheritanceTest3LanguageSemanticSequencer.java From xtext-core with Eclipse Public License 2.0 | 6 votes |
@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)); }
Example 5
Source File: FormatterTestLanguageSemanticSequencer.java From xtext-core with Eclipse Public License 2.0 | 6 votes |
@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 == FormattertestlanguagePackage.eINSTANCE) switch (semanticObject.eClass().getClassifierID()) { case FormattertestlanguagePackage.ID_LIST: sequence_IDList(context, (IDList) semanticObject); return; case FormattertestlanguagePackage.KW_LIST: sequence_KWList(context, (KWList) semanticObject); return; } if (errorAcceptor != null) errorAcceptor.accept(diagnosticProvider.createInvalidContextOrTypeDiagnostic(semanticObject, context)); }
Example 6
Source File: PartialContentAssistTestLanguageSemanticSequencer.java From xtext-core with Eclipse Public License 2.0 | 6 votes |
@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 == PartialContentAssistTestLanguagePackage.eINSTANCE) switch (semanticObject.eClass().getClassifierID()) { case PartialContentAssistTestLanguagePackage.PROPERTY: sequence_Property(context, (Property) semanticObject); return; case PartialContentAssistTestLanguagePackage.TYPE_DECLARATION: sequence_TypeDeclaration(context, (TypeDeclaration) semanticObject); return; } if (errorAcceptor != null) errorAcceptor.accept(diagnosticProvider.createInvalidContextOrTypeDiagnostic(semanticObject, context)); }
Example 7
Source File: SimpleUnorderedGroupsTestLanguageSemanticSequencer.java From xtext-core with Eclipse Public License 2.0 | 6 votes |
@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 == UnorderedGroupsTestLanguagePackage.eINSTANCE) switch (semanticObject.eClass().getClassifierID()) { case UnorderedGroupsTestLanguagePackage.MODEL: sequence_Model(context, (Model) semanticObject); return; case UnorderedGroupsTestLanguagePackage.NESTED_MODEL: sequence_NestedModel(context, (NestedModel) semanticObject); return; case UnorderedGroupsTestLanguagePackage.UNORDERED_SERIALIZATION: sequence_UnorderedSerialization(context, (UnorderedSerialization) semanticObject); return; } if (errorAcceptor != null) errorAcceptor.accept(diagnosticProvider.createInvalidContextOrTypeDiagnostic(semanticObject, context)); }
Example 8
Source File: Bug291022TestLanguageSemanticSequencer.java From xtext-eclipse with Eclipse Public License 2.0 | 6 votes |
@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 == Bug291022TestLanguagePackage.eINSTANCE) switch (semanticObject.eClass().getClassifierID()) { case Bug291022TestLanguagePackage.ATTRIBUTE: sequence_Attribute(context, (Attribute) semanticObject); return; case Bug291022TestLanguagePackage.MODEL_ELEMENT: sequence_ModelElement(context, (ModelElement) semanticObject); return; case Bug291022TestLanguagePackage.ROOT_MODEL: sequence_RootModel(context, (RootModel) semanticObject); return; } if (errorAcceptor != null) errorAcceptor.accept(diagnosticProvider.createInvalidContextOrTypeDiagnostic(semanticObject, context)); }
Example 9
Source File: BuilderTestLanguageSemanticSequencer.java From xtext-eclipse with Eclipse Public License 2.0 | 6 votes |
@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 == BuilderTestLanguagePackage.eINSTANCE) switch (semanticObject.eClass().getClassifierID()) { case BuilderTestLanguagePackage.ELEMENT: sequence_Element(context, (Element) semanticObject); return; case BuilderTestLanguagePackage.IMPORT: sequence_Import(context, (Import) semanticObject); return; case BuilderTestLanguagePackage.NAMESPACE: sequence_Namespace(context, (Namespace) semanticObject); return; } if (errorAcceptor != null) errorAcceptor.accept(diagnosticProvider.createInvalidContextOrTypeDiagnostic(semanticObject, context)); }
Example 10
Source File: RefactoringTestLanguage2SemanticSequencer.java From xtext-extras with Eclipse Public License 2.0 | 6 votes |
@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 == RefactoringTestLanguagePackage.eINSTANCE) switch (semanticObject.eClass().getClassifierID()) { case RefactoringTestLanguagePackage.MODEL: sequence_Model(context, (Model) semanticObject); return; case RefactoringTestLanguagePackage.REFERENCE_HOLDER: sequence_ReferenceHolder(context, (ReferenceHolder) semanticObject); return; } if (errorAcceptor != null) errorAcceptor.accept(diagnosticProvider.createInvalidContextOrTypeDiagnostic(semanticObject, context)); }
Example 11
Source File: LazyLinkingTestLanguageSemanticSequencer.java From xtext-core with Eclipse Public License 2.0 | 6 votes |
@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 == LazyLinkingPackage.eINSTANCE) switch (semanticObject.eClass().getClassifierID()) { case LazyLinkingPackage.MODEL: sequence_Model(context, (Model) semanticObject); return; case LazyLinkingPackage.PROPERTY: sequence_Property(context, (Property) semanticObject); return; case LazyLinkingPackage.TYPE: sequence_Type(context, (Type) semanticObject); return; case LazyLinkingPackage.UNRESOLVED_PROXY_PROPERTY: sequence_UnresolvedProxyProperty(context, (UnresolvedProxyProperty) semanticObject); return; } if (errorAcceptor != null) errorAcceptor.accept(diagnosticProvider.createInvalidContextOrTypeDiagnostic(semanticObject, context)); }
Example 12
Source File: Bug377311TestLanguageSemanticSequencer.java From xtext-eclipse with Eclipse Public License 2.0 | 6 votes |
@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 == Bug377311Package.eINSTANCE) switch (semanticObject.eClass().getClassifierID()) { case Bug377311Package.CHILD: sequence_Child(context, (Child) semanticObject); return; case Bug377311Package.ROOT: sequence_Root(context, (Root) semanticObject); return; } if (errorAcceptor != null) errorAcceptor.accept(diagnosticProvider.createInvalidContextOrTypeDiagnostic(semanticObject, context)); }
Example 13
Source File: Bug292245TestLanguageSemanticSequencer.java From xtext-core with Eclipse Public License 2.0 | 5 votes |
@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)); }
Example 14
Source File: PartialParserTestLanguageSemanticSequencer.java From xtext-core with Eclipse Public License 2.0 | 5 votes |
@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 == PartialParserTestLanguagePackage.eINSTANCE) switch (semanticObject.eClass().getClassifierID()) { case PartialParserTestLanguagePackage.ABSTRACT_CHILDREN: sequence_AbstractChildren(context, (AbstractChildren) semanticObject); return; case PartialParserTestLanguagePackage.CHILD: sequence_Child(context, (Child) semanticObject); return; case PartialParserTestLanguagePackage.CHILDREN: sequence_Children(context, (Children) semanticObject); return; case PartialParserTestLanguagePackage.FIRST_CONCRETE: sequence_FirstConcrete(context, (FirstConcrete) semanticObject); return; case PartialParserTestLanguagePackage.NAMED: sequence_Named(context, (Named) semanticObject); return; case PartialParserTestLanguagePackage.NESTED: sequence_Nested(context, (Nested) semanticObject); return; case PartialParserTestLanguagePackage.SECOND_CONCRETE: sequence_SecondConcrete(context, (SecondConcrete) semanticObject); return; case PartialParserTestLanguagePackage.SOME_CONTAINER: sequence_SomeContainer(context, (SomeContainer) semanticObject); return; } if (errorAcceptor != null) errorAcceptor.accept(diagnosticProvider.createInvalidContextOrTypeDiagnostic(semanticObject, context)); }
Example 15
Source File: EcoreTerminalsTestLanguageSemanticSequencer.java From xtext-core with Eclipse Public License 2.0 | 5 votes |
@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 == EcoreTerminalsTestLanguagePackage.eINSTANCE) switch (semanticObject.eClass().getClassifierID()) { case EcoreTerminalsTestLanguagePackage.MODEL: sequence_Model(context, (Model) semanticObject); return; } if (errorAcceptor != null) errorAcceptor.accept(diagnosticProvider.createInvalidContextOrTypeDiagnostic(semanticObject, context)); }
Example 16
Source File: Bug288734TestLanguageSemanticSequencer.java From xtext-eclipse with Eclipse Public License 2.0 | 5 votes |
@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 == Bug288734TestLanguagePackage.eINSTANCE) switch (semanticObject.eClass().getClassifierID()) { case Bug288734TestLanguagePackage.MODEL: sequence_Model(context, (Model) semanticObject); return; case Bug288734TestLanguagePackage.TANNOTATION: sequence_TAnnotation(context, (TAnnotation) semanticObject); return; case Bug288734TestLanguagePackage.TBOOLEAN_CONSTANT: sequence_TBooleanConstant(context, (TBooleanConstant) semanticObject); return; case Bug288734TestLanguagePackage.TINTEGER_CONSTANT: sequence_TIntegerConstant(context, (TIntegerConstant) semanticObject); return; case Bug288734TestLanguagePackage.TSTRING_CONSTANT: sequence_TStringConstant(context, (TStringConstant) semanticObject); return; } if (errorAcceptor != null) errorAcceptor.accept(diagnosticProvider.createInvalidContextOrTypeDiagnostic(semanticObject, context)); }
Example 17
Source File: EnumRulesUiTestLanguageSemanticSequencer.java From xtext-eclipse with Eclipse Public License 2.0 | 5 votes |
@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 == EnumRulesUiTestLanguagePackage.eINSTANCE) switch (semanticObject.eClass().getClassifierID()) { case EnumRulesUiTestLanguagePackage.MODEL: sequence_Model(context, (Model) semanticObject); return; } if (errorAcceptor != null) errorAcceptor.accept(diagnosticProvider.createInvalidContextOrTypeDiagnostic(semanticObject, context)); }
Example 18
Source File: UnorderedGroupsTestLanguageSemanticSequencer.java From xtext-eclipse with Eclipse Public License 2.0 | 5 votes |
@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 == UnorderedGroupsTestPackage.eINSTANCE) switch (semanticObject.eClass().getClassifierID()) { case UnorderedGroupsTestPackage.BUG304681_ATTRIBUTE: sequence_Bug304681Attribute(context, (Bug304681Attribute) semanticObject); return; case UnorderedGroupsTestPackage.BUG304681_MODEL: sequence_Bug304681Model(context, (Bug304681Model) semanticObject); return; case UnorderedGroupsTestPackage.BUG304681_REFERENCE: sequence_Bug304681Reference(context, (Bug304681Reference) semanticObject); return; case UnorderedGroupsTestPackage.GROUP_LOOPED_MODEL: sequence_GroupLoopedModel(context, (GroupLoopedModel) semanticObject); return; case UnorderedGroupsTestPackage.LOOPED_ALTERNATIVE_MODEL: sequence_LoopedAlternativeModel(context, (LoopedAlternativeModel) semanticObject); return; case UnorderedGroupsTestPackage.LOOPED_MODEL: sequence_LoopedModel(context, (LoopedModel) semanticObject); return; case UnorderedGroupsTestPackage.MANDATORY_MODEL: sequence_MandatoryModel(context, (MandatoryModel) semanticObject); return; case UnorderedGroupsTestPackage.MODEL: sequence_Model(context, (Model) semanticObject); return; case UnorderedGroupsTestPackage.SIMPLE_MODEL: sequence_SimpleModel(context, (SimpleModel) semanticObject); return; } if (errorAcceptor != null) errorAcceptor.accept(diagnosticProvider.createInvalidContextOrTypeDiagnostic(semanticObject, context)); }
Example 19
Source File: AssignmentFinderTestLanguageSemanticSequencer.java From xtext-core with Eclipse Public License 2.0 | 4 votes |
@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 == AssignmentFinderTestPackage.eINSTANCE) switch (semanticObject.eClass().getClassifierID()) { case AssignmentFinderTestPackage.CONTAINMENT_REF: sequence_ContainmentRef(context, (ContainmentRef) semanticObject); return; case AssignmentFinderTestPackage.CONTAINMENT_REF_N: if (rule == grammarAccess.getContainmentRef1Rule()) { sequence_ContainmentRef1(context, (ContainmentRefN) semanticObject); return; } else if (rule == grammarAccess.getContainmentRef2Rule()) { sequence_ContainmentRef2(context, (ContainmentRefN) semanticObject); return; } else break; case AssignmentFinderTestPackage.CROSS_REF: sequence_CrossRef(context, (CrossRef) semanticObject); return; case AssignmentFinderTestPackage.ENUM_BOOL: sequence_EnumBool(context, (EnumBool) semanticObject); return; case AssignmentFinderTestPackage.ENUM_VAL: sequence_EnumVal(context, (EnumVal) semanticObject); return; case AssignmentFinderTestPackage.KEYWORD_BOOL: sequence_KeywordBool(context, (KeywordBool) semanticObject); return; case AssignmentFinderTestPackage.KEYWORD_VAL: sequence_KeywordVal(context, (KeywordVal) semanticObject); return; case AssignmentFinderTestPackage.MIXED_BOOL: sequence_MixedBool(context, (MixedBool) semanticObject); return; case AssignmentFinderTestPackage.MIXED_VALUE: sequence_MixedValue(context, (MixedValue) semanticObject); return; case AssignmentFinderTestPackage.MODEL: sequence_Model(context, (Model) semanticObject); return; case AssignmentFinderTestPackage.TERMINAL_BOOL: sequence_TerminalBool(context, (TerminalBool) semanticObject); return; case AssignmentFinderTestPackage.TERMINAL_VAL: sequence_TerminalVal(context, (TerminalVal) semanticObject); return; } if (errorAcceptor != null) errorAcceptor.accept(diagnosticProvider.createInvalidContextOrTypeDiagnostic(semanticObject, context)); }
Example 20
Source File: Bug304681TestLanguageSemanticSequencer.java From xtext-eclipse with Eclipse Public License 2.0 | 4 votes |
@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 == Bug304681TestLanguagePackage.eINSTANCE) switch (semanticObject.eClass().getClassifierID()) { case Bug304681TestLanguagePackage.ATTRIBUT: sequence_Attribute2(context, (Attribut) semanticObject); return; case Bug304681TestLanguagePackage.ATTRIBUTE: sequence_Attribute(context, (Attribute) semanticObject); return; case Bug304681TestLanguagePackage.CONSTRAINT_DEFINITION: sequence_ConstraintDefinition(context, (ConstraintDefinition) semanticObject); return; case Bug304681TestLanguagePackage.MODEL: sequence_Model(context, (Model) semanticObject); return; case Bug304681TestLanguagePackage.OBJECT: if (rule == grammarAccess.getObject2Rule()) { sequence_Object2(context, (org.eclipse.xtext.ui.tests.editor.contentassist.bug304681TestLanguage.Object) semanticObject); return; } else if (rule == grammarAccess.getObjectRule()) { sequence_Object(context, (org.eclipse.xtext.ui.tests.editor.contentassist.bug304681TestLanguage.Object) semanticObject); return; } else break; case Bug304681TestLanguagePackage.PACKAGE_DEFINITION: if (rule == grammarAccess.getPackageDefinition2Rule()) { sequence_PackageDefinition2(context, (PackageDefinition) semanticObject); return; } else if (rule == grammarAccess.getPackageDefinitionRule()) { sequence_PackageDefinition(context, (PackageDefinition) semanticObject); return; } else break; case Bug304681TestLanguagePackage.REFERENCE: if (rule == grammarAccess.getFeature2Rule() || rule == grammarAccess.getReference2Rule()) { sequence_Reference2(context, (Reference) semanticObject); return; } else if (rule == grammarAccess.getFeatureRule() || rule == grammarAccess.getReferenceRule()) { sequence_Reference(context, (Reference) semanticObject); return; } else break; } if (errorAcceptor != null) errorAcceptor.accept(diagnosticProvider.createInvalidContextOrTypeDiagnostic(semanticObject, context)); }