Added mapping xtext editor

This commit is contained in:
Arnaud Dieumegard
2019-01-17 16:04:44 +01:00
parent a85ade0b42
commit 650ef7b56a
75 changed files with 12980 additions and 0 deletions

View File

@@ -0,0 +1,216 @@
/*
* generated by Xtext 2.12.0
*/
package com.irtsaintexupery.xtext.pseim;
import com.google.inject.Binder;
import com.google.inject.Provider;
import com.google.inject.name.Names;
import com.irtsaintexupery.xtext.pseim.formatting2.MappingFormatter;
import com.irtsaintexupery.xtext.pseim.generator.MappingGenerator;
import com.irtsaintexupery.xtext.pseim.parser.antlr.MappingAntlrTokenFileProvider;
import com.irtsaintexupery.xtext.pseim.parser.antlr.MappingParser;
import com.irtsaintexupery.xtext.pseim.parser.antlr.internal.InternalMappingLexer;
import com.irtsaintexupery.xtext.pseim.scoping.MappingScopeProvider;
import com.irtsaintexupery.xtext.pseim.serializer.MappingSemanticSequencer;
import com.irtsaintexupery.xtext.pseim.serializer.MappingSyntacticSequencer;
import com.irtsaintexupery.xtext.pseim.services.MappingGrammarAccess;
import com.irtsaintexupery.xtext.pseim.validation.MappingValidator;
import java.util.Properties;
import org.eclipse.xtext.Constants;
import org.eclipse.xtext.IGrammarAccess;
import org.eclipse.xtext.common.services.Ecore2XtextTerminalConverters;
import org.eclipse.xtext.conversion.IValueConverterService;
import org.eclipse.xtext.formatting2.FormatterPreferenceValuesProvider;
import org.eclipse.xtext.formatting2.FormatterPreferences;
import org.eclipse.xtext.formatting2.IFormatter2;
import org.eclipse.xtext.generator.IGenerator2;
import org.eclipse.xtext.naming.DefaultDeclarativeQualifiedNameProvider;
import org.eclipse.xtext.naming.IQualifiedNameProvider;
import org.eclipse.xtext.parser.IParser;
import org.eclipse.xtext.parser.ITokenToStringConverter;
import org.eclipse.xtext.parser.antlr.AntlrTokenDefProvider;
import org.eclipse.xtext.parser.antlr.AntlrTokenToStringConverter;
import org.eclipse.xtext.parser.antlr.IAntlrTokenFileProvider;
import org.eclipse.xtext.parser.antlr.ITokenDefProvider;
import org.eclipse.xtext.parser.antlr.Lexer;
import org.eclipse.xtext.parser.antlr.LexerBindings;
import org.eclipse.xtext.parser.antlr.LexerProvider;
import org.eclipse.xtext.preferences.IPreferenceValuesProvider;
import org.eclipse.xtext.resource.IContainer;
import org.eclipse.xtext.resource.IResourceDescriptions;
import org.eclipse.xtext.resource.containers.IAllContainersState;
import org.eclipse.xtext.resource.containers.ResourceSetBasedAllContainersStateProvider;
import org.eclipse.xtext.resource.containers.StateBasedContainerManager;
import org.eclipse.xtext.resource.impl.ResourceDescriptionsProvider;
import org.eclipse.xtext.resource.impl.ResourceSetBasedResourceDescriptions;
import org.eclipse.xtext.scoping.IGlobalScopeProvider;
import org.eclipse.xtext.scoping.IScopeProvider;
import org.eclipse.xtext.scoping.IgnoreCaseLinking;
import org.eclipse.xtext.scoping.impl.AbstractDeclarativeScopeProvider;
import org.eclipse.xtext.scoping.impl.DefaultGlobalScopeProvider;
import org.eclipse.xtext.scoping.impl.ImportedNamespaceAwareLocalScopeProvider;
import org.eclipse.xtext.serializer.ISerializer;
import org.eclipse.xtext.serializer.impl.Serializer;
import org.eclipse.xtext.serializer.sequencer.ISemanticSequencer;
import org.eclipse.xtext.serializer.sequencer.ISyntacticSequencer;
import org.eclipse.xtext.service.DefaultRuntimeModule;
import org.eclipse.xtext.service.SingletonBinding;
/**
* Manual modifications go to {@link MappingRuntimeModule}.
*/
@SuppressWarnings("all")
public abstract class AbstractMappingRuntimeModule extends DefaultRuntimeModule {
protected Properties properties = null;
@Override
public void configure(Binder binder) {
properties = tryBindProperties(binder, "com/irtsaintexupery/xtext/pseim/Mapping.properties");
super.configure(binder);
}
public void configureLanguageName(Binder binder) {
binder.bind(String.class).annotatedWith(Names.named(Constants.LANGUAGE_NAME)).toInstance("com.irtsaintexupery.xtext.pseim.Mapping");
}
public void configureFileExtensions(Binder binder) {
if (properties == null || properties.getProperty(Constants.FILE_EXTENSIONS) == null)
binder.bind(String.class).annotatedWith(Names.named(Constants.FILE_EXTENSIONS)).toInstance("mapping");
}
// contributed by org.eclipse.xtext.xtext.generator.grammarAccess.GrammarAccessFragment2
public ClassLoader bindClassLoaderToInstance() {
return getClass().getClassLoader();
}
// contributed by org.eclipse.xtext.xtext.generator.grammarAccess.GrammarAccessFragment2
public Class<? extends IGrammarAccess> bindIGrammarAccess() {
return MappingGrammarAccess.class;
}
// contributed by org.eclipse.xtext.xtext.generator.serializer.SerializerFragment2
public Class<? extends ISemanticSequencer> bindISemanticSequencer() {
return MappingSemanticSequencer.class;
}
// contributed by org.eclipse.xtext.xtext.generator.serializer.SerializerFragment2
public Class<? extends ISyntacticSequencer> bindISyntacticSequencer() {
return MappingSyntacticSequencer.class;
}
// contributed by org.eclipse.xtext.xtext.generator.serializer.SerializerFragment2
public Class<? extends ISerializer> bindISerializer() {
return Serializer.class;
}
// contributed by org.eclipse.xtext.xtext.generator.parser.antlr.XtextAntlrGeneratorFragment2
public Class<? extends IParser> bindIParser() {
return MappingParser.class;
}
// contributed by org.eclipse.xtext.xtext.generator.parser.antlr.XtextAntlrGeneratorFragment2
public Class<? extends ITokenToStringConverter> bindITokenToStringConverter() {
return AntlrTokenToStringConverter.class;
}
// contributed by org.eclipse.xtext.xtext.generator.parser.antlr.XtextAntlrGeneratorFragment2
public Class<? extends IAntlrTokenFileProvider> bindIAntlrTokenFileProvider() {
return MappingAntlrTokenFileProvider.class;
}
// contributed by org.eclipse.xtext.xtext.generator.parser.antlr.XtextAntlrGeneratorFragment2
public Class<? extends Lexer> bindLexer() {
return InternalMappingLexer.class;
}
// contributed by org.eclipse.xtext.xtext.generator.parser.antlr.XtextAntlrGeneratorFragment2
public Class<? extends ITokenDefProvider> bindITokenDefProvider() {
return AntlrTokenDefProvider.class;
}
// contributed by org.eclipse.xtext.xtext.generator.parser.antlr.XtextAntlrGeneratorFragment2
public Provider<? extends InternalMappingLexer> provideInternalMappingLexer() {
return LexerProvider.create(InternalMappingLexer.class);
}
// contributed by org.eclipse.xtext.xtext.generator.parser.antlr.XtextAntlrGeneratorFragment2
public void configureRuntimeLexer(Binder binder) {
binder.bind(Lexer.class)
.annotatedWith(Names.named(LexerBindings.RUNTIME))
.to(InternalMappingLexer.class);
}
// contributed by org.eclipse.xtext.xtext.generator.validation.ValidatorFragment2
@SingletonBinding(eager=true)
public Class<? extends MappingValidator> bindMappingValidator() {
return MappingValidator.class;
}
// contributed by org.eclipse.xtext.xtext.generator.scoping.ImportNamespacesScopingFragment2
public Class<? extends IScopeProvider> bindIScopeProvider() {
return MappingScopeProvider.class;
}
// contributed by org.eclipse.xtext.xtext.generator.scoping.ImportNamespacesScopingFragment2
public void configureIScopeProviderDelegate(Binder binder) {
binder.bind(IScopeProvider.class).annotatedWith(Names.named(AbstractDeclarativeScopeProvider.NAMED_DELEGATE)).to(ImportedNamespaceAwareLocalScopeProvider.class);
}
// contributed by org.eclipse.xtext.xtext.generator.scoping.ImportNamespacesScopingFragment2
public Class<? extends IGlobalScopeProvider> bindIGlobalScopeProvider() {
return DefaultGlobalScopeProvider.class;
}
// contributed by org.eclipse.xtext.xtext.generator.scoping.ImportNamespacesScopingFragment2
public void configureIgnoreCaseLinking(Binder binder) {
binder.bindConstant().annotatedWith(IgnoreCaseLinking.class).to(false);
}
// contributed by org.eclipse.xtext.xtext.generator.exporting.QualifiedNamesFragment2
public Class<? extends IQualifiedNameProvider> bindIQualifiedNameProvider() {
return DefaultDeclarativeQualifiedNameProvider.class;
}
// contributed by org.eclipse.xtext.xtext.generator.builder.BuilderIntegrationFragment2
public Class<? extends IContainer.Manager> bindIContainer$Manager() {
return StateBasedContainerManager.class;
}
// contributed by org.eclipse.xtext.xtext.generator.builder.BuilderIntegrationFragment2
public Class<? extends IAllContainersState.Provider> bindIAllContainersState$Provider() {
return ResourceSetBasedAllContainersStateProvider.class;
}
// contributed by org.eclipse.xtext.xtext.generator.builder.BuilderIntegrationFragment2
public void configureIResourceDescriptions(Binder binder) {
binder.bind(IResourceDescriptions.class).to(ResourceSetBasedResourceDescriptions.class);
}
// contributed by org.eclipse.xtext.xtext.generator.builder.BuilderIntegrationFragment2
public void configureIResourceDescriptionsPersisted(Binder binder) {
binder.bind(IResourceDescriptions.class).annotatedWith(Names.named(ResourceDescriptionsProvider.PERSISTED_DESCRIPTIONS)).to(ResourceSetBasedResourceDescriptions.class);
}
// contributed by org.eclipse.xtext.xtext.generator.generator.GeneratorFragment2
public Class<? extends IGenerator2> bindIGenerator2() {
return MappingGenerator.class;
}
// contributed by org.eclipse.xtext.xtext.generator.formatting.Formatter2Fragment2
public Class<? extends IFormatter2> bindIFormatter2() {
return MappingFormatter.class;
}
// contributed by org.eclipse.xtext.xtext.generator.formatting.Formatter2Fragment2
public void configureFormatterPreferences(Binder binder) {
binder.bind(IPreferenceValuesProvider.class).annotatedWith(FormatterPreferences.class).to(FormatterPreferenceValuesProvider.class);
}
// contributed by org.eclipse.xtext.xtext.generator.ecore2xtext.Ecore2XtextValueConverterServiceFragment2
public Class<? extends IValueConverterService> bindIValueConverterService() {
return Ecore2XtextTerminalConverters.class;
}
}

