org.eclipse.xtext.serializer.ISerializationContext Java Examples
The following examples show how to use
org.eclipse.xtext.serializer.ISerializationContext.
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: AbstractFormatterTestLanguageSemanticSequencer.java From dsl-devkit with Eclipse Public License 1.0 | 6 votes |
/** * Contexts: * Root returns TestOffset * TestOffset returns TestOffset * * Constraint: * (value=ID first=ID second=ID) */ protected void sequence_TestOffset(ISerializationContext context, TestOffset semanticObject) { if (errorAcceptor != null) { if (transientValues.isValueTransient(semanticObject, FormatterTestLanguagePackage.Literals.TEST_OFFSET__VALUE) == ValueTransient.YES) errorAcceptor.accept(diagnosticProvider.createFeatureValueMissing(semanticObject, FormatterTestLanguagePackage.Literals.TEST_OFFSET__VALUE)); if (transientValues.isValueTransient(semanticObject, FormatterTestLanguagePackage.Literals.TEST_OFFSET__FIRST) == ValueTransient.YES) errorAcceptor.accept(diagnosticProvider.createFeatureValueMissing(semanticObject, FormatterTestLanguagePackage.Literals.TEST_OFFSET__FIRST)); if (transientValues.isValueTransient(semanticObject, FormatterTestLanguagePackage.Literals.TEST_OFFSET__SECOND) == ValueTransient.YES) errorAcceptor.accept(diagnosticProvider.createFeatureValueMissing(semanticObject, FormatterTestLanguagePackage.Literals.TEST_OFFSET__SECOND)); } SequenceFeeder feeder = createSequencerFeeder(context, semanticObject); feeder.accept(grammarAccess.getTestOffsetAccess().getValueIDTerminalRuleCall_3_0(), semanticObject.getValue()); feeder.accept(grammarAccess.getTestOffsetAccess().getFirstIDTerminalRuleCall_5_0(), semanticObject.getFirst()); feeder.accept(grammarAccess.getTestOffsetAccess().getSecondIDTerminalRuleCall_6_0(), semanticObject.getSecond()); feeder.finish(); }
Example #2
Source File: AbstractTestLanguageSemanticSequencer.java From dsl-devkit with Eclipse Public License 1.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 == TestLanguagePackage.eINSTANCE) switch (semanticObject.eClass().getClassifierID()) { case TestLanguagePackage.GREETING: sequence_Greeting(context, (Greeting) semanticObject); return; case TestLanguagePackage.MODEL: sequence_Model(context, (Model) semanticObject); return; } if (errorAcceptor != null) errorAcceptor.accept(diagnosticProvider.createInvalidContextOrTypeDiagnostic(semanticObject, context)); }
Example #3
Source File: GH1462TestLanguageSemanticSequencer.java From xtext-core with Eclipse Public License 2.0 | 6 votes |
/** * Contexts: * Rule8 returns Rule8 * * Constraint: * (left=INT right?='#1' unit='s') */ protected void sequence_Rule8(ISerializationContext context, Rule8 semanticObject) { if (errorAcceptor != null) { if (transientValues.isValueTransient(semanticObject, Gh1462TestPackage.Literals.RULE8__LEFT) == ValueTransient.YES) errorAcceptor.accept(diagnosticProvider.createFeatureValueMissing(semanticObject, Gh1462TestPackage.Literals.RULE8__LEFT)); if (transientValues.isValueTransient(semanticObject, Gh1462TestPackage.Literals.RULE8__RIGHT) == ValueTransient.YES) errorAcceptor.accept(diagnosticProvider.createFeatureValueMissing(semanticObject, Gh1462TestPackage.Literals.RULE8__RIGHT)); if (transientValues.isValueTransient(semanticObject, Gh1462TestPackage.Literals.RULE8__UNIT) == ValueTransient.YES) errorAcceptor.accept(diagnosticProvider.createFeatureValueMissing(semanticObject, Gh1462TestPackage.Literals.RULE8__UNIT)); } SequenceFeeder feeder = createSequencerFeeder(context, semanticObject); feeder.accept(grammarAccess.getRule8Access().getLeftINTTerminalRuleCall_0_0(), semanticObject.getLeft()); feeder.accept(grammarAccess.getRule8Access().getRight1Keyword_1_0(), semanticObject.isRight()); feeder.accept(grammarAccess.getRule8Access().getUnitSKeyword_2_0(), semanticObject.getUnit()); feeder.finish(); }
Example #4
Source File: Bug287941TestLanguageSemanticSequencer.java From xtext-eclipse with Eclipse Public License 2.0 | 6 votes |
/** * Contexts: * WhereEntry returns VariableWhereEntry * WhereEntry.OrWhereEntry_1_0 returns VariableWhereEntry * AndWhereEntry returns VariableWhereEntry * AndWhereEntry.AndWhereEntry_1_0 returns VariableWhereEntry * ConcreteWhereEntry returns VariableWhereEntry * ParWhereEntry returns VariableWhereEntry * AttributeWhereEntry returns VariableWhereEntry * VariableWhereEntry returns VariableWhereEntry * * Constraint: * (alias=[FromEntry|ID] attribute=[EAttribute|ID] operator=NumericOperator rightAlias=[FromEntry|ID] rightAttribute=[EAttribute|ID]) */ protected void sequence_VariableWhereEntry(ISerializationContext context, VariableWhereEntry semanticObject) { if (errorAcceptor != null) { if (transientValues.isValueTransient(semanticObject, Bug287941TestLanguagePackage.Literals.ATTRIBUTE_WHERE_ENTRY__ALIAS) == ValueTransient.YES) errorAcceptor.accept(diagnosticProvider.createFeatureValueMissing(semanticObject, Bug287941TestLanguagePackage.Literals.ATTRIBUTE_WHERE_ENTRY__ALIAS)); if (transientValues.isValueTransient(semanticObject, Bug287941TestLanguagePackage.Literals.ATTRIBUTE_WHERE_ENTRY__ATTRIBUTE) == ValueTransient.YES) errorAcceptor.accept(diagnosticProvider.createFeatureValueMissing(semanticObject, Bug287941TestLanguagePackage.Literals.ATTRIBUTE_WHERE_ENTRY__ATTRIBUTE)); if (transientValues.isValueTransient(semanticObject, Bug287941TestLanguagePackage.Literals.VARIABLE_WHERE_ENTRY__OPERATOR) == ValueTransient.YES) errorAcceptor.accept(diagnosticProvider.createFeatureValueMissing(semanticObject, Bug287941TestLanguagePackage.Literals.VARIABLE_WHERE_ENTRY__OPERATOR)); if (transientValues.isValueTransient(semanticObject, Bug287941TestLanguagePackage.Literals.VARIABLE_WHERE_ENTRY__RIGHT_ALIAS) == ValueTransient.YES) errorAcceptor.accept(diagnosticProvider.createFeatureValueMissing(semanticObject, Bug287941TestLanguagePackage.Literals.VARIABLE_WHERE_ENTRY__RIGHT_ALIAS)); if (transientValues.isValueTransient(semanticObject, Bug287941TestLanguagePackage.Literals.VARIABLE_WHERE_ENTRY__RIGHT_ATTRIBUTE) == ValueTransient.YES) errorAcceptor.accept(diagnosticProvider.createFeatureValueMissing(semanticObject, Bug287941TestLanguagePackage.Literals.VARIABLE_WHERE_ENTRY__RIGHT_ATTRIBUTE)); } SequenceFeeder feeder = createSequencerFeeder(context, semanticObject); feeder.accept(grammarAccess.getVariableWhereEntryAccess().getAliasFromEntryIDTerminalRuleCall_0_0_1(), semanticObject.eGet(Bug287941TestLanguagePackage.Literals.ATTRIBUTE_WHERE_ENTRY__ALIAS, false)); feeder.accept(grammarAccess.getVariableWhereEntryAccess().getAttributeEAttributeIDTerminalRuleCall_2_0_1(), semanticObject.eGet(Bug287941TestLanguagePackage.Literals.ATTRIBUTE_WHERE_ENTRY__ATTRIBUTE, false)); feeder.accept(grammarAccess.getVariableWhereEntryAccess().getOperatorNumericOperatorEnumRuleCall_3_0(), semanticObject.getOperator()); feeder.accept(grammarAccess.getVariableWhereEntryAccess().getRightAliasFromEntryIDTerminalRuleCall_4_0_1(), semanticObject.eGet(Bug287941TestLanguagePackage.Literals.VARIABLE_WHERE_ENTRY__RIGHT_ALIAS, false)); feeder.accept(grammarAccess.getVariableWhereEntryAccess().getRightAttributeEAttributeIDTerminalRuleCall_6_0_1(), semanticObject.eGet(Bug287941TestLanguagePackage.Literals.VARIABLE_WHERE_ENTRY__RIGHT_ATTRIBUTE, false)); feeder.finish(); }
Example #5
Source File: SequencerDiagnosticProvider.java From xtext-core with Eclipse Public License 2.0 | 6 votes |
@Override public ISerializationDiagnostic createInvalidContextOrTypeDiagnostic(EObject sem, ISerializationContext context) { Set<ISerializationContext> contexts = Sets.newHashSet(contextFinder.findByContentsAndContainer(sem, null)); Set<EClass> validTypes = getValidTypes(context); List<ISerializationContext> recommendedCtxs = Lists.newArrayList(); List<ISerializationContext> otherValidCtxs = Lists.newArrayList(); for (ISerializationContext ctx : getValidContexts(sem.eClass())) { if (contexts.contains(ctx)) recommendedCtxs.add(ctx); else otherValidCtxs.add(ctx); } String semanticType = sem.eClass().getName(); String validTypeNames = Joiner.on(", ").join(Iterables.transform(validTypes, new NamedElement2Name())); StringBuilder msg = new StringBuilder(); msg.append("The context '" + context + "' is not valid for type '" + semanticType + "'\n"); msg.append("Recommended contexts for type '" + semanticType + "': " + recommendedCtxs + "\n"); if (!otherValidCtxs.isEmpty()) msg.append("Other valid contexts for type '" + semanticType + "': " + otherValidCtxs); msg.append("The context '" + context + "' is valid for types: " + validTypeNames + "\n"); return new SerializationDiagnostic(INVALID_CONTEXT_OR_TYPE, sem, grammarAccess.getGrammar(), msg.toString()); }
Example #6
Source File: FoldingTestLanguageSemanticSequencer.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 == FoldingPackage.eINSTANCE) switch (semanticObject.eClass().getClassifierID()) { case FoldingPackage.ELEMENT: sequence_Element(context, (Element) semanticObject); return; case FoldingPackage.FOLDING_MODEL: sequence_FoldingModel(context, (FoldingModel) semanticObject); return; } if (errorAcceptor != null) errorAcceptor.accept(diagnosticProvider.createInvalidContextOrTypeDiagnostic(semanticObject, context)); }
Example #7
Source File: RefactoringTestLanguageSemanticSequencer.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 #8
Source File: IgnoreCaseNamespacesTestLanguageSemanticSequencer.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 == IgnoreCaseLinkingTestPackage.eINSTANCE) switch (semanticObject.eClass().getClassifierID()) { case IgnoreCaseLinkingTestPackage.ELEMENT: sequence_Element(context, (Element) semanticObject); return; } else if (epackage == IgnoreCaseNamespacesTestPackage.eINSTANCE) switch (semanticObject.eClass().getClassifierID()) { case IgnoreCaseNamespacesTestPackage.IMPORT: sequence_Import(context, (Import) semanticObject); return; case IgnoreCaseNamespacesTestPackage.MODEL: sequence_Model(context, (Model) semanticObject); return; } if (errorAcceptor != null) errorAcceptor.accept(diagnosticProvider.createInvalidContextOrTypeDiagnostic(semanticObject, context)); }
Example #9
Source File: StatemachineSemanticSequencer.java From xtext-web with Eclipse Public License 2.0 | 5 votes |
/** * Contexts: * Signal returns OutputSignal * * Constraint: * name=ID */ protected void sequence_OutputSignal_Signal(ISerializationContext context, OutputSignal semanticObject) { if (errorAcceptor != null) { if (transientValues.isValueTransient(semanticObject, StatemachinePackage.Literals.SIGNAL__NAME) == ValueTransient.YES) errorAcceptor.accept(diagnosticProvider.createFeatureValueMissing(semanticObject, StatemachinePackage.Literals.SIGNAL__NAME)); } SequenceFeeder feeder = createSequencerFeeder(context, semanticObject); feeder.accept(grammarAccess.getSignalAccess().getNameIDTerminalRuleCall_2_0(), semanticObject.getName()); feeder.finish(); }
Example #10
Source File: ContextFinder.java From xtext-core with Eclipse Public License 2.0 | 5 votes |
@Override public Set<ISerializationContext> findByContents(EObject semanticObject, Iterable<ISerializationContext> contextCandidates) { if (semanticObject == null) throw new NullPointerException(); initConstraints(); Multimap<IConstraint, ISerializationContext> constraints; if (contextCandidates != null) constraints = getConstraints(semanticObject, contextCandidates); else constraints = getConstraints(semanticObject); if (constraints.size() < 2) return Sets.newLinkedHashSet(constraints.values()); for (IConstraint cand : Lists.newArrayList(constraints.keySet())) if (!isValidValueQuantity(cand, semanticObject)) constraints.removeAll(cand); if (constraints.size() < 2) return Sets.newLinkedHashSet(constraints.values()); LinkedHashSet<ISerializationContext> result = Sets.newLinkedHashSet(constraints.values()); for (EStructuralFeature feat : semanticObject.eClass().getEAllStructuralFeatures()) { if (transientValueUtil.isTransient(semanticObject, feat) != ValueTransient.NO) continue; if (feat.isMany() && ((List<?>) semanticObject.eGet(feat)).isEmpty()) continue; Multimap<AbstractElement, ISerializationContext> assignments = collectAssignments(constraints, feat); Set<AbstractElement> assignedElements = findAssignedElements(semanticObject, feat, assignments); Set<ISerializationContext> keep = Sets.newHashSet(); for (AbstractElement ele : assignedElements) keep.addAll(assignments.get(ele)); result.retainAll(keep); } return result; }
Example #11
Source File: SequencerTestLanguageSemanticSequencer.java From xtext-core with Eclipse Public License 2.0 | 5 votes |
/** * Contexts: * SingleContainmentReferenceChild1 returns SingleContainmentReferenceChild1 * * Constraint: * val='kw1' */ protected void sequence_SingleContainmentReferenceChild1(ISerializationContext context, SingleContainmentReferenceChild1 semanticObject) { if (errorAcceptor != null) { if (transientValues.isValueTransient(semanticObject, SequencertestPackage.Literals.SINGLE_CONTAINMENT_REFERENCE_CHILD1__VAL) == ValueTransient.YES) errorAcceptor.accept(diagnosticProvider.createFeatureValueMissing(semanticObject, SequencertestPackage.Literals.SINGLE_CONTAINMENT_REFERENCE_CHILD1__VAL)); } SequenceFeeder feeder = createSequencerFeeder(context, semanticObject); feeder.accept(grammarAccess.getSingleContainmentReferenceChild1Access().getValKw1Keyword_0(), semanticObject.getVal()); feeder.finish(); }
Example #12
Source File: ReferenceGrammarTestLanguageSemanticSequencer.java From xtext-core with Eclipse Public License 2.0 | 5 votes |
/** * Contexts: * Person returns Kind * Kind returns Kind * * Constraint: * (name=ID age=INT) */ protected void sequence_Kind(ISerializationContext context, Kind semanticObject) { if (errorAcceptor != null) { if (transientValues.isValueTransient(semanticObject, ReferenceGrammarPackage.Literals.PERSON__NAME) == ValueTransient.YES) errorAcceptor.accept(diagnosticProvider.createFeatureValueMissing(semanticObject, ReferenceGrammarPackage.Literals.PERSON__NAME)); if (transientValues.isValueTransient(semanticObject, ReferenceGrammarPackage.Literals.PERSON__AGE) == ValueTransient.YES) errorAcceptor.accept(diagnosticProvider.createFeatureValueMissing(semanticObject, ReferenceGrammarPackage.Literals.PERSON__AGE)); } SequenceFeeder feeder = createSequencerFeeder(context, semanticObject); feeder.accept(grammarAccess.getKindAccess().getNameIDTerminalRuleCall_2_0(), semanticObject.getName()); feeder.accept(grammarAccess.getKindAccess().getAgeINTTerminalRuleCall_3_0(), semanticObject.getAge()); feeder.finish(); }
Example #13
Source File: SerializerFragment2.java From xtext-core with Eclipse Public License 2.0 | 5 votes |
private StringConcatenationClient genCondition(final List<ISerializationContext> contexts, final IGrammarConstraintProvider.IConstraint constraint, final Multimap<EObject, IGrammarConstraintProvider.IConstraint> ctx2ctr) { StringConcatenationClient _xblockexpression = null; { final List<ISerializationContext> sorted = IterableExtensions.<ISerializationContext>sort(contexts); final LinkedHashMultimap<EObject, ISerializationContext> index = LinkedHashMultimap.<EObject, ISerializationContext>create(); final Consumer<ISerializationContext> _function = (ISerializationContext it) -> { index.put(this.getContextObject(it), it); }; sorted.forEach(_function); StringConcatenationClient _client = new StringConcatenationClient() { @Override protected void appendTo(StringConcatenationClient.TargetStringConcatenation _builder) { { Set<EObject> _keySet = index.keySet(); boolean _hasElements = false; for(final EObject obj : _keySet) { if (!_hasElements) { _hasElements = true; } else { _builder.appendImmediate("\n\t\t|| ", ""); } StringConcatenationClient _genObjectSelector = SerializerFragment2.this.genObjectSelector(obj); _builder.append(_genObjectSelector); { int _size = ctx2ctr.get(obj).size(); boolean _greaterThan = (_size > 1); if (_greaterThan) { StringConcatenationClient _genParameterSelector = SerializerFragment2.this.genParameterSelector(obj, index.get(obj), constraint); _builder.append(_genParameterSelector); } } } } } }; _xblockexpression = _client; } return _xblockexpression; }
Example #14
Source File: BacktrackingContentAssistTestLanguageSemanticSequencer.java From xtext-eclipse with Eclipse Public License 2.0 | 5 votes |
/** * Contexts: * ClassifierRef returns QualifiedClassifierRef * QualifiedClassifierRef returns QualifiedClassifierRef * * Constraint: * (namespace=Identifier element=ClassifierRef) */ protected void sequence_QualifiedClassifierRef(ISerializationContext context, QualifiedClassifierRef semanticObject) { if (errorAcceptor != null) { if (transientValues.isValueTransient(semanticObject, BacktrackingContentAssistTestPackage.Literals.QUALIFIED_CLASSIFIER_REF__NAMESPACE) == ValueTransient.YES) errorAcceptor.accept(diagnosticProvider.createFeatureValueMissing(semanticObject, BacktrackingContentAssistTestPackage.Literals.QUALIFIED_CLASSIFIER_REF__NAMESPACE)); if (transientValues.isValueTransient(semanticObject, BacktrackingContentAssistTestPackage.Literals.QUALIFIED_CLASSIFIER_REF__ELEMENT) == ValueTransient.YES) errorAcceptor.accept(diagnosticProvider.createFeatureValueMissing(semanticObject, BacktrackingContentAssistTestPackage.Literals.QUALIFIED_CLASSIFIER_REF__ELEMENT)); } SequenceFeeder feeder = createSequencerFeeder(context, semanticObject); feeder.accept(grammarAccess.getQualifiedClassifierRefAccess().getNamespaceIdentifierParserRuleCall_0_0(), semanticObject.getNamespace()); feeder.accept(grammarAccess.getQualifiedClassifierRefAccess().getElementClassifierRefParserRuleCall_2_0(), semanticObject.getElement()); feeder.finish(); }
Example #15
Source File: ConcreteSyntaxValidationTestLanguageSemanticSequencer.java From xtext-core with Eclipse Public License 2.0 | 5 votes |
/** * Contexts: * SimpleGroup returns SimpleGroup * * Constraint: * (val1=ID val2=ID) */ protected void sequence_SimpleGroup(ISerializationContext context, SimpleGroup semanticObject) { if (errorAcceptor != null) { if (transientValues.isValueTransient(semanticObject, CsvalidationtestPackage.Literals.SIMPLE_GROUP__VAL1) == ValueTransient.YES) errorAcceptor.accept(diagnosticProvider.createFeatureValueMissing(semanticObject, CsvalidationtestPackage.Literals.SIMPLE_GROUP__VAL1)); if (transientValues.isValueTransient(semanticObject, CsvalidationtestPackage.Literals.SIMPLE_GROUP__VAL2) == ValueTransient.YES) errorAcceptor.accept(diagnosticProvider.createFeatureValueMissing(semanticObject, CsvalidationtestPackage.Literals.SIMPLE_GROUP__VAL2)); } SequenceFeeder feeder = createSequencerFeeder(context, semanticObject); feeder.accept(grammarAccess.getSimpleGroupAccess().getVal1IDTerminalRuleCall_1_0(), semanticObject.getVal1()); feeder.accept(grammarAccess.getSimpleGroupAccess().getVal2IDTerminalRuleCall_2_0(), semanticObject.getVal2()); feeder.finish(); }
Example #16
Source File: AbstractSyntacticSequencer.java From xtext-core with Eclipse Public License 2.0 | 5 votes |
@Override public boolean enterAssignedParserRuleCall(RuleCall rc, EObject semanticChild, ICompositeNode node) { navigateToAbsorber(rc, node); boolean shouldEnter = delegate.enterAssignedParserRuleCall(rc, semanticChild, node); if (shouldEnter) { ISerializationContext child = SerializationContext.forChild(contexts.peek().context, rc, semanticChild); ISynAbsorberState pda = syntacticSequencerPDAs.get(child); if (pda == null) throw new IllegalStateException(); SyntacticalContext j = new SyntacticalContext(child, semanticChild, pda, node); contexts.push(j); } return shouldEnter; }
Example #17
Source File: IgnoreCaseLexerTestLanguageSemanticSequencer.java From xtext-core with Eclipse Public License 2.0 | 5 votes |
/** * Contexts: * Model returns Model * * Constraint: * value='CaSe' */ protected void sequence_Model(ISerializationContext context, Model semanticObject) { if (errorAcceptor != null) { if (transientValues.isValueTransient(semanticObject, IgnoreCaseTestLanguagePackage.Literals.MODEL__VALUE) == ValueTransient.YES) errorAcceptor.accept(diagnosticProvider.createFeatureValueMissing(semanticObject, IgnoreCaseTestLanguagePackage.Literals.MODEL__VALUE)); } SequenceFeeder feeder = createSequencerFeeder(context, semanticObject); feeder.accept(grammarAccess.getModelAccess().getValueCaSeKeyword_2_0(), semanticObject.getValue()); feeder.finish(); }
Example #18
Source File: GH1462TestLanguageSemanticSequencer.java From xtext-core with Eclipse Public License 2.0 | 5 votes |
/** * Contexts: * Wrapper returns Wrapper * * Constraint: * value=INT */ protected void sequence_Wrapper(ISerializationContext context, Wrapper semanticObject) { if (errorAcceptor != null) { if (transientValues.isValueTransient(semanticObject, Gh1462TestPackage.Literals.WRAPPER__VALUE) == ValueTransient.YES) errorAcceptor.accept(diagnosticProvider.createFeatureValueMissing(semanticObject, Gh1462TestPackage.Literals.WRAPPER__VALUE)); } SequenceFeeder feeder = createSequencerFeeder(context, semanticObject); feeder.accept(grammarAccess.getWrapperAccess().getValueINTTerminalRuleCall_0(), semanticObject.getValue()); feeder.finish(); }
Example #19
Source File: BacktrackingContentAssistTestLanguageSemanticSequencer.java From xtext-eclipse with Eclipse Public License 2.0 | 5 votes |
/** * Contexts: * ClassifierRef returns SimpleClassifierRef * SimpleClassifierRef returns SimpleClassifierRef * * Constraint: * classifier=Identifier */ protected void sequence_SimpleClassifierRef(ISerializationContext context, SimpleClassifierRef semanticObject) { if (errorAcceptor != null) { if (transientValues.isValueTransient(semanticObject, BacktrackingContentAssistTestPackage.Literals.SIMPLE_CLASSIFIER_REF__CLASSIFIER) == ValueTransient.YES) errorAcceptor.accept(diagnosticProvider.createFeatureValueMissing(semanticObject, BacktrackingContentAssistTestPackage.Literals.SIMPLE_CLASSIFIER_REF__CLASSIFIER)); } SequenceFeeder feeder = createSequencerFeeder(context, semanticObject); feeder.accept(grammarAccess.getSimpleClassifierRefAccess().getClassifierIdentifierParserRuleCall_0(), semanticObject.getClassifier()); feeder.finish(); }
Example #20
Source File: Bug288432TestLanguageSemanticSequencer.java From xtext-core with Eclipse Public License 2.0 | 5 votes |
/** * Contexts: * ParameterObject returns MyInt * MyInt returns MyInt * * Constraint: * int=INT */ protected void sequence_MyInt(ISerializationContext context, MyInt semanticObject) { if (errorAcceptor != null) { if (transientValues.isValueTransient(semanticObject, Bug288432TestPackage.Literals.MY_INT__INT) == ValueTransient.YES) errorAcceptor.accept(diagnosticProvider.createFeatureValueMissing(semanticObject, Bug288432TestPackage.Literals.MY_INT__INT)); } SequenceFeeder feeder = createSequencerFeeder(context, semanticObject); feeder.accept(grammarAccess.getMyIntAccess().getIntINTTerminalRuleCall_0(), semanticObject.getInt()); feeder.finish(); }
Example #21
Source File: Bug289524ExTestLanguageSemanticSequencer.java From xtext-core with Eclipse Public License 2.0 | 5 votes |
/** * Contexts: * Contained returns Contained * * Constraint: * name=ID */ protected void sequence_Contained(ISerializationContext context, Contained semanticObject) { if (errorAcceptor != null) { if (transientValues.isValueTransient(semanticObject, Bug289524ExTestPackage.Literals.CONTAINED__NAME) == ValueTransient.YES) errorAcceptor.accept(diagnosticProvider.createFeatureValueMissing(semanticObject, Bug289524ExTestPackage.Literals.CONTAINED__NAME)); } SequenceFeeder feeder = createSequencerFeeder(context, semanticObject); feeder.accept(grammarAccess.getContainedAccess().getNameIDTerminalRuleCall_1_0(), semanticObject.getName()); feeder.finish(); }
Example #22
Source File: AbstractAbstractTestLanguageSemanticSequencer.java From xtext-core with Eclipse Public License 2.0 | 5 votes |
/** * Contexts: * OverridableParserRule2 returns AType * * Constraint: * name=STRING */ protected void sequence_OverridableParserRule2(ISerializationContext context, AType semanticObject) { if (errorAcceptor != null) { if (transientValues.isValueTransient(semanticObject, AmetamodelPackage.Literals.ATYPE__NAME) == ValueTransient.YES) errorAcceptor.accept(diagnosticProvider.createFeatureValueMissing(semanticObject, AmetamodelPackage.Literals.ATYPE__NAME)); } SequenceFeeder feeder = createSequencerFeeder(context, semanticObject); feeder.accept(grammarAccess.getOverridableParserRule2Access().getNameSTRINGTerminalRuleCall_1_0(), semanticObject.getName()); feeder.finish(); }
Example #23
Source File: ContentAssistTestLanguageSemanticSequencer.java From xtext-eclipse with Eclipse Public License 2.0 | 5 votes |
/** * Contexts: * AbstractRule returns SecondAbstractRuleChild * SecondAbstractRuleChild returns SecondAbstractRuleChild * * Constraint: * (name=ID rule=AbstractRuleCall) */ protected void sequence_SecondAbstractRuleChild(ISerializationContext context, SecondAbstractRuleChild semanticObject) { if (errorAcceptor != null) { if (transientValues.isValueTransient(semanticObject, ContentAssistTestLanguagePackage.Literals.ABSTRACT_RULE__NAME) == ValueTransient.YES) errorAcceptor.accept(diagnosticProvider.createFeatureValueMissing(semanticObject, ContentAssistTestLanguagePackage.Literals.ABSTRACT_RULE__NAME)); if (transientValues.isValueTransient(semanticObject, ContentAssistTestLanguagePackage.Literals.SECOND_ABSTRACT_RULE_CHILD__RULE) == ValueTransient.YES) errorAcceptor.accept(diagnosticProvider.createFeatureValueMissing(semanticObject, ContentAssistTestLanguagePackage.Literals.SECOND_ABSTRACT_RULE_CHILD__RULE)); } SequenceFeeder feeder = createSequencerFeeder(context, semanticObject); feeder.accept(grammarAccess.getSecondAbstractRuleChildAccess().getNameIDTerminalRuleCall_0_0(), semanticObject.getName()); feeder.accept(grammarAccess.getSecondAbstractRuleChildAccess().getRuleAbstractRuleCallParserRuleCall_3_0(), semanticObject.getRule()); feeder.finish(); }
Example #24
Source File: DomainModelTestLanguageSemanticSequencer.java From xtext-eclipse with Eclipse Public License 2.0 | 5 votes |
/** * Contexts: * Type returns DataType * DataType returns DataType * * Constraint: * name=ID */ protected void sequence_DataType(ISerializationContext context, DataType semanticObject) { if (errorAcceptor != null) { if (transientValues.isValueTransient(semanticObject, DomainModelTestPackage.Literals.TYPE__NAME) == ValueTransient.YES) errorAcceptor.accept(diagnosticProvider.createFeatureValueMissing(semanticObject, DomainModelTestPackage.Literals.TYPE__NAME)); } SequenceFeeder feeder = createSequencerFeeder(context, semanticObject); feeder.accept(grammarAccess.getDataTypeAccess().getNameIDTerminalRuleCall_1_0(), semanticObject.getName()); feeder.finish(); }
Example #25
Source File: EcoreFragmentTestLanguageSemanticSequencer.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 == SecondPackage.eINSTANCE) switch (semanticObject.eClass().getClassifierID()) { case SecondPackage.SECOND: sequence_Second(context, (Second) semanticObject); return; } if (errorAcceptor != null) errorAcceptor.accept(diagnosticProvider.createInvalidContextOrTypeDiagnostic(semanticObject, context)); }
Example #26
Source File: InsertionPointFinder.java From xtext-core with Eclipse Public License 2.0 | 4 votes |
protected ISerState findState(ISerializationContext ctx, AbstractElement ele) { Pda<ISerState, RuleCall> pda = pdas.get(ctx); return new NfaUtil().find(pda, s -> s.getGrammarElement() == ele); }
Example #27
Source File: GrammarConstraintProvider.java From xtext-core with Eclipse Public License 2.0 | 4 votes |
@Override public List<ISerializationContext> getContexts() { return contexts; }
Example #28
Source File: ISyntacticSequencer.java From xtext-core with Eclipse Public License 2.0 | 4 votes |
void init(ISerializationContext context, EObject semanticObject, ISyntacticSequenceAcceptor sequenceAcceptor, ISerializationDiagnostic.Acceptor errorAcceptor);
Example #29
Source File: AbstractGamlSemanticSequencer.java From gama with GNU General Public License v3.0 | 3 votes |
/** * Contexts: * Expression returns ReservedLiteral * BinaryOperator returns ReservedLiteral * Pair returns ReservedLiteral * Pair.BinaryOperator_1_0 returns ReservedLiteral * If returns ReservedLiteral * If.If_1_0 returns ReservedLiteral * Or returns ReservedLiteral * Or.BinaryOperator_1_0 returns ReservedLiteral * And returns ReservedLiteral * And.BinaryOperator_1_0 returns ReservedLiteral * Cast returns ReservedLiteral * Cast.BinaryOperator_1_0_0 returns ReservedLiteral * Comparison returns ReservedLiteral * Comparison.BinaryOperator_1_0_0 returns ReservedLiteral * Addition returns ReservedLiteral * Addition.BinaryOperator_1_0_0 returns ReservedLiteral * Multiplication returns ReservedLiteral * Multiplication.BinaryOperator_1_0_0 returns ReservedLiteral * Exponentiation returns ReservedLiteral * Exponentiation.BinaryOperator_1_0_0 returns ReservedLiteral * Binary returns ReservedLiteral * Binary.BinaryOperator_1_0_0 returns ReservedLiteral * Unit returns ReservedLiteral * Unit.Unit_1_0_0 returns ReservedLiteral * Unary returns ReservedLiteral * Access returns ReservedLiteral * Access.Access_1_0 returns ReservedLiteral * Primary returns ReservedLiteral * TerminalExpression returns ReservedLiteral * * Constraint: * op=KEYWORD */ protected void sequence_TerminalExpression(ISerializationContext context, ReservedLiteral semanticObject) { if (errorAcceptor != null) { if (transientValues.isValueTransient(semanticObject, GamlPackage.Literals.TERMINAL_EXPRESSION__OP) == ValueTransient.YES) errorAcceptor.accept(diagnosticProvider.createFeatureValueMissing(semanticObject, GamlPackage.Literals.TERMINAL_EXPRESSION__OP)); } SequenceFeeder feeder = createSequencerFeeder(context, semanticObject); feeder.accept(grammarAccess.getTerminalExpressionAccess().getOpKEYWORDTerminalRuleCall_4_1_0(), semanticObject.getOp()); feeder.finish(); }
Example #30
Source File: BacktrackingContentAssistTestLanguageSemanticSequencer.java From xtext-eclipse with Eclipse Public License 2.0 | 3 votes |
/** * Contexts: * NavigationExp returns SimpleNameExp * NavigationExp.InfixExp_1_0_0 returns SimpleNameExp * NavigationExp.OclMessage_1_1_0 returns SimpleNameExp * NavigatingExp returns SimpleNameExp * NavigatingExp.InfixExp_1_0_0 returns SimpleNameExp * NavigatingExp.OclMessage_1_1_0 returns SimpleNameExp * OclMessageArg returns SimpleNameExp * TypeExp returns SimpleNameExp * Expression returns SimpleNameExp * implies returns SimpleNameExp * implies.InfixExp_1_0 returns SimpleNameExp * xor returns SimpleNameExp * xor.InfixExp_1_0 returns SimpleNameExp * or returns SimpleNameExp * or.InfixExp_1_0 returns SimpleNameExp * and returns SimpleNameExp * and.InfixExp_1_0 returns SimpleNameExp * equality returns SimpleNameExp * equality.InfixExp_1_0 returns SimpleNameExp * relational returns SimpleNameExp * relational.InfixExp_1_0 returns SimpleNameExp * additive returns SimpleNameExp * additive.InfixExp_1_0 returns SimpleNameExp * multiplicative returns SimpleNameExp * multiplicative.InfixExp_1_0 returns SimpleNameExp * unary returns SimpleNameExp * SubNavigationExp returns SimpleNameExp * SubNavigatingExp returns SimpleNameExp * NameExp returns SimpleNameExp * SimpleNameExp returns SimpleNameExp * * Constraint: * element=Identifier */ protected void sequence_SimpleNameExp(ISerializationContext context, SimpleNameExp semanticObject) { if (errorAcceptor != null) { if (transientValues.isValueTransient(semanticObject, BacktrackingContentAssistTestPackage.Literals.SIMPLE_NAME_EXP__ELEMENT) == ValueTransient.YES) errorAcceptor.accept(diagnosticProvider.createFeatureValueMissing(semanticObject, BacktrackingContentAssistTestPackage.Literals.SIMPLE_NAME_EXP__ELEMENT)); } SequenceFeeder feeder = createSequencerFeeder(context, semanticObject); feeder.accept(grammarAccess.getSimpleNameExpAccess().getElementIdentifierParserRuleCall_0(), semanticObject.getElement()); feeder.finish(); }