You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
236 lines
10 KiB
236 lines
10 KiB
/* |
|
* generated by Xtext 2.12.0 |
|
*/ |
|
package com.irtsaintexupery.xtext.serializer; |
|
|
|
import java.util.Set; |
|
|
|
import org.eclipse.emf.ecore.EObject; |
|
import org.eclipse.emf.ecore.EPackage; |
|
import org.eclipse.xtext.Action; |
|
import org.eclipse.xtext.Parameter; |
|
import org.eclipse.xtext.ParserRule; |
|
import org.eclipse.xtext.serializer.ISerializationContext; |
|
import org.eclipse.xtext.serializer.acceptor.SequenceFeeder; |
|
import org.eclipse.xtext.serializer.sequencer.AbstractDelegatingSemanticSequencer; |
|
import org.eclipse.xtext.serializer.sequencer.ITransientValueService.ValueTransient; |
|
|
|
import com.google.inject.Inject; |
|
import com.irtsaintexupery.pseim.seim.BooleanProperty; |
|
import com.irtsaintexupery.pseim.seim.Component; |
|
import com.irtsaintexupery.pseim.seim.IntegerProperty; |
|
import com.irtsaintexupery.pseim.seim.Link; |
|
import com.irtsaintexupery.pseim.seim.Model; |
|
import com.irtsaintexupery.pseim.seim.Port; |
|
import com.irtsaintexupery.pseim.seim.ReferenceProperty; |
|
import com.irtsaintexupery.pseim.seim.SeimPackage; |
|
import com.irtsaintexupery.pseim.seim.StringProperty; |
|
import com.irtsaintexupery.xtext.services.PseimGrammarAccess; |
|
|
|
@SuppressWarnings("all") |
|
public class PseimSemanticSequencer extends AbstractDelegatingSemanticSequencer { |
|
|
|
@Inject |
|
private PseimGrammarAccess grammarAccess; |
|
|
|
@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 == SeimPackage.eINSTANCE) |
|
switch (semanticObject.eClass().getClassifierID()) { |
|
case SeimPackage.BOOLEAN_PROPERTY: |
|
sequence_BooleanProperty(context, (BooleanProperty) semanticObject); |
|
return; |
|
case SeimPackage.COMPONENT: |
|
sequence_Component(context, (Component) semanticObject); |
|
return; |
|
case SeimPackage.INTEGER_PROPERTY: |
|
sequence_IntegerProperty(context, (IntegerProperty) semanticObject); |
|
return; |
|
case SeimPackage.LINK: |
|
sequence_Link(context, (Link) semanticObject); |
|
return; |
|
case SeimPackage.MODEL: |
|
sequence_Model(context, (Model) semanticObject); |
|
return; |
|
case SeimPackage.PORT: |
|
sequence_Port(context, (Port) semanticObject); |
|
return; |
|
case SeimPackage.REFERENCE_PROPERTY: |
|
sequence_ReferenceProperty(context, (ReferenceProperty) semanticObject); |
|
return; |
|
case SeimPackage.STRING_PROPERTY: |
|
sequence_StringProperty(context, (StringProperty) semanticObject); |
|
return; |
|
} |
|
if (errorAcceptor != null) |
|
errorAcceptor.accept(diagnosticProvider.createInvalidContextOrTypeDiagnostic(semanticObject, context)); |
|
} |
|
|
|
/** |
|
* Contexts: |
|
* Property returns BooleanProperty |
|
* BooleanProperty returns BooleanProperty |
|
* |
|
* Constraint: |
|
* (value?='value' key=EString) |
|
*/ |
|
protected void sequence_BooleanProperty(ISerializationContext context, BooleanProperty semanticObject) { |
|
if (errorAcceptor != null) { |
|
if (transientValues.isValueTransient(semanticObject, SeimPackage.Literals.BOOLEAN_PROPERTY__VALUE) == ValueTransient.YES) |
|
errorAcceptor.accept(diagnosticProvider.createFeatureValueMissing(semanticObject, SeimPackage.Literals.BOOLEAN_PROPERTY__VALUE)); |
|
if (transientValues.isValueTransient(semanticObject, SeimPackage.Literals.PROPERTY__KEY) == ValueTransient.YES) |
|
errorAcceptor.accept(diagnosticProvider.createFeatureValueMissing(semanticObject, SeimPackage.Literals.PROPERTY__KEY)); |
|
} |
|
SequenceFeeder feeder = createSequencerFeeder(context, semanticObject); |
|
feeder.accept(grammarAccess.getBooleanPropertyAccess().getValueValueKeyword_0_0(), semanticObject.isValue()); |
|
feeder.accept(grammarAccess.getBooleanPropertyAccess().getKeyEStringParserRuleCall_4_0(), semanticObject.getKey()); |
|
feeder.finish(); |
|
} |
|
|
|
|
|
/** |
|
* Contexts: |
|
* Component returns Component |
|
* GraphElement returns Component |
|
* PropertyHolder returns Component |
|
* Element returns Component |
|
* |
|
* Constraint: |
|
* (name=ID (content+=Port content+=Port*)? content+=GraphElement*) |
|
*/ |
|
protected void sequence_Component(ISerializationContext context, Component semanticObject) { |
|
genericSequencer.createSequence(context, semanticObject); |
|
} |
|
|
|
|
|
/** |
|
* Contexts: |
|
* Property returns IntegerProperty |
|
* IntegerProperty returns IntegerProperty |
|
* |
|
* Constraint: |
|
* (key=EString value=EInt) |
|
*/ |
|
protected void sequence_IntegerProperty(ISerializationContext context, IntegerProperty semanticObject) { |
|
if (errorAcceptor != null) { |
|
if (transientValues.isValueTransient(semanticObject, SeimPackage.Literals.PROPERTY__KEY) == ValueTransient.YES) |
|
errorAcceptor.accept(diagnosticProvider.createFeatureValueMissing(semanticObject, SeimPackage.Literals.PROPERTY__KEY)); |
|
if (transientValues.isValueTransient(semanticObject, SeimPackage.Literals.INTEGER_PROPERTY__VALUE) == ValueTransient.YES) |
|
errorAcceptor.accept(diagnosticProvider.createFeatureValueMissing(semanticObject, SeimPackage.Literals.INTEGER_PROPERTY__VALUE)); |
|
} |
|
SequenceFeeder feeder = createSequencerFeeder(context, semanticObject); |
|
feeder.accept(grammarAccess.getIntegerPropertyAccess().getKeyEStringParserRuleCall_3_0(), semanticObject.getKey()); |
|
feeder.accept(grammarAccess.getIntegerPropertyAccess().getValueEIntParserRuleCall_5_0(), semanticObject.getValue()); |
|
feeder.finish(); |
|
} |
|
|
|
|
|
/** |
|
* Contexts: |
|
* Link returns Link |
|
* GraphElement returns Link |
|
* PropertyHolder returns Link |
|
* Element returns Link |
|
* |
|
* Constraint: |
|
* (src=[Port|QualifiedID] dst=[Port|QualifiedID]) |
|
*/ |
|
protected void sequence_Link(ISerializationContext context, Link semanticObject) { |
|
if (errorAcceptor != null) { |
|
if (transientValues.isValueTransient(semanticObject, SeimPackage.Literals.LINK__SRC) == ValueTransient.YES) |
|
errorAcceptor.accept(diagnosticProvider.createFeatureValueMissing(semanticObject, SeimPackage.Literals.LINK__SRC)); |
|
if (transientValues.isValueTransient(semanticObject, SeimPackage.Literals.LINK__DST) == ValueTransient.YES) |
|
errorAcceptor.accept(diagnosticProvider.createFeatureValueMissing(semanticObject, SeimPackage.Literals.LINK__DST)); |
|
} |
|
SequenceFeeder feeder = createSequencerFeeder(context, semanticObject); |
|
feeder.accept(grammarAccess.getLinkAccess().getSrcPortQualifiedIDParserRuleCall_0_0_1(), semanticObject.eGet(SeimPackage.Literals.LINK__SRC, false)); |
|
feeder.accept(grammarAccess.getLinkAccess().getDstPortQualifiedIDParserRuleCall_2_0_1(), semanticObject.eGet(SeimPackage.Literals.LINK__DST, false)); |
|
feeder.finish(); |
|
} |
|
|
|
|
|
/** |
|
* Contexts: |
|
* Model returns Model |
|
* PropertyHolder returns Model |
|
* |
|
* Constraint: |
|
* (name=EString modelElements+=GraphElement*) |
|
*/ |
|
protected void sequence_Model(ISerializationContext context, Model semanticObject) { |
|
genericSequencer.createSequence(context, semanticObject); |
|
} |
|
|
|
|
|
/** |
|
* Contexts: |
|
* Port returns Port |
|
* PropertyHolder returns Port |
|
* Element returns Port |
|
* |
|
* Constraint: |
|
* (direction=PortDirection name=ID) |
|
*/ |
|
protected void sequence_Port(ISerializationContext context, Port semanticObject) { |
|
if (errorAcceptor != null) { |
|
if (transientValues.isValueTransient(semanticObject, SeimPackage.Literals.PORT__DIRECTION) == ValueTransient.YES) |
|
errorAcceptor.accept(diagnosticProvider.createFeatureValueMissing(semanticObject, SeimPackage.Literals.PORT__DIRECTION)); |
|
if (transientValues.isValueTransient(semanticObject, SeimPackage.Literals.NAMED_ELEMENT__NAME) == ValueTransient.YES) |
|
errorAcceptor.accept(diagnosticProvider.createFeatureValueMissing(semanticObject, SeimPackage.Literals.NAMED_ELEMENT__NAME)); |
|
} |
|
SequenceFeeder feeder = createSequencerFeeder(context, semanticObject); |
|
feeder.accept(grammarAccess.getPortAccess().getDirectionPortDirectionEnumRuleCall_0_0(), semanticObject.getDirection()); |
|
feeder.accept(grammarAccess.getPortAccess().getNameIDTerminalRuleCall_1_0(), semanticObject.getName()); |
|
feeder.finish(); |
|
} |
|
|
|
|
|
/** |
|
* Contexts: |
|
* Property returns ReferenceProperty |
|
* ReferenceProperty returns ReferenceProperty |
|
* |
|
* Constraint: |
|
* (key=EString ref=[PropertyHolder|EString]) |
|
*/ |
|
protected void sequence_ReferenceProperty(ISerializationContext context, ReferenceProperty semanticObject) { |
|
if (errorAcceptor != null) { |
|
if (transientValues.isValueTransient(semanticObject, SeimPackage.Literals.PROPERTY__KEY) == ValueTransient.YES) |
|
errorAcceptor.accept(diagnosticProvider.createFeatureValueMissing(semanticObject, SeimPackage.Literals.PROPERTY__KEY)); |
|
if (transientValues.isValueTransient(semanticObject, SeimPackage.Literals.REFERENCE_PROPERTY__REF) == ValueTransient.YES) |
|
errorAcceptor.accept(diagnosticProvider.createFeatureValueMissing(semanticObject, SeimPackage.Literals.REFERENCE_PROPERTY__REF)); |
|
} |
|
SequenceFeeder feeder = createSequencerFeeder(context, semanticObject); |
|
feeder.accept(grammarAccess.getReferencePropertyAccess().getKeyEStringParserRuleCall_3_0(), semanticObject.getKey()); |
|
feeder.accept(grammarAccess.getReferencePropertyAccess().getRefPropertyHolderEStringParserRuleCall_5_0_1(), semanticObject.eGet(SeimPackage.Literals.REFERENCE_PROPERTY__REF, false)); |
|
feeder.finish(); |
|
} |
|
|
|
|
|
/** |
|
* Contexts: |
|
* Property returns StringProperty |
|
* StringProperty returns StringProperty |
|
* |
|
* Constraint: |
|
* (key=EString value=EString) |
|
*/ |
|
protected void sequence_StringProperty(ISerializationContext context, StringProperty semanticObject) { |
|
if (errorAcceptor != null) { |
|
if (transientValues.isValueTransient(semanticObject, SeimPackage.Literals.PROPERTY__KEY) == ValueTransient.YES) |
|
errorAcceptor.accept(diagnosticProvider.createFeatureValueMissing(semanticObject, SeimPackage.Literals.PROPERTY__KEY)); |
|
if (transientValues.isValueTransient(semanticObject, SeimPackage.Literals.STRING_PROPERTY__VALUE) == ValueTransient.YES) |
|
errorAcceptor.accept(diagnosticProvider.createFeatureValueMissing(semanticObject, SeimPackage.Literals.STRING_PROPERTY__VALUE)); |
|
} |
|
SequenceFeeder feeder = createSequencerFeeder(context, semanticObject); |
|
feeder.accept(grammarAccess.getStringPropertyAccess().getKeyEStringParserRuleCall_3_0(), semanticObject.getKey()); |
|
feeder.accept(grammarAccess.getStringPropertyAccess().getValueEStringParserRuleCall_5_0(), semanticObject.getValue()); |
|
feeder.finish(); |
|
} |
|
|
|
|
|
}
|
|
|