View File

@@ -0,0 +1,37 @@
/*
* generated by Xtext 2.12.0
*/
package com.irtsaintexupery.xtext.pseim;
import com.google.inject.Guice;
import com.google.inject.Injector;
import org.eclipse.emf.ecore.resource.Resource;
import org.eclipse.xtext.ISetup;
import org.eclipse.xtext.common.TerminalsStandaloneSetup;
import org.eclipse.xtext.resource.IResourceFactory;
import org.eclipse.xtext.resource.IResourceServiceProvider;
@SuppressWarnings("all")
public class MappingStandaloneSetupGenerated implements ISetup {
@Override
public Injector createInjectorAndDoEMFRegistration() {
TerminalsStandaloneSetup.doSetup();
Injector injector = createInjector();
register(injector);
return injector;
}
public Injector createInjector() {
return Guice.createInjector(new MappingRuntimeModule());
}
public void register(Injector injector) {
IResourceFactory resourceFactory = injector.getInstance(IResourceFactory.class);
IResourceServiceProvider serviceProvider = injector.getInstance(IResourceServiceProvider.class);
Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().put("mapping", resourceFactory);
IResourceServiceProvider.Registry.INSTANCE.getExtensionToFactoryMap().put("mapping", serviceProvider);
}
}

View File

@@ -0,0 +1,16 @@
/*
* generated by Xtext 2.12.0
*/
package com.irtsaintexupery.xtext.pseim.parser.antlr;
import java.io.InputStream;
import org.eclipse.xtext.parser.antlr.IAntlrTokenFileProvider;
public class MappingAntlrTokenFileProvider implements IAntlrTokenFileProvider {
@Override
public InputStream getAntlrTokenFile() {
ClassLoader classLoader = getClass().getClassLoader();
return classLoader.getResourceAsStream("com/irtsaintexupery/xtext/pseim/parser/antlr/internal/InternalMapping.tokens");
}
}

View File

@@ -0,0 +1,40 @@
/*
* generated by Xtext 2.12.0
*/
package com.irtsaintexupery.xtext.pseim.parser.antlr;
import com.google.inject.Inject;
import com.irtsaintexupery.xtext.pseim.parser.antlr.internal.InternalMappingParser;
import com.irtsaintexupery.xtext.pseim.services.MappingGrammarAccess;
import org.eclipse.xtext.parser.antlr.AbstractAntlrParser;
import org.eclipse.xtext.parser.antlr.XtextTokenStream;
public class MappingParser extends AbstractAntlrParser {
@Inject
private MappingGrammarAccess grammarAccess;
@Override
protected void setInitialHiddenTokens(XtextTokenStream tokenStream) {
tokenStream.setInitialHiddenTokens("RULE_WS", "RULE_ML_COMMENT", "RULE_SL_COMMENT");
}
@Override
protected InternalMappingParser createParser(XtextTokenStream stream) {
return new InternalMappingParser(stream, getGrammarAccess());
}
@Override
protected String getDefaultRuleName() {
return "PatternApplication";
}
public MappingGrammarAccess getGrammarAccess() {
return this.grammarAccess;
}
public void setGrammarAccess(MappingGrammarAccess grammarAccess) {
this.grammarAccess = grammarAccess;
}
}

View File

@@ -0,0 +1,553 @@
/*
* generated by Xtext 2.12.0
*/
grammar InternalMapping;
options {
superClass=AbstractInternalAntlrParser;
}
@lexer::header {
package com.irtsaintexupery.xtext.pseim.parser.antlr.internal;
// Hack: Use our own Lexer superclass by means of import.
// Currently there is no other way to specify the superclass for the lexer.
import org.eclipse.xtext.parser.antlr.Lexer;
}
@parser::header {
package com.irtsaintexupery.xtext.pseim.parser.antlr.internal;
import org.eclipse.xtext.*;
import org.eclipse.xtext.parser.*;
import org.eclipse.xtext.parser.impl.*;
import org.eclipse.emf.ecore.util.EcoreUtil;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.xtext.parser.antlr.AbstractInternalAntlrParser;
import org.eclipse.xtext.parser.antlr.XtextTokenStream;
import org.eclipse.xtext.parser.antlr.XtextTokenStream.HiddenTokens;
import org.eclipse.xtext.parser.antlr.AntlrDatatypeRuleToken;
import com.irtsaintexupery.xtext.pseim.services.MappingGrammarAccess;
}
@parser::members {
private MappingGrammarAccess grammarAccess;
public InternalMappingParser(TokenStream input, MappingGrammarAccess grammarAccess) {
this(input);
this.grammarAccess = grammarAccess;
registerRules(grammarAccess.getGrammar());
}
@Override
protected String getFirstRuleName() {
return "PatternApplication";
}
@Override
protected MappingGrammarAccess getGrammarAccess() {
return grammarAccess;
}
}
@rulecatch {
catch (RecognitionException re) {
recover(input,re);
appendSkippedTokens();
}
}
// Entry rule entryRulePatternApplication
entryRulePatternApplication returns [EObject current=null]:
{ newCompositeNode(grammarAccess.getPatternApplicationRule()); }
iv_rulePatternApplication=rulePatternApplication
{ $current=$iv_rulePatternApplication.current; }
EOF;
// Rule PatternApplication
rulePatternApplication returns [EObject current=null]
@init {
enterRule();
}
@after {
leaveRule();
}:
(
otherlv_0='transform'
{
newLeafNode(otherlv_0, grammarAccess.getPatternApplicationAccess().getTransformKeyword_0());
}
(
(
{
if ($current==null) {
$current = createModelElement(grammarAccess.getPatternApplicationRule());
}
}
otherlv_1=RULE_ID
{
newLeafNode(otherlv_1, grammarAccess.getPatternApplicationAccess().getModelModelCrossReference_1_0());
}
)
)
otherlv_2='using'
{
newLeafNode(otherlv_2, grammarAccess.getPatternApplicationAccess().getUsingKeyword_2());
}
(
(
{
if ($current==null) {
$current = createModelElement(grammarAccess.getPatternApplicationRule());
}
}
otherlv_3=RULE_ID
{
newLeafNode(otherlv_3, grammarAccess.getPatternApplicationAccess().getPatternPatternCrossReference_3_0());
}
)
)
otherlv_4='{'
{
newLeafNode(otherlv_4, grammarAccess.getPatternApplicationAccess().getLeftCurlyBracketKeyword_4());
}
(
otherlv_5='multiplicity'
{
newLeafNode(otherlv_5, grammarAccess.getPatternApplicationAccess().getMultiplicityKeyword_5_0());
}
(
(
{
newCompositeNode(grammarAccess.getPatternApplicationAccess().getCardinalityValuesCardinalityValueParserRuleCall_5_1_0());
}
lv_cardinalityValues_6_0=ruleCardinalityValue
{
if ($current==null) {
$current = createModelElementForParent(grammarAccess.getPatternApplicationRule());
}
add(
$current,
"cardinalityValues",
lv_cardinalityValues_6_0,
"com.irtsaintexupery.xtext.pseim.Mapping.CardinalityValue");
afterParserOrEnumRuleCall();
}
)
)
(
(
{
newCompositeNode(grammarAccess.getPatternApplicationAccess().getCardinalityValuesCardinalityValueParserRuleCall_5_2_0());
}
lv_cardinalityValues_7_0=ruleCardinalityValue
{
if ($current==null) {
$current = createModelElementForParent(grammarAccess.getPatternApplicationRule());
}
add(
$current,
"cardinalityValues",
lv_cardinalityValues_7_0,
"com.irtsaintexupery.xtext.pseim.Mapping.CardinalityValue");
afterParserOrEnumRuleCall();
}
)
)*
)?
(
otherlv_8='components'
{
newLeafNode(otherlv_8, grammarAccess.getPatternApplicationAccess().getComponentsKeyword_6_0());
}
(
(
{
newCompositeNode(grammarAccess.getPatternApplicationAccess().getModelElementGraphElementMappingParserRuleCall_6_1_0());
}
lv_modelElement_9_0=ruleGraphElementMapping
{
if ($current==null) {
$current = createModelElementForParent(grammarAccess.getPatternApplicationRule());
}
add(
$current,
"modelElement",
lv_modelElement_9_0,
"com.irtsaintexupery.xtext.pseim.Mapping.GraphElementMapping");
afterParserOrEnumRuleCall();
}
)
)
(
(
{
newCompositeNode(grammarAccess.getPatternApplicationAccess().getModelElementGraphElementMappingParserRuleCall_6_2_0());
}
lv_modelElement_10_0=ruleGraphElementMapping
{
if ($current==null) {
$current = createModelElementForParent(grammarAccess.getPatternApplicationRule());
}
add(
$current,
"modelElement",
lv_modelElement_10_0,
"com.irtsaintexupery.xtext.pseim.Mapping.GraphElementMapping");
afterParserOrEnumRuleCall();
}
)
)*
)?
(
otherlv_11='ports'
{
newLeafNode(otherlv_11, grammarAccess.getPatternApplicationAccess().getPortsKeyword_7_0());
}
(
(
{
newCompositeNode(grammarAccess.getPatternApplicationAccess().getPortMappingPortMappingParserRuleCall_7_1_0());
}
lv_portMapping_12_0=rulePortMapping
{
if ($current==null) {
$current = createModelElementForParent(grammarAccess.getPatternApplicationRule());
}
add(
$current,
"portMapping",
lv_portMapping_12_0,
"com.irtsaintexupery.xtext.pseim.Mapping.PortMapping");
afterParserOrEnumRuleCall();
}
)
)
(
(
{
newCompositeNode(grammarAccess.getPatternApplicationAccess().getPortMappingPortMappingParserRuleCall_7_2_0());
}
lv_portMapping_13_0=rulePortMapping
{
if ($current==null) {
$current = createModelElementForParent(grammarAccess.getPatternApplicationRule());
}
add(
$current,
"portMapping",
lv_portMapping_13_0,
"com.irtsaintexupery.xtext.pseim.Mapping.PortMapping");
afterParserOrEnumRuleCall();
}
)
)*
)?
otherlv_14='}'
{
newLeafNode(otherlv_14, grammarAccess.getPatternApplicationAccess().getRightCurlyBracketKeyword_8());
}
)
;
// Entry rule entryRuleCardinalityValue
entryRuleCardinalityValue returns [EObject current=null]:
{ newCompositeNode(grammarAccess.getCardinalityValueRule()); }
iv_ruleCardinalityValue=ruleCardinalityValue
{ $current=$iv_ruleCardinalityValue.current; }
EOF;
// Rule CardinalityValue
ruleCardinalityValue returns [EObject current=null]
@init {
enterRule();
}
@after {
leaveRule();
}:
(
(
(
{
if ($current==null) {
$current = createModelElement(grammarAccess.getCardinalityValueRule());
}
}
{
newCompositeNode(grammarAccess.getCardinalityValueAccess().getCardinalityElementCardinalityElementCrossReference_0_0());
}
ruleQualifiedID
{
afterParserOrEnumRuleCall();
}
)
)
otherlv_1='->'
{
newLeafNode(otherlv_1, grammarAccess.getCardinalityValueAccess().getHyphenMinusGreaterThanSignKeyword_1());
}
(
(
{
newCompositeNode(grammarAccess.getCardinalityValueAccess().getValueEIntParserRuleCall_2_0());
}
lv_value_2_0=ruleEInt
{
if ($current==null) {
$current = createModelElementForParent(grammarAccess.getCardinalityValueRule());
}
set(
$current,
"value",
lv_value_2_0,
"com.irtsaintexupery.xtext.pseim.Mapping.EInt");
afterParserOrEnumRuleCall();
}
)
)
)
;
// Entry rule entryRulePortMapping
entryRulePortMapping returns [EObject current=null]:
{ newCompositeNode(grammarAccess.getPortMappingRule()); }
iv_rulePortMapping=rulePortMapping
{ $current=$iv_rulePortMapping.current; }
EOF;
// Rule PortMapping
rulePortMapping returns [EObject current=null]
@init {
enterRule();
}
@after {
leaveRule();
}:
(
(
(
{
if ($current==null) {
$current = createModelElement(grammarAccess.getPortMappingRule());
}
}
{
newCompositeNode(grammarAccess.getPortMappingAccess().getModelPortBorderElementCrossReference_0_0());
}
ruleQualifiedID
{
afterParserOrEnumRuleCall();
}
)
)
(
otherlv_1=','
{
newLeafNode(otherlv_1, grammarAccess.getPortMappingAccess().getCommaKeyword_1_0());
}
(
(
{
if ($current==null) {
$current = createModelElement(grammarAccess.getPortMappingRule());
}
}
{
newCompositeNode(grammarAccess.getPortMappingAccess().getModelPortBorderElementCrossReference_1_1_0());
}
ruleQualifiedID
{
afterParserOrEnumRuleCall();
}
)
)
)*
otherlv_3='->'
{
newLeafNode(otherlv_3, grammarAccess.getPortMappingAccess().getHyphenMinusGreaterThanSignKeyword_2());
}
(
(
{
if ($current==null) {
$current = createModelElement(grammarAccess.getPortMappingRule());
}
}
{
newCompositeNode(grammarAccess.getPortMappingAccess().getPatternPortBorderElementCrossReference_3_0());
}
ruleQualifiedID
{
afterParserOrEnumRuleCall();
}
)
)
)
;
// Entry rule entryRuleGraphElementMapping
entryRuleGraphElementMapping returns [EObject current=null]:
{ newCompositeNode(grammarAccess.getGraphElementMappingRule()); }
iv_ruleGraphElementMapping=ruleGraphElementMapping
{ $current=$iv_ruleGraphElementMapping.current; }
EOF;
// Rule GraphElementMapping
ruleGraphElementMapping returns [EObject current=null]
@init {
enterRule();
}
@after {
leaveRule();
}:
(
(
(
{
if ($current==null) {
$current = createModelElement(grammarAccess.getGraphElementMappingRule());
}
}
{
newCompositeNode(grammarAccess.getGraphElementMappingAccess().getModelGraphElementGraphElementCrossReference_0_0());
}
ruleQualifiedID
{
afterParserOrEnumRuleCall();
}
)
)
(
otherlv_1=','
{
newLeafNode(otherlv_1, grammarAccess.getGraphElementMappingAccess().getCommaKeyword_1_0());
}
(
(
{
if ($current==null) {
$current = createModelElement(grammarAccess.getGraphElementMappingRule());
}
}
{
newCompositeNode(grammarAccess.getGraphElementMappingAccess().getModelGraphElementGraphElementCrossReference_1_1_0());
}
ruleQualifiedID
{
afterParserOrEnumRuleCall();
}
)
)
)*
otherlv_3='->'
{
newLeafNode(otherlv_3, grammarAccess.getGraphElementMappingAccess().getHyphenMinusGreaterThanSignKeyword_2());
}
(
(
{
if ($current==null) {
$current = createModelElement(grammarAccess.getGraphElementMappingRule());
}
}
{
newCompositeNode(grammarAccess.getGraphElementMappingAccess().getPatternGraphElementGraphElementCrossReference_3_0());
}
ruleQualifiedID
{
afterParserOrEnumRuleCall();
}
)
)
)
;
// Entry rule entryRuleEInt
entryRuleEInt returns [String current=null]:
{ newCompositeNode(grammarAccess.getEIntRule()); }
iv_ruleEInt=ruleEInt
{ $current=$iv_ruleEInt.current.getText(); }
EOF;
// Rule EInt
ruleEInt returns [AntlrDatatypeRuleToken current=new AntlrDatatypeRuleToken()]
@init {
enterRule();
}
@after {
leaveRule();
}:
(
(
kw='-'
{
$current.merge(kw);
newLeafNode(kw, grammarAccess.getEIntAccess().getHyphenMinusKeyword_0());
}
)?
this_INT_1=RULE_INT
{
$current.merge(this_INT_1);
}
{
newLeafNode(this_INT_1, grammarAccess.getEIntAccess().getINTTerminalRuleCall_1());
}
)
;
// Entry rule entryRuleQualifiedID
entryRuleQualifiedID returns [String current=null]:
{ newCompositeNode(grammarAccess.getQualifiedIDRule()); }
iv_ruleQualifiedID=ruleQualifiedID
{ $current=$iv_ruleQualifiedID.current.getText(); }
EOF;
// Rule QualifiedID
ruleQualifiedID returns [AntlrDatatypeRuleToken current=new AntlrDatatypeRuleToken()]
@init {
enterRule();
}
@after {
leaveRule();
}:
(
this_ID_0=RULE_ID
{
$current.merge(this_ID_0);
}
{
newLeafNode(this_ID_0, grammarAccess.getQualifiedIDAccess().getIDTerminalRuleCall_0());
}
(
kw='.'
{
$current.merge(kw);
newLeafNode(kw, grammarAccess.getQualifiedIDAccess().getFullStopKeyword_1_0());
}
this_ID_2=RULE_ID
{
$current.merge(this_ID_2);
}
{
newLeafNode(this_ID_2, grammarAccess.getQualifiedIDAccess().getIDTerminalRuleCall_1_1());
}
)*
)
;
RULE_ID : '^'? ('a'..'z'|'A'..'Z'|'_') ('a'..'z'|'A'..'Z'|'_'|'0'..'9')*;
RULE_INT : ('0'..'9')+;
RULE_STRING : ('"' ('\\' .|~(('\\'|'"')))* '"'|'\'' ('\\' .|~(('\\'|'\'')))* '\'');
RULE_ML_COMMENT : '/*' ( options {greedy=false;} : . )*'*/';
RULE_SL_COMMENT : '//' ~(('\n'|'\r'))* ('\r'? '\n')?;
RULE_WS : (' '|'\t'|'\r'|'\n')+;
RULE_ANY_OTHER : .;

View File

@@ -0,0 +1,29 @@
','=19
'-'=20
'->'=18
'.'=21
'components'=15
'multiplicity'=14
'ports'=16
'transform'=11
'using'=12
'{'=13
'}'=17
RULE_ANY_OTHER=10
RULE_ID=4
RULE_INT=5
RULE_ML_COMMENT=7
RULE_SL_COMMENT=8
RULE_STRING=6
RULE_WS=9
T__11=11
T__12=12
T__13=13
T__14=14
T__15=15
T__16=16
T__17=17
T__18=18
T__19=19
T__20=20
T__21=21

View File

@@ -0,0 +1,9 @@
/*
* generated by Xtext 2.12.0
*/
package com.irtsaintexupery.xtext.pseim.scoping;
import org.eclipse.xtext.scoping.impl.DelegatingScopeProvider;
public abstract class AbstractMappingScopeProvider extends DelegatingScopeProvider {
}

View File

@@ -0,0 +1,118 @@
/*
* generated by Xtext 2.12.0
*/
package com.irtsaintexupery.xtext.pseim.serializer;
import com.google.inject.Inject;
import com.irtsaintexupery.pseim.mapping.CardinalityValue;
import com.irtsaintexupery.pseim.mapping.GraphElementMapping;
import com.irtsaintexupery.pseim.mapping.MappingPackage;
import com.irtsaintexupery.pseim.mapping.PatternApplication;
import com.irtsaintexupery.pseim.mapping.PortMapping;
import com.irtsaintexupery.xtext.pseim.services.MappingGrammarAccess;
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;
@SuppressWarnings("all")
public class MappingSemanticSequencer extends AbstractDelegatingSemanticSequencer {
@Inject
private MappingGrammarAccess 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 == MappingPackage.eINSTANCE)
switch (semanticObject.eClass().getClassifierID()) {
case MappingPackage.CARDINALITY_VALUE:
sequence_CardinalityValue(context, (CardinalityValue) semanticObject);
return;
case MappingPackage.GRAPH_ELEMENT_MAPPING:
sequence_GraphElementMapping(context, (GraphElementMapping) semanticObject);
return;
case MappingPackage.PATTERN_APPLICATION:
sequence_PatternApplication(context, (PatternApplication) semanticObject);
return;
case MappingPackage.PORT_MAPPING:
sequence_PortMapping(context, (PortMapping) semanticObject);
return;
}
if (errorAcceptor != null)
errorAcceptor.accept(diagnosticProvider.createInvalidContextOrTypeDiagnostic(semanticObject, context));
}
/**
* Contexts:
* CardinalityValue returns CardinalityValue
*
* Constraint:
* (cardinalityElement=[CardinalityElement|QualifiedID] value=EInt)
*/
protected void sequence_CardinalityValue(ISerializationContext context, CardinalityValue semanticObject) {
if (errorAcceptor != null) {
if (transientValues.isValueTransient(semanticObject, MappingPackage.Literals.CARDINALITY_VALUE__CARDINALITY_ELEMENT) == ValueTransient.YES)
errorAcceptor.accept(diagnosticProvider.createFeatureValueMissing(semanticObject, MappingPackage.Literals.CARDINALITY_VALUE__CARDINALITY_ELEMENT));
if (transientValues.isValueTransient(semanticObject, MappingPackage.Literals.CARDINALITY_VALUE__VALUE) == ValueTransient.YES)
errorAcceptor.accept(diagnosticProvider.createFeatureValueMissing(semanticObject, MappingPackage.Literals.CARDINALITY_VALUE__VALUE));
}
SequenceFeeder feeder = createSequencerFeeder(context, semanticObject);
feeder.accept(grammarAccess.getCardinalityValueAccess().getCardinalityElementCardinalityElementQualifiedIDParserRuleCall_0_0_1(), semanticObject.eGet(MappingPackage.Literals.CARDINALITY_VALUE__CARDINALITY_ELEMENT, false));
feeder.accept(grammarAccess.getCardinalityValueAccess().getValueEIntParserRuleCall_2_0(), semanticObject.getValue());
feeder.finish();
}
/**
* Contexts:
* GraphElementMapping returns GraphElementMapping
*
* Constraint:
* (modelGraphElement+=[GraphElement|QualifiedID] modelGraphElement+=[GraphElement|QualifiedID]* patternGraphElement=[GraphElement|QualifiedID])
*/
protected void sequence_GraphElementMapping(ISerializationContext context, GraphElementMapping semanticObject) {
genericSequencer.createSequence(context, semanticObject);
}
/**
* Contexts:
* PatternApplication returns PatternApplication
*
* Constraint:
* (
* model=[Model|ID]
* pattern=[Pattern|ID]
* (cardinalityValues+=CardinalityValue cardinalityValues+=CardinalityValue*)?
* (modelElement+=GraphElementMapping modelElement+=GraphElementMapping*)?
* (portMapping+=PortMapping portMapping+=PortMapping*)?
* )
*/
protected void sequence_PatternApplication(ISerializationContext context, PatternApplication semanticObject) {
genericSequencer.createSequence(context, semanticObject);
}
/**
* Contexts:
* PortMapping returns PortMapping
*
* Constraint:
* (modelPort+=[BorderElement|QualifiedID] modelPort+=[BorderElement|QualifiedID]* patternPort=[BorderElement|QualifiedID])
*/
protected void sequence_PortMapping(ISerializationContext context, PortMapping semanticObject) {
genericSequencer.createSequence(context, semanticObject);
}
}

View File

@@ -0,0 +1,43 @@
/*
* generated by Xtext 2.12.0
*/
package com.irtsaintexupery.xtext.pseim.serializer;
import com.google.inject.Inject;
import com.irtsaintexupery.xtext.pseim.services.MappingGrammarAccess;
import java.util.List;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.xtext.IGrammarAccess;
import org.eclipse.xtext.RuleCall;
import org.eclipse.xtext.nodemodel.INode;
import org.eclipse.xtext.serializer.analysis.GrammarAlias.AbstractElementAlias;
import org.eclipse.xtext.serializer.analysis.ISyntacticSequencerPDAProvider.ISynTransition;
import org.eclipse.xtext.serializer.sequencer.AbstractSyntacticSequencer;
@SuppressWarnings("all")
public class MappingSyntacticSequencer extends AbstractSyntacticSequencer {
protected MappingGrammarAccess grammarAccess;
@Inject
protected void init(IGrammarAccess access) {
grammarAccess = (MappingGrammarAccess) access;
}
@Override
protected String getUnassignedRuleCallToken(EObject semanticObject, RuleCall ruleCall, INode node) {
return "";
}
@Override
protected void emitUnassignedTokens(EObject semanticObject, ISynTransition transition, INode fromNode, INode toNode) {
if (transition.getAmbiguousSyntaxes().isEmpty()) return;
List<INode> transitionNodes = collectNodes(fromNode, toNode);
for (AbstractElementAlias syntax : transition.getAmbiguousSyntaxes()) {
List<INode> syntaxNodes = getNodesFor(transitionNodes, syntax);
acceptNodes(getLastNavigableState(), syntaxNodes);
}
}
}

View File

@@ -0,0 +1,522 @@
/*
* generated by Xtext 2.12.0
*/
package com.irtsaintexupery.xtext.pseim.services;
import com.google.inject.Inject;
import com.google.inject.Singleton;
import java.util.List;
import org.eclipse.xtext.Assignment;
import org.eclipse.xtext.CrossReference;
import org.eclipse.xtext.Grammar;
import org.eclipse.xtext.GrammarUtil;
import org.eclipse.xtext.Group;
import org.eclipse.xtext.Keyword;
import org.eclipse.xtext.ParserRule;
import org.eclipse.xtext.RuleCall;
import org.eclipse.xtext.TerminalRule;
import org.eclipse.xtext.common.services.TerminalsGrammarAccess;
import org.eclipse.xtext.service.AbstractElementFinder.AbstractGrammarElementFinder;
import org.eclipse.xtext.service.GrammarProvider;
@Singleton
public class MappingGrammarAccess extends AbstractGrammarElementFinder {
public class PatternApplicationElements extends AbstractParserRuleElementFinder {
private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "com.irtsaintexupery.xtext.pseim.Mapping.PatternApplication");
private final Group cGroup = (Group)rule.eContents().get(1);
private final Keyword cTransformKeyword_0 = (Keyword)cGroup.eContents().get(0);
private final Assignment cModelAssignment_1 = (Assignment)cGroup.eContents().get(1);
private final CrossReference cModelModelCrossReference_1_0 = (CrossReference)cModelAssignment_1.eContents().get(0);
private final RuleCall cModelModelIDTerminalRuleCall_1_0_1 = (RuleCall)cModelModelCrossReference_1_0.eContents().get(1);
private final Keyword cUsingKeyword_2 = (Keyword)cGroup.eContents().get(2);
private final Assignment cPatternAssignment_3 = (Assignment)cGroup.eContents().get(3);
private final CrossReference cPatternPatternCrossReference_3_0 = (CrossReference)cPatternAssignment_3.eContents().get(0);
private final RuleCall cPatternPatternIDTerminalRuleCall_3_0_1 = (RuleCall)cPatternPatternCrossReference_3_0.eContents().get(1);
private final Keyword cLeftCurlyBracketKeyword_4 = (Keyword)cGroup.eContents().get(4);
private final Group cGroup_5 = (Group)cGroup.eContents().get(5);
private final Keyword cMultiplicityKeyword_5_0 = (Keyword)cGroup_5.eContents().get(0);
private final Assignment cCardinalityValuesAssignment_5_1 = (Assignment)cGroup_5.eContents().get(1);
private final RuleCall cCardinalityValuesCardinalityValueParserRuleCall_5_1_0 = (RuleCall)cCardinalityValuesAssignment_5_1.eContents().get(0);
private final Assignment cCardinalityValuesAssignment_5_2 = (Assignment)cGroup_5.eContents().get(2);
private final RuleCall cCardinalityValuesCardinalityValueParserRuleCall_5_2_0 = (RuleCall)cCardinalityValuesAssignment_5_2.eContents().get(0);
private final Group cGroup_6 = (Group)cGroup.eContents().get(6);
private final Keyword cComponentsKeyword_6_0 = (Keyword)cGroup_6.eContents().get(0);
private final Assignment cModelElementAssignment_6_1 = (Assignment)cGroup_6.eContents().get(1);
private final RuleCall cModelElementGraphElementMappingParserRuleCall_6_1_0 = (RuleCall)cModelElementAssignment_6_1.eContents().get(0);
private final Assignment cModelElementAssignment_6_2 = (Assignment)cGroup_6.eContents().get(2);
private final RuleCall cModelElementGraphElementMappingParserRuleCall_6_2_0 = (RuleCall)cModelElementAssignment_6_2.eContents().get(0);
private final Group cGroup_7 = (Group)cGroup.eContents().get(7);
private final Keyword cPortsKeyword_7_0 = (Keyword)cGroup_7.eContents().get(0);
private final Assignment cPortMappingAssignment_7_1 = (Assignment)cGroup_7.eContents().get(1);
private final RuleCall cPortMappingPortMappingParserRuleCall_7_1_0 = (RuleCall)cPortMappingAssignment_7_1.eContents().get(0);
private final Assignment cPortMappingAssignment_7_2 = (Assignment)cGroup_7.eContents().get(2);
private final RuleCall cPortMappingPortMappingParserRuleCall_7_2_0 = (RuleCall)cPortMappingAssignment_7_2.eContents().get(0);
private final Keyword cRightCurlyBracketKeyword_8 = (Keyword)cGroup.eContents().get(8);
//PatternApplication mapping::PatternApplication:
// 'transform' model=[seim::Model] 'using' pattern=[pseim::Pattern] '{' ('multiplicity'
// cardinalityValues+=CardinalityValue cardinalityValues+=CardinalityValue*)? ('components'
// modelElement+=GraphElementMapping modelElement+=GraphElementMapping*)? ('ports' portMapping+=PortMapping
// portMapping+=PortMapping*)?
// '}';
@Override public ParserRule getRule() { return rule; }
//'transform' model=[seim::Model] 'using' pattern=[pseim::Pattern] '{' ('multiplicity' cardinalityValues+=CardinalityValue
//cardinalityValues+=CardinalityValue*)? ('components' modelElement+=GraphElementMapping
//modelElement+=GraphElementMapping*)? ('ports' portMapping+=PortMapping portMapping+=PortMapping*)? '}'
public Group getGroup() { return cGroup; }
//'transform'
public Keyword getTransformKeyword_0() { return cTransformKeyword_0; }
//model=[seim::Model]
public Assignment getModelAssignment_1() { return cModelAssignment_1; }
//[seim::Model]
public CrossReference getModelModelCrossReference_1_0() { return cModelModelCrossReference_1_0; }
//ID
public RuleCall getModelModelIDTerminalRuleCall_1_0_1() { return cModelModelIDTerminalRuleCall_1_0_1; }
//'using'
public Keyword getUsingKeyword_2() { return cUsingKeyword_2; }
//pattern=[pseim::Pattern]
public Assignment getPatternAssignment_3() { return cPatternAssignment_3; }
//[pseim::Pattern]
public CrossReference getPatternPatternCrossReference_3_0() { return cPatternPatternCrossReference_3_0; }
//ID
public RuleCall getPatternPatternIDTerminalRuleCall_3_0_1() { return cPatternPatternIDTerminalRuleCall_3_0_1; }
//'{'
public Keyword getLeftCurlyBracketKeyword_4() { return cLeftCurlyBracketKeyword_4; }
//('multiplicity' cardinalityValues+=CardinalityValue cardinalityValues+=CardinalityValue*)?
public Group getGroup_5() { return cGroup_5; }
//'multiplicity'
public Keyword getMultiplicityKeyword_5_0() { return cMultiplicityKeyword_5_0; }
//cardinalityValues+=CardinalityValue
public Assignment getCardinalityValuesAssignment_5_1() { return cCardinalityValuesAssignment_5_1; }
//CardinalityValue
public RuleCall getCardinalityValuesCardinalityValueParserRuleCall_5_1_0() { return cCardinalityValuesCardinalityValueParserRuleCall_5_1_0; }
//cardinalityValues+=CardinalityValue*
public Assignment getCardinalityValuesAssignment_5_2() { return cCardinalityValuesAssignment_5_2; }
//CardinalityValue
public RuleCall getCardinalityValuesCardinalityValueParserRuleCall_5_2_0() { return cCardinalityValuesCardinalityValueParserRuleCall_5_2_0; }
//('components' modelElement+=GraphElementMapping modelElement+=GraphElementMapping*)?
public Group getGroup_6() { return cGroup_6; }
//'components'
public Keyword getComponentsKeyword_6_0() { return cComponentsKeyword_6_0; }
//modelElement+=GraphElementMapping
public Assignment getModelElementAssignment_6_1() { return cModelElementAssignment_6_1; }
//GraphElementMapping
public RuleCall getModelElementGraphElementMappingParserRuleCall_6_1_0() { return cModelElementGraphElementMappingParserRuleCall_6_1_0; }
//modelElement+=GraphElementMapping*
public Assignment getModelElementAssignment_6_2() { return cModelElementAssignment_6_2; }
//GraphElementMapping
public RuleCall getModelElementGraphElementMappingParserRuleCall_6_2_0() { return cModelElementGraphElementMappingParserRuleCall_6_2_0; }
//('ports' portMapping+=PortMapping portMapping+=PortMapping*)?
public Group getGroup_7() { return cGroup_7; }
//'ports'
public Keyword getPortsKeyword_7_0() { return cPortsKeyword_7_0; }
//portMapping+=PortMapping
public Assignment getPortMappingAssignment_7_1() { return cPortMappingAssignment_7_1; }
//PortMapping
public RuleCall getPortMappingPortMappingParserRuleCall_7_1_0() { return cPortMappingPortMappingParserRuleCall_7_1_0; }
//portMapping+=PortMapping*
public Assignment getPortMappingAssignment_7_2() { return cPortMappingAssignment_7_2; }
//PortMapping
public RuleCall getPortMappingPortMappingParserRuleCall_7_2_0() { return cPortMappingPortMappingParserRuleCall_7_2_0; }
//'}'
public Keyword getRightCurlyBracketKeyword_8() { return cRightCurlyBracketKeyword_8; }
}
public class CardinalityValueElements extends AbstractParserRuleElementFinder {
private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "com.irtsaintexupery.xtext.pseim.Mapping.CardinalityValue");
private final Group cGroup = (Group)rule.eContents().get(1);
private final Assignment cCardinalityElementAssignment_0 = (Assignment)cGroup.eContents().get(0);
private final CrossReference cCardinalityElementCardinalityElementCrossReference_0_0 = (CrossReference)cCardinalityElementAssignment_0.eContents().get(0);
private final RuleCall cCardinalityElementCardinalityElementQualifiedIDParserRuleCall_0_0_1 = (RuleCall)cCardinalityElementCardinalityElementCrossReference_0_0.eContents().get(1);
private final Keyword cHyphenMinusGreaterThanSignKeyword_1 = (Keyword)cGroup.eContents().get(1);
private final Assignment cValueAssignment_2 = (Assignment)cGroup.eContents().get(2);
private final RuleCall cValueEIntParserRuleCall_2_0 = (RuleCall)cValueAssignment_2.eContents().get(0);
//CardinalityValue mapping::CardinalityValue:
// cardinalityElement=[pseim::CardinalityElement|QualifiedID] '->' value=EInt;
@Override public ParserRule getRule() { return rule; }
//cardinalityElement=[pseim::CardinalityElement|QualifiedID] '->' value=EInt
public Group getGroup() { return cGroup; }
//cardinalityElement=[pseim::CardinalityElement|QualifiedID]
public Assignment getCardinalityElementAssignment_0() { return cCardinalityElementAssignment_0; }
//[pseim::CardinalityElement|QualifiedID]
public CrossReference getCardinalityElementCardinalityElementCrossReference_0_0() { return cCardinalityElementCardinalityElementCrossReference_0_0; }
//QualifiedID
public RuleCall getCardinalityElementCardinalityElementQualifiedIDParserRuleCall_0_0_1() { return cCardinalityElementCardinalityElementQualifiedIDParserRuleCall_0_0_1; }
//'->'
public Keyword getHyphenMinusGreaterThanSignKeyword_1() { return cHyphenMinusGreaterThanSignKeyword_1; }
//value=EInt
public Assignment getValueAssignment_2() { return cValueAssignment_2; }
//EInt
public RuleCall getValueEIntParserRuleCall_2_0() { return cValueEIntParserRuleCall_2_0; }
}
public class PortMappingElements extends AbstractParserRuleElementFinder {
private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "com.irtsaintexupery.xtext.pseim.Mapping.PortMapping");
private final Group cGroup = (Group)rule.eContents().get(1);
private final Assignment cModelPortAssignment_0 = (Assignment)cGroup.eContents().get(0);
private final CrossReference cModelPortBorderElementCrossReference_0_0 = (CrossReference)cModelPortAssignment_0.eContents().get(0);
private final RuleCall cModelPortBorderElementQualifiedIDParserRuleCall_0_0_1 = (RuleCall)cModelPortBorderElementCrossReference_0_0.eContents().get(1);
private final Group cGroup_1 = (Group)cGroup.eContents().get(1);
private final Keyword cCommaKeyword_1_0 = (Keyword)cGroup_1.eContents().get(0);
private final Assignment cModelPortAssignment_1_1 = (Assignment)cGroup_1.eContents().get(1);
private final CrossReference cModelPortBorderElementCrossReference_1_1_0 = (CrossReference)cModelPortAssignment_1_1.eContents().get(0);
private final RuleCall cModelPortBorderElementQualifiedIDParserRuleCall_1_1_0_1 = (RuleCall)cModelPortBorderElementCrossReference_1_1_0.eContents().get(1);
private final Keyword cHyphenMinusGreaterThanSignKeyword_2 = (Keyword)cGroup.eContents().get(2);
private final Assignment cPatternPortAssignment_3 = (Assignment)cGroup.eContents().get(3);
private final CrossReference cPatternPortBorderElementCrossReference_3_0 = (CrossReference)cPatternPortAssignment_3.eContents().get(0);
private final RuleCall cPatternPortBorderElementQualifiedIDParserRuleCall_3_0_1 = (RuleCall)cPatternPortBorderElementCrossReference_3_0.eContents().get(1);
//PortMapping mapping::PortMapping:
// modelPort+=[seim::BorderElement|QualifiedID] (',' modelPort+=[seim::BorderElement|QualifiedID])*
// '->'
// patternPort=[seim::BorderElement|QualifiedID];
@Override public ParserRule getRule() { return rule; }
//modelPort+=[seim::BorderElement|QualifiedID] (',' modelPort+=[seim::BorderElement|QualifiedID])* '->'
//patternPort=[seim::BorderElement|QualifiedID]
public Group getGroup() { return cGroup; }
//modelPort+=[seim::BorderElement|QualifiedID]
public Assignment getModelPortAssignment_0() { return cModelPortAssignment_0; }
//[seim::BorderElement|QualifiedID]
public CrossReference getModelPortBorderElementCrossReference_0_0() { return cModelPortBorderElementCrossReference_0_0; }
//QualifiedID
public RuleCall getModelPortBorderElementQualifiedIDParserRuleCall_0_0_1() { return cModelPortBorderElementQualifiedIDParserRuleCall_0_0_1; }
//(',' modelPort+=[seim::BorderElement|QualifiedID])*
public Group getGroup_1() { return cGroup_1; }
//','
public Keyword getCommaKeyword_1_0() { return cCommaKeyword_1_0; }
//modelPort+=[seim::BorderElement|QualifiedID]
public Assignment getModelPortAssignment_1_1() { return cModelPortAssignment_1_1; }
//[seim::BorderElement|QualifiedID]
public CrossReference getModelPortBorderElementCrossReference_1_1_0() { return cModelPortBorderElementCrossReference_1_1_0; }
//QualifiedID
public RuleCall getModelPortBorderElementQualifiedIDParserRuleCall_1_1_0_1() { return cModelPortBorderElementQualifiedIDParserRuleCall_1_1_0_1; }
//'->'
public Keyword getHyphenMinusGreaterThanSignKeyword_2() { return cHyphenMinusGreaterThanSignKeyword_2; }
//patternPort=[seim::BorderElement|QualifiedID]
public Assignment getPatternPortAssignment_3() { return cPatternPortAssignment_3; }
//[seim::BorderElement|QualifiedID]
public CrossReference getPatternPortBorderElementCrossReference_3_0() { return cPatternPortBorderElementCrossReference_3_0; }
//QualifiedID
public RuleCall getPatternPortBorderElementQualifiedIDParserRuleCall_3_0_1() { return cPatternPortBorderElementQualifiedIDParserRuleCall_3_0_1; }
}
public class GraphElementMappingElements extends AbstractParserRuleElementFinder {
private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "com.irtsaintexupery.xtext.pseim.Mapping.GraphElementMapping");
private final Group cGroup = (Group)rule.eContents().get(1);
private final Assignment cModelGraphElementAssignment_0 = (Assignment)cGroup.eContents().get(0);
private final CrossReference cModelGraphElementGraphElementCrossReference_0_0 = (CrossReference)cModelGraphElementAssignment_0.eContents().get(0);
private final RuleCall cModelGraphElementGraphElementQualifiedIDParserRuleCall_0_0_1 = (RuleCall)cModelGraphElementGraphElementCrossReference_0_0.eContents().get(1);
private final Group cGroup_1 = (Group)cGroup.eContents().get(1);
private final Keyword cCommaKeyword_1_0 = (Keyword)cGroup_1.eContents().get(0);
private final Assignment cModelGraphElementAssignment_1_1 = (Assignment)cGroup_1.eContents().get(1);
private final CrossReference cModelGraphElementGraphElementCrossReference_1_1_0 = (CrossReference)cModelGraphElementAssignment_1_1.eContents().get(0);
private final RuleCall cModelGraphElementGraphElementQualifiedIDParserRuleCall_1_1_0_1 = (RuleCall)cModelGraphElementGraphElementCrossReference_1_1_0.eContents().get(1);
private final Keyword cHyphenMinusGreaterThanSignKeyword_2 = (Keyword)cGroup.eContents().get(2);
private final Assignment cPatternGraphElementAssignment_3 = (Assignment)cGroup.eContents().get(3);
private final CrossReference cPatternGraphElementGraphElementCrossReference_3_0 = (CrossReference)cPatternGraphElementAssignment_3.eContents().get(0);
private final RuleCall cPatternGraphElementGraphElementQualifiedIDParserRuleCall_3_0_1 = (RuleCall)cPatternGraphElementGraphElementCrossReference_3_0.eContents().get(1);
//GraphElementMapping mapping::GraphElementMapping:
// modelGraphElement+=[seim::GraphElement|QualifiedID] (',' modelGraphElement+=[seim::GraphElement|QualifiedID])*
// '->'
// patternGraphElement=[seim::GraphElement|QualifiedID];
@Override public ParserRule getRule() { return rule; }
//modelGraphElement+=[seim::GraphElement|QualifiedID] (',' modelGraphElement+=[seim::GraphElement|QualifiedID])* '->'
//patternGraphElement=[seim::GraphElement|QualifiedID]
public Group getGroup() { return cGroup; }
//modelGraphElement+=[seim::GraphElement|QualifiedID]
public Assignment getModelGraphElementAssignment_0() { return cModelGraphElementAssignment_0; }
//[seim::GraphElement|QualifiedID]
public CrossReference getModelGraphElementGraphElementCrossReference_0_0() { return cModelGraphElementGraphElementCrossReference_0_0; }
//QualifiedID
public RuleCall getModelGraphElementGraphElementQualifiedIDParserRuleCall_0_0_1() { return cModelGraphElementGraphElementQualifiedIDParserRuleCall_0_0_1; }
//(',' modelGraphElement+=[seim::GraphElement|QualifiedID])*
public Group getGroup_1() { return cGroup_1; }
//','
public Keyword getCommaKeyword_1_0() { return cCommaKeyword_1_0; }
//modelGraphElement+=[seim::GraphElement|QualifiedID]
public Assignment getModelGraphElementAssignment_1_1() { return cModelGraphElementAssignment_1_1; }
//[seim::GraphElement|QualifiedID]
public CrossReference getModelGraphElementGraphElementCrossReference_1_1_0() { return cModelGraphElementGraphElementCrossReference_1_1_0; }
//QualifiedID
public RuleCall getModelGraphElementGraphElementQualifiedIDParserRuleCall_1_1_0_1() { return cModelGraphElementGraphElementQualifiedIDParserRuleCall_1_1_0_1; }
//'->'
public Keyword getHyphenMinusGreaterThanSignKeyword_2() { return cHyphenMinusGreaterThanSignKeyword_2; }
//patternGraphElement=[seim::GraphElement|QualifiedID]
public Assignment getPatternGraphElementAssignment_3() { return cPatternGraphElementAssignment_3; }
//[seim::GraphElement|QualifiedID]
public CrossReference getPatternGraphElementGraphElementCrossReference_3_0() { return cPatternGraphElementGraphElementCrossReference_3_0; }
//QualifiedID
public RuleCall getPatternGraphElementGraphElementQualifiedIDParserRuleCall_3_0_1() { return cPatternGraphElementGraphElementQualifiedIDParserRuleCall_3_0_1; }
}
public class EIntElements extends AbstractParserRuleElementFinder {
private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "com.irtsaintexupery.xtext.pseim.Mapping.EInt");
private final Group cGroup = (Group)rule.eContents().get(1);
private final Keyword cHyphenMinusKeyword_0 = (Keyword)cGroup.eContents().get(0);
private final RuleCall cINTTerminalRuleCall_1 = (RuleCall)cGroup.eContents().get(1);
//EInt ecore::EInt:
// '-'? INT;
@Override public ParserRule getRule() { return rule; }
//'-'? INT
public Group getGroup() { return cGroup; }
//'-'?
public Keyword getHyphenMinusKeyword_0() { return cHyphenMinusKeyword_0; }
//INT
public RuleCall getINTTerminalRuleCall_1() { return cINTTerminalRuleCall_1; }
}
public class QualifiedIDElements extends AbstractParserRuleElementFinder {
private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "com.irtsaintexupery.xtext.pseim.Mapping.QualifiedID");
private final Group cGroup = (Group)rule.eContents().get(1);
private final RuleCall cIDTerminalRuleCall_0 = (RuleCall)cGroup.eContents().get(0);
private final Group cGroup_1 = (Group)cGroup.eContents().get(1);
private final Keyword cFullStopKeyword_1_0 = (Keyword)cGroup_1.eContents().get(0);
private final RuleCall cIDTerminalRuleCall_1_1 = (RuleCall)cGroup_1.eContents().get(1);
//QualifiedID:
// ID ('.' ID)*;
@Override public ParserRule getRule() { return rule; }
//ID ('.' ID)*
public Group getGroup() { return cGroup; }
//ID
public RuleCall getIDTerminalRuleCall_0() { return cIDTerminalRuleCall_0; }
//('.' ID)*
public Group getGroup_1() { return cGroup_1; }
//'.'
public Keyword getFullStopKeyword_1_0() { return cFullStopKeyword_1_0; }
//ID
public RuleCall getIDTerminalRuleCall_1_1() { return cIDTerminalRuleCall_1_1; }
}
private final PatternApplicationElements pPatternApplication;
private final CardinalityValueElements pCardinalityValue;
private final PortMappingElements pPortMapping;
private final GraphElementMappingElements pGraphElementMapping;
private final EIntElements pEInt;
private final QualifiedIDElements pQualifiedID;
private final Grammar grammar;
private final TerminalsGrammarAccess gaTerminals;
@Inject
public MappingGrammarAccess(GrammarProvider grammarProvider,
TerminalsGrammarAccess gaTerminals) {
this.grammar = internalFindGrammar(grammarProvider);
this.gaTerminals = gaTerminals;
this.pPatternApplication = new PatternApplicationElements();
this.pCardinalityValue = new CardinalityValueElements();
this.pPortMapping = new PortMappingElements();
this.pGraphElementMapping = new GraphElementMappingElements();
this.pEInt = new EIntElements();
this.pQualifiedID = new QualifiedIDElements();
}
protected Grammar internalFindGrammar(GrammarProvider grammarProvider) {
Grammar grammar = grammarProvider.getGrammar(this);
while (grammar != null) {
if ("com.irtsaintexupery.xtext.pseim.Mapping".equals(grammar.getName())) {
return grammar;
}
List<Grammar> grammars = grammar.getUsedGrammars();
if (!grammars.isEmpty()) {
grammar = grammars.iterator().next();
} else {
return null;
}
}
return grammar;
}
@Override
public Grammar getGrammar() {
return grammar;
}
public TerminalsGrammarAccess getTerminalsGrammarAccess() {
return gaTerminals;
}
//PatternApplication mapping::PatternApplication:
// 'transform' model=[seim::Model] 'using' pattern=[pseim::Pattern] '{' ('multiplicity'
// cardinalityValues+=CardinalityValue cardinalityValues+=CardinalityValue*)? ('components'
// modelElement+=GraphElementMapping modelElement+=GraphElementMapping*)? ('ports' portMapping+=PortMapping
// portMapping+=PortMapping*)?
// '}';
public PatternApplicationElements getPatternApplicationAccess() {
return pPatternApplication;
}
public ParserRule getPatternApplicationRule() {
return getPatternApplicationAccess().getRule();
}
//CardinalityValue mapping::CardinalityValue:
// cardinalityElement=[pseim::CardinalityElement|QualifiedID] '->' value=EInt;
public CardinalityValueElements getCardinalityValueAccess() {
return pCardinalityValue;
}
public ParserRule getCardinalityValueRule() {
return getCardinalityValueAccess().getRule();
}
//PortMapping mapping::PortMapping:
// modelPort+=[seim::BorderElement|QualifiedID] (',' modelPort+=[seim::BorderElement|QualifiedID])*
// '->'
// patternPort=[seim::BorderElement|QualifiedID];
public PortMappingElements getPortMappingAccess() {
return pPortMapping;
}
public ParserRule getPortMappingRule() {
return getPortMappingAccess().getRule();
}
//GraphElementMapping mapping::GraphElementMapping:
// modelGraphElement+=[seim::GraphElement|QualifiedID] (',' modelGraphElement+=[seim::GraphElement|QualifiedID])*
// '->'
// patternGraphElement=[seim::GraphElement|QualifiedID];
public GraphElementMappingElements getGraphElementMappingAccess() {
return pGraphElementMapping;
}
public ParserRule getGraphElementMappingRule() {
return getGraphElementMappingAccess().getRule();
}
//EInt ecore::EInt:
// '-'? INT;
public EIntElements getEIntAccess() {
return pEInt;
}
public ParserRule getEIntRule() {
return getEIntAccess().getRule();
}
//QualifiedID:
// ID ('.' ID)*;
public QualifiedIDElements getQualifiedIDAccess() {
return pQualifiedID;
}
public ParserRule getQualifiedIDRule() {
return getQualifiedIDAccess().getRule();
}
//terminal ID:
// '^'? ('a'..'z' | 'A'..'Z' | '_') ('a'..'z' | 'A'..'Z' | '_' | '0'..'9')*;
public TerminalRule getIDRule() {
return gaTerminals.getIDRule();
}
//terminal INT returns ecore::EInt:
// '0'..'9'+;
public TerminalRule getINTRule() {
return gaTerminals.getINTRule();
}
//terminal STRING:
// '"' ('\\' . | !('\\' | '"'))* '"' |
// "'" ('\\' . | !('\\' | "'"))* "'";
public TerminalRule getSTRINGRule() {
return gaTerminals.getSTRINGRule();
}
//terminal ML_COMMENT:
// '/*'->'*/';
public TerminalRule getML_COMMENTRule() {
return gaTerminals.getML_COMMENTRule();
}
//terminal SL_COMMENT:
// '//' !('\n' | '\r')* ('\r'? '\n')?;
public TerminalRule getSL_COMMENTRule() {
return gaTerminals.getSL_COMMENTRule();
}
//terminal WS:
// ' ' | '\t' | '\r' | '\n'+;
public TerminalRule getWSRule() {
return gaTerminals.getWSRule();
}
//terminal ANY_OTHER:
// .;
public TerminalRule getANY_OTHERRule() {
return gaTerminals.getANY_OTHERRule();
}
}

View File

@@ -0,0 +1,20 @@
/*
* generated by Xtext 2.12.0
*/
package com.irtsaintexupery.xtext.pseim.validation;
import java.util.ArrayList;
import java.util.List;
import org.eclipse.emf.ecore.EPackage;
import org.eclipse.xtext.validation.AbstractDeclarativeValidator;
public abstract class AbstractMappingValidator extends AbstractDeclarativeValidator {
@Override
protected List<EPackage> getEPackages() {
List<EPackage> result = new ArrayList<EPackage>();
result.add(EPackage.Registry.INSTANCE.getEPackage("http://www.irit.fr/patterns/mapping/0.1"));
return result;
}
}