+ * The following features are supported: + *
+ *Note: the correct way to create the package is via the static + * factory method {@link #init init()}, which also performs + * initialization of the package, or returns the registered package, + * if one already exists. + * + * + * @see org.eclipse.emf.ecore.EPackage.Registry + * @see org.eclipse.fordiac.ide.contractSpec.ContractSpecPackage#eNS_URI + * @see #init() + * @generated + */ + private ContractSpecPackageImpl() + { + super(eNS_URI, ContractSpecFactory.eINSTANCE); + } + /** + * + * + * @generated + */ + private static boolean isInited = false; + + /** + * Creates, registers, and initializes the Package for this model, and for any others upon which it depends. + * + *
This method is used to initialize {@link ContractSpecPackage#eINSTANCE} when that field is accessed. + * Clients should not invoke it directly. Instead, they should simply access that field to obtain the package. + * + * + * @see #eNS_URI + * @see #createPackageContents() + * @see #initializePackageContents() + * @generated + */ + public static ContractSpecPackage init() + { + if (isInited) return (ContractSpecPackage)EPackage.Registry.INSTANCE.getEPackage(ContractSpecPackage.eNS_URI); + + // Obtain or create and register package + Object registeredContractSpecPackage = EPackage.Registry.INSTANCE.get(eNS_URI); + ContractSpecPackageImpl theContractSpecPackage = registeredContractSpecPackage instanceof ContractSpecPackageImpl ? (ContractSpecPackageImpl)registeredContractSpecPackage : new ContractSpecPackageImpl(); + + isInited = true; + + // Create package meta-data objects + theContractSpecPackage.createPackageContents(); + + // Initialize created meta-data + theContractSpecPackage.initializePackageContents(); + + // Mark meta-data to indicate it can't be changed + theContractSpecPackage.freeze(); + + // Update the registry and return the package + EPackage.Registry.INSTANCE.put(ContractSpecPackage.eNS_URI, theContractSpecPackage); + return theContractSpecPackage; + } + + /** + * + * + * @generated + */ + @Override + public EClass getModel() + { + return modelEClass; + } + + /** + * + * + * @generated + */ + @Override + public EAttribute getModel_TimeSpec() + { + return (EAttribute)modelEClass.getEStructuralFeatures().get(0); + } + + /** + * + * + * @generated + */ + @Override + public ContractSpecFactory getContractSpecFactory() + { + return (ContractSpecFactory)getEFactoryInstance(); + } + + /** + * + * + * @generated + */ + private boolean isCreated = false; + + /** + * Creates the meta-model objects for the package. This method is + * guarded to have no affect on any invocation but its first. + * + * + * @generated + */ + public void createPackageContents() + { + if (isCreated) return; + isCreated = true; + + // Create classes and their features + modelEClass = createEClass(MODEL); + createEAttribute(modelEClass, MODEL__TIME_SPEC); + } + + /** + * + * + * @generated + */ + private boolean isInitialized = false; + + /** + * Complete the initialization of the package and its meta-model. This + * method is guarded to have no affect on any invocation but its first. + * + * + * @generated + */ + public void initializePackageContents() + { + if (isInitialized) return; + isInitialized = true; + + // Initialize package + setName(eNAME); + setNsPrefix(eNS_PREFIX); + setNsURI(eNS_URI); + + // Create type parameters + + // Set bounds for type parameters + + // Add supertypes to classes + + // Initialize classes and features; add operations and parameters + initEClass(modelEClass, Model.class, "Model", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); + initEAttribute(getModel_TimeSpec(), ecorePackage.getEString(), "timeSpec", null, 0, -1, Model.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, !IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + + // Create resource + createResource(eNS_URI); + } + +} //ContractSpecPackageImpl diff --git a/plugins/org.eclipse.fordiac.ide.contractspec/src-gen/org/eclipse/fordiac/ide/contractSpec/impl/ModelImpl.java b/plugins/org.eclipse.fordiac.ide.contractspec/src-gen/org/eclipse/fordiac/ide/contractSpec/impl/ModelImpl.java new file mode 100644 index 0000000000..3e5cef147e --- /dev/null +++ b/plugins/org.eclipse.fordiac.ide.contractspec/src-gen/org/eclipse/fordiac/ide/contractSpec/impl/ModelImpl.java @@ -0,0 +1,175 @@ +/** + * Copyright (c) 2024 Felix Schmid + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * Felix Schmid + * - initial commit of contract specification editor + */ +package org.eclipse.fordiac.ide.contractSpec.impl; + +import java.util.Collection; + +import org.eclipse.emf.common.util.EList; + +import org.eclipse.emf.ecore.EClass; + +import org.eclipse.emf.ecore.impl.MinimalEObjectImpl; + +import org.eclipse.emf.ecore.util.EDataTypeEList; + +import org.eclipse.fordiac.ide.contractSpec.ContractSpecPackage; +import org.eclipse.fordiac.ide.contractSpec.Model; + +/** + * + * An implementation of the model object 'Model'. + * + *
+ * The following features are implemented: + *
+ *createXXX
method for each class of the model.
+ *
+ * @see org.eclipse.fordiac.ide.contractSpec.ContractSpecPackage
+ * @generated
+ */
+public class ContractSpecAdapterFactory extends AdapterFactoryImpl
+{
+ /**
+ * The cached model package.
+ *
+ *
+ * @generated
+ */
+ protected static ContractSpecPackage modelPackage;
+
+ /**
+ * Creates an instance of the adapter factory.
+ *
+ *
+ * @generated
+ */
+ public ContractSpecAdapterFactory()
+ {
+ if (modelPackage == null)
+ {
+ modelPackage = ContractSpecPackage.eINSTANCE;
+ }
+ }
+
+ /**
+ * Returns whether this factory is applicable for the type of the object.
+ *
+ * This implementation returns true
if the object is either the model's package or is an instance object of the model.
+ *
+ * @return whether this factory is applicable for the type of the object.
+ * @generated
+ */
+ @Override
+ public boolean isFactoryForType(Object object)
+ {
+ if (object == modelPackage)
+ {
+ return true;
+ }
+ if (object instanceof EObject)
+ {
+ return ((EObject)object).eClass().getEPackage() == modelPackage;
+ }
+ return false;
+ }
+
+ /**
+ * The switch that delegates to the createXXX
methods.
+ *
+ *
+ * @generated
+ */
+ protected ContractSpecSwitchtarget
.
+ *
+ *
+ * @param target the object to adapt.
+ * @return the adapter for the target
.
+ * @generated
+ */
+ @Override
+ public Adapter createAdapter(Notifier target)
+ {
+ return modelSwitch.doSwitch((EObject)target);
+ }
+
+
+ /**
+ * Creates a new adapter for an object of class '{@link org.eclipse.fordiac.ide.contractSpec.Model Model}'.
+ *
+ * This default implementation returns null so that we can easily ignore cases;
+ * it's useful to ignore a case when inheritance will catch all the cases anyway.
+ *
+ * @return the new adapter.
+ * @see org.eclipse.fordiac.ide.contractSpec.Model
+ * @generated
+ */
+ public Adapter createModelAdapter()
+ {
+ return null;
+ }
+
+ /**
+ * Creates a new adapter for the default case.
+ *
+ * This default implementation returns null.
+ *
+ * @return the new adapter.
+ * @generated
+ */
+ public Adapter createEObjectAdapter()
+ {
+ return null;
+ }
+
+} //ContractSpecAdapterFactory
diff --git a/plugins/org.eclipse.fordiac.ide.contractspec/src-gen/org/eclipse/fordiac/ide/contractSpec/util/ContractSpecSwitch.java b/plugins/org.eclipse.fordiac.ide.contractspec/src-gen/org/eclipse/fordiac/ide/contractSpec/util/ContractSpecSwitch.java
new file mode 100644
index 0000000000..443b2bf602
--- /dev/null
+++ b/plugins/org.eclipse.fordiac.ide.contractspec/src-gen/org/eclipse/fordiac/ide/contractSpec/util/ContractSpecSwitch.java
@@ -0,0 +1,130 @@
+/**
+ * Copyright (c) 2024 Felix Schmid
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0.
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * Felix Schmid
+ * - initial commit of contract specification editor
+ */
+package org.eclipse.fordiac.ide.contractSpec.util;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EPackage;
+
+import org.eclipse.emf.ecore.util.Switch;
+
+import org.eclipse.fordiac.ide.contractSpec.*;
+
+/**
+ *
+ * The Switch for the model's inheritance hierarchy.
+ * It supports the call {@link #doSwitch(EObject) doSwitch(object)}
+ * to invoke the caseXXX
method for each class of the model,
+ * starting with the actual class of the object
+ * and proceeding up the inheritance hierarchy
+ * until a non-null result is returned,
+ * which is the result of the switch.
+ *
+ * @see org.eclipse.fordiac.ide.contractSpec.ContractSpecPackage
+ * @generated
+ */
+public class ContractSpecSwitchcaseXXX
for each class of the model until one returns a non null result; it yields that result.
+ *
+ *
+ * @return the first non-null result returned by a caseXXX
call.
+ * @generated
+ */
+ @Override
+ protected T doSwitch(int classifierID, EObject theEObject)
+ {
+ switch (classifierID)
+ {
+ case ContractSpecPackage.MODEL:
+ {
+ Model model = (Model)theEObject;
+ T result = caseModel(model);
+ if (result == null) result = defaultCase(theEObject);
+ return result;
+ }
+ default: return defaultCase(theEObject);
+ }
+ }
+
+ /**
+ * Returns the result of interpreting the object as an instance of 'Model'.
+ *
+ * This implementation returns null;
+ * returning a non-null result will terminate the switch.
+ *
+ * @param object the target of the switch.
+ * @return the result of interpreting the object as an instance of 'Model'.
+ * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
+ * @generated
+ */
+ public T caseModel(Model object)
+ {
+ return null;
+ }
+
+ /**
+ * Returns the result of interpreting the object as an instance of 'EObject'.
+ *
+ * This implementation returns null;
+ * returning a non-null result will terminate the switch, but this is the last case anyway.
+ *
+ * @param object the target of the switch.
+ * @return the result of interpreting the object as an instance of 'EObject'.
+ * @see #doSwitch(org.eclipse.emf.ecore.EObject)
+ * @generated
+ */
+ @Override
+ public T defaultCase(EObject object)
+ {
+ return null;
+ }
+
+} //ContractSpecSwitch
diff --git a/plugins/org.eclipse.fordiac.ide.contractspec/src-gen/org/eclipse/fordiac/ide/parser/antlr/ContractSpecAntlrTokenFileProvider.java b/plugins/org.eclipse.fordiac.ide.contractspec/src-gen/org/eclipse/fordiac/ide/parser/antlr/ContractSpecAntlrTokenFileProvider.java
new file mode 100644
index 0000000000..a7bbe9fc26
--- /dev/null
+++ b/plugins/org.eclipse.fordiac.ide.contractspec/src-gen/org/eclipse/fordiac/ide/parser/antlr/ContractSpecAntlrTokenFileProvider.java
@@ -0,0 +1,26 @@
+/*******************************************************************************
+ * Copyright (c) 2024 Felix Schmid
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0.
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * Felix Schmid
+ * - initial commit of contract specification editor
+ *******************************************************************************/
+package org.eclipse.fordiac.ide.parser.antlr;
+
+import java.io.InputStream;
+import org.eclipse.xtext.parser.antlr.IAntlrTokenFileProvider;
+
+public class ContractSpecAntlrTokenFileProvider implements IAntlrTokenFileProvider {
+
+ @Override
+ public InputStream getAntlrTokenFile() {
+ ClassLoader classLoader = getClass().getClassLoader();
+ return classLoader.getResourceAsStream("org/eclipse/fordiac/ide/parser/antlr/internal/InternalContractSpec.tokens");
+ }
+}
diff --git a/plugins/org.eclipse.fordiac.ide.contractspec/src-gen/org/eclipse/fordiac/ide/parser/antlr/ContractSpecParser.java b/plugins/org.eclipse.fordiac.ide.contractspec/src-gen/org/eclipse/fordiac/ide/parser/antlr/ContractSpecParser.java
new file mode 100644
index 0000000000..bc5f5a5f3c
--- /dev/null
+++ b/plugins/org.eclipse.fordiac.ide.contractspec/src-gen/org/eclipse/fordiac/ide/parser/antlr/ContractSpecParser.java
@@ -0,0 +1,50 @@
+/*******************************************************************************
+ * Copyright (c) 2024 Felix Schmid
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0.
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * Felix Schmid
+ * - initial commit of contract specification editor
+ *******************************************************************************/
+package org.eclipse.fordiac.ide.parser.antlr;
+
+import com.google.inject.Inject;
+import org.eclipse.fordiac.ide.parser.antlr.internal.InternalContractSpecParser;
+import org.eclipse.fordiac.ide.services.ContractSpecGrammarAccess;
+import org.eclipse.xtext.parser.antlr.AbstractAntlrParser;
+import org.eclipse.xtext.parser.antlr.XtextTokenStream;
+
+public class ContractSpecParser extends AbstractAntlrParser {
+
+ @Inject
+ private ContractSpecGrammarAccess grammarAccess;
+
+ @Override
+ protected void setInitialHiddenTokens(XtextTokenStream tokenStream) {
+ tokenStream.setInitialHiddenTokens("RULE_WS", "RULE_ML_COMMENT", "RULE_SL_COMMENT");
+ }
+
+
+ @Override
+ protected InternalContractSpecParser createParser(XtextTokenStream stream) {
+ return new InternalContractSpecParser(stream, getGrammarAccess());
+ }
+
+ @Override
+ protected String getDefaultRuleName() {
+ return "Model";
+ }
+
+ public ContractSpecGrammarAccess getGrammarAccess() {
+ return this.grammarAccess;
+ }
+
+ public void setGrammarAccess(ContractSpecGrammarAccess grammarAccess) {
+ this.grammarAccess = grammarAccess;
+ }
+}
diff --git a/plugins/org.eclipse.fordiac.ide.contractspec/src-gen/org/eclipse/fordiac/ide/parser/antlr/internal/InternalContractSpec.g b/plugins/org.eclipse.fordiac.ide.contractspec/src-gen/org/eclipse/fordiac/ide/parser/antlr/internal/InternalContractSpec.g
new file mode 100644
index 0000000000..d5fa7dd283
--- /dev/null
+++ b/plugins/org.eclipse.fordiac.ide.contractspec/src-gen/org/eclipse/fordiac/ide/parser/antlr/internal/InternalContractSpec.g
@@ -0,0 +1,143 @@
+/*******************************************************************************
+ * Copyright (c) 2024 Felix Schmid
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0.
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * Felix Schmid
+ * - initial commit of contract specification editor
+ *******************************************************************************/
+grammar InternalContractSpec;
+
+options {
+ superClass=AbstractInternalAntlrParser;
+}
+
+@lexer::header {
+package org.eclipse.fordiac.ide.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 org.eclipse.fordiac.ide.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 org.eclipse.fordiac.ide.services.ContractSpecGrammarAccess;
+
+}
+
+@parser::members {
+
+ private ContractSpecGrammarAccess grammarAccess;
+
+ public InternalContractSpecParser(TokenStream input, ContractSpecGrammarAccess grammarAccess) {
+ this(input);
+ this.grammarAccess = grammarAccess;
+ registerRules(grammarAccess.getGrammar());
+ }
+
+ @Override
+ protected String getFirstRuleName() {
+ return "Model";
+ }
+
+ @Override
+ protected ContractSpecGrammarAccess getGrammarAccess() {
+ return grammarAccess;
+ }
+
+}
+
+@rulecatch {
+ catch (RecognitionException re) {
+ recover(input,re);
+ appendSkippedTokens();
+ }
+}
+
+// Entry rule entryRuleModel
+entryRuleModel returns [EObject current=null]:
+ { newCompositeNode(grammarAccess.getModelRule()); }
+ iv_ruleModel=ruleModel
+ { $current=$iv_ruleModel.current; }
+ EOF;
+
+// Rule Model
+ruleModel returns [EObject current=null]
+@init {
+ enterRule();
+}
+@after {
+ leaveRule();
+}:
+ (
+ (
+ {
+ newCompositeNode(grammarAccess.getModelAccess().getTimeSpecTimeSpecParserRuleCall_0());
+ }
+ lv_timeSpec_0_0=ruleTimeSpec
+ {
+ if ($current==null) {
+ $current = createModelElementForParent(grammarAccess.getModelRule());
+ }
+ add(
+ $current,
+ "timeSpec",
+ lv_timeSpec_0_0,
+ "org.eclipse.fordiac.ide.ContractSpec.TimeSpec");
+ afterParserOrEnumRuleCall();
+ }
+ )
+ )*
+;
+
+// Entry rule entryRuleTimeSpec
+entryRuleTimeSpec returns [String current=null]:
+ { newCompositeNode(grammarAccess.getTimeSpecRule()); }
+ iv_ruleTimeSpec=ruleTimeSpec
+ { $current=$iv_ruleTimeSpec.current.getText(); }
+ EOF;
+
+// Rule TimeSpec
+ruleTimeSpec returns [AntlrDatatypeRuleToken current=new AntlrDatatypeRuleToken()]
+@init {
+ enterRule();
+}
+@after {
+ leaveRule();
+}:
+ kw='dummy_rule'
+ {
+ $current.merge(kw);
+ newLeafNode(kw, grammarAccess.getTimeSpecAccess().getDummy_ruleKeyword());
+ }
+;
+
+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 : .;
diff --git a/plugins/org.eclipse.fordiac.ide.contractspec/src-gen/org/eclipse/fordiac/ide/parser/antlr/internal/InternalContractSpec.tokens b/plugins/org.eclipse.fordiac.ide.contractspec/src-gen/org/eclipse/fordiac/ide/parser/antlr/internal/InternalContractSpec.tokens
new file mode 100644
index 0000000000..78bfe28563
--- /dev/null
+++ b/plugins/org.eclipse.fordiac.ide.contractspec/src-gen/org/eclipse/fordiac/ide/parser/antlr/internal/InternalContractSpec.tokens
@@ -0,0 +1,9 @@
+'dummy_rule'=11
+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
diff --git a/plugins/org.eclipse.fordiac.ide.contractspec/src-gen/org/eclipse/fordiac/ide/parser/antlr/internal/InternalContractSpecLexer.java b/plugins/org.eclipse.fordiac.ide.contractspec/src-gen/org/eclipse/fordiac/ide/parser/antlr/internal/InternalContractSpecLexer.java
new file mode 100644
index 0000000000..4b6927bc33
--- /dev/null
+++ b/plugins/org.eclipse.fordiac.ide.contractspec/src-gen/org/eclipse/fordiac/ide/parser/antlr/internal/InternalContractSpecLexer.java
@@ -0,0 +1,755 @@
+package org.eclipse.fordiac.ide.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;
+
+
+import org.antlr.runtime.*;
+import java.util.Stack;
+import java.util.List;
+import java.util.ArrayList;
+
+@SuppressWarnings("all")
+public class InternalContractSpecLexer extends Lexer {
+ public static final int RULE_ID=4;
+ public static final int RULE_WS=9;
+ public static final int RULE_STRING=6;
+ public static final int RULE_ANY_OTHER=10;
+ public static final int RULE_SL_COMMENT=8;
+ public static final int RULE_INT=5;
+ public static final int T__11=11;
+ public static final int RULE_ML_COMMENT=7;
+ public static final int EOF=-1;
+
+ // delegates
+ // delegators
+
+ public InternalContractSpecLexer() {;}
+ public InternalContractSpecLexer(CharStream input) {
+ this(input, new RecognizerSharedState());
+ }
+ public InternalContractSpecLexer(CharStream input, RecognizerSharedState state) {
+ super(input,state);
+
+ }
+ public String getGrammarFileName() { return "InternalContractSpec.g"; }
+
+ // $ANTLR start "T__11"
+ public final void mT__11() throws RecognitionException {
+ try {
+ int _type = T__11;
+ int _channel = DEFAULT_TOKEN_CHANNEL;
+ // InternalContractSpec.g:11:7: ( 'dummy_rule' )
+ // InternalContractSpec.g:11:9: 'dummy_rule'
+ {
+ match("dummy_rule");
+
+
+ }
+
+ state.type = _type;
+ state.channel = _channel;
+ }
+ finally {
+ }
+ }
+ // $ANTLR end "T__11"
+
+ // $ANTLR start "RULE_ID"
+ public final void mRULE_ID() throws RecognitionException {
+ try {
+ int _type = RULE_ID;
+ int _channel = DEFAULT_TOKEN_CHANNEL;
+ // InternalContractSpec.g:131:9: ( ( '^' )? ( 'a' .. 'z' | 'A' .. 'Z' | '_' ) ( 'a' .. 'z' | 'A' .. 'Z' | '_' | '0' .. '9' )* )
+ // InternalContractSpec.g:131:11: ( '^' )? ( 'a' .. 'z' | 'A' .. 'Z' | '_' ) ( 'a' .. 'z' | 'A' .. 'Z' | '_' | '0' .. '9' )*
+ {
+ // InternalContractSpec.g:131:11: ( '^' )?
+ int alt1=2;
+ int LA1_0 = input.LA(1);
+
+ if ( (LA1_0=='^') ) {
+ alt1=1;
+ }
+ switch (alt1) {
+ case 1 :
+ // InternalContractSpec.g:131:11: '^'
+ {
+ match('^');
+
+ }
+ break;
+
+ }
+
+ if ( (input.LA(1)>='A' && input.LA(1)<='Z')||input.LA(1)=='_'||(input.LA(1)>='a' && input.LA(1)<='z') ) {
+ input.consume();
+
+ }
+ else {
+ MismatchedSetException mse = new MismatchedSetException(null,input);
+ recover(mse);
+ throw mse;}
+
+ // InternalContractSpec.g:131:40: ( 'a' .. 'z' | 'A' .. 'Z' | '_' | '0' .. '9' )*
+ loop2:
+ do {
+ int alt2=2;
+ int LA2_0 = input.LA(1);
+
+ if ( ((LA2_0>='0' && LA2_0<='9')||(LA2_0>='A' && LA2_0<='Z')||LA2_0=='_'||(LA2_0>='a' && LA2_0<='z')) ) {
+ alt2=1;
+ }
+
+
+ switch (alt2) {
+ case 1 :
+ // InternalContractSpec.g:
+ {
+ if ( (input.LA(1)>='0' && input.LA(1)<='9')||(input.LA(1)>='A' && input.LA(1)<='Z')||input.LA(1)=='_'||(input.LA(1)>='a' && input.LA(1)<='z') ) {
+ input.consume();
+
+ }
+ else {
+ MismatchedSetException mse = new MismatchedSetException(null,input);
+ recover(mse);
+ throw mse;}
+
+
+ }
+ break;
+
+ default :
+ break loop2;
+ }
+ } while (true);
+
+
+ }
+
+ state.type = _type;
+ state.channel = _channel;
+ }
+ finally {
+ }
+ }
+ // $ANTLR end "RULE_ID"
+
+ // $ANTLR start "RULE_INT"
+ public final void mRULE_INT() throws RecognitionException {
+ try {
+ int _type = RULE_INT;
+ int _channel = DEFAULT_TOKEN_CHANNEL;
+ // InternalContractSpec.g:133:10: ( ( '0' .. '9' )+ )
+ // InternalContractSpec.g:133:12: ( '0' .. '9' )+
+ {
+ // InternalContractSpec.g:133:12: ( '0' .. '9' )+
+ int cnt3=0;
+ loop3:
+ do {
+ int alt3=2;
+ int LA3_0 = input.LA(1);
+
+ if ( ((LA3_0>='0' && LA3_0<='9')) ) {
+ alt3=1;
+ }
+
+
+ switch (alt3) {
+ case 1 :
+ // InternalContractSpec.g:133:13: '0' .. '9'
+ {
+ matchRange('0','9');
+
+ }
+ break;
+
+ default :
+ if ( cnt3 >= 1 ) break loop3;
+ EarlyExitException eee =
+ new EarlyExitException(3, input);
+ throw eee;
+ }
+ cnt3++;
+ } while (true);
+
+
+ }
+
+ state.type = _type;
+ state.channel = _channel;
+ }
+ finally {
+ }
+ }
+ // $ANTLR end "RULE_INT"
+
+ // $ANTLR start "RULE_STRING"
+ public final void mRULE_STRING() throws RecognitionException {
+ try {
+ int _type = RULE_STRING;
+ int _channel = DEFAULT_TOKEN_CHANNEL;
+ // InternalContractSpec.g:135:13: ( ( '\"' ( '\\\\' . | ~ ( ( '\\\\' | '\"' ) ) )* '\"' | '\\'' ( '\\\\' . | ~ ( ( '\\\\' | '\\'' ) ) )* '\\'' ) )
+ // InternalContractSpec.g:135:15: ( '\"' ( '\\\\' . | ~ ( ( '\\\\' | '\"' ) ) )* '\"' | '\\'' ( '\\\\' . | ~ ( ( '\\\\' | '\\'' ) ) )* '\\'' )
+ {
+ // InternalContractSpec.g:135:15: ( '\"' ( '\\\\' . | ~ ( ( '\\\\' | '\"' ) ) )* '\"' | '\\'' ( '\\\\' . | ~ ( ( '\\\\' | '\\'' ) ) )* '\\'' )
+ int alt6=2;
+ int LA6_0 = input.LA(1);
+
+ if ( (LA6_0=='\"') ) {
+ alt6=1;
+ }
+ else if ( (LA6_0=='\'') ) {
+ alt6=2;
+ }
+ else {
+ NoViableAltException nvae =
+ new NoViableAltException("", 6, 0, input);
+
+ throw nvae;
+ }
+ switch (alt6) {
+ case 1 :
+ // InternalContractSpec.g:135:16: '\"' ( '\\\\' . | ~ ( ( '\\\\' | '\"' ) ) )* '\"'
+ {
+ match('\"');
+ // InternalContractSpec.g:135:20: ( '\\\\' . | ~ ( ( '\\\\' | '\"' ) ) )*
+ loop4:
+ do {
+ int alt4=3;
+ int LA4_0 = input.LA(1);
+
+ if ( (LA4_0=='\\') ) {
+ alt4=1;
+ }
+ else if ( ((LA4_0>='\u0000' && LA4_0<='!')||(LA4_0>='#' && LA4_0<='[')||(LA4_0>=']' && LA4_0<='\uFFFF')) ) {
+ alt4=2;
+ }
+
+
+ switch (alt4) {
+ case 1 :
+ // InternalContractSpec.g:135:21: '\\\\' .
+ {
+ match('\\');
+ matchAny();
+
+ }
+ break;
+ case 2 :
+ // InternalContractSpec.g:135:28: ~ ( ( '\\\\' | '\"' ) )
+ {
+ if ( (input.LA(1)>='\u0000' && input.LA(1)<='!')||(input.LA(1)>='#' && input.LA(1)<='[')||(input.LA(1)>=']' && input.LA(1)<='\uFFFF') ) {
+ input.consume();
+
+ }
+ else {
+ MismatchedSetException mse = new MismatchedSetException(null,input);
+ recover(mse);
+ throw mse;}
+
+
+ }
+ break;
+
+ default :
+ break loop4;
+ }
+ } while (true);
+
+ match('\"');
+
+ }
+ break;
+ case 2 :
+ // InternalContractSpec.g:135:48: '\\'' ( '\\\\' . | ~ ( ( '\\\\' | '\\'' ) ) )* '\\''
+ {
+ match('\'');
+ // InternalContractSpec.g:135:53: ( '\\\\' . | ~ ( ( '\\\\' | '\\'' ) ) )*
+ loop5:
+ do {
+ int alt5=3;
+ int LA5_0 = input.LA(1);
+
+ if ( (LA5_0=='\\') ) {
+ alt5=1;
+ }
+ else if ( ((LA5_0>='\u0000' && LA5_0<='&')||(LA5_0>='(' && LA5_0<='[')||(LA5_0>=']' && LA5_0<='\uFFFF')) ) {
+ alt5=2;
+ }
+
+
+ switch (alt5) {
+ case 1 :
+ // InternalContractSpec.g:135:54: '\\\\' .
+ {
+ match('\\');
+ matchAny();
+
+ }
+ break;
+ case 2 :
+ // InternalContractSpec.g:135:61: ~ ( ( '\\\\' | '\\'' ) )
+ {
+ if ( (input.LA(1)>='\u0000' && input.LA(1)<='&')||(input.LA(1)>='(' && input.LA(1)<='[')||(input.LA(1)>=']' && input.LA(1)<='\uFFFF') ) {
+ input.consume();
+
+ }
+ else {
+ MismatchedSetException mse = new MismatchedSetException(null,input);
+ recover(mse);
+ throw mse;}
+
+
+ }
+ break;
+
+ default :
+ break loop5;
+ }
+ } while (true);
+
+ match('\'');
+
+ }
+ break;
+
+ }
+
+
+ }
+
+ state.type = _type;
+ state.channel = _channel;
+ }
+ finally {
+ }
+ }
+ // $ANTLR end "RULE_STRING"
+
+ // $ANTLR start "RULE_ML_COMMENT"
+ public final void mRULE_ML_COMMENT() throws RecognitionException {
+ try {
+ int _type = RULE_ML_COMMENT;
+ int _channel = DEFAULT_TOKEN_CHANNEL;
+ // InternalContractSpec.g:137:17: ( '/*' ( options {greedy=false; } : . )* '*/' )
+ // InternalContractSpec.g:137:19: '/*' ( options {greedy=false; } : . )* '*/'
+ {
+ match("/*");
+
+ // InternalContractSpec.g:137:24: ( options {greedy=false; } : . )*
+ loop7:
+ do {
+ int alt7=2;
+ int LA7_0 = input.LA(1);
+
+ if ( (LA7_0=='*') ) {
+ int LA7_1 = input.LA(2);
+
+ if ( (LA7_1=='/') ) {
+ alt7=2;
+ }
+ else if ( ((LA7_1>='\u0000' && LA7_1<='.')||(LA7_1>='0' && LA7_1<='\uFFFF')) ) {
+ alt7=1;
+ }
+
+
+ }
+ else if ( ((LA7_0>='\u0000' && LA7_0<=')')||(LA7_0>='+' && LA7_0<='\uFFFF')) ) {
+ alt7=1;
+ }
+
+
+ switch (alt7) {
+ case 1 :
+ // InternalContractSpec.g:137:52: .
+ {
+ matchAny();
+
+ }
+ break;
+
+ default :
+ break loop7;
+ }
+ } while (true);
+
+ match("*/");
+
+
+ }
+
+ state.type = _type;
+ state.channel = _channel;
+ }
+ finally {
+ }
+ }
+ // $ANTLR end "RULE_ML_COMMENT"
+
+ // $ANTLR start "RULE_SL_COMMENT"
+ public final void mRULE_SL_COMMENT() throws RecognitionException {
+ try {
+ int _type = RULE_SL_COMMENT;
+ int _channel = DEFAULT_TOKEN_CHANNEL;
+ // InternalContractSpec.g:139:17: ( '//' (~ ( ( '\\n' | '\\r' ) ) )* ( ( '\\r' )? '\\n' )? )
+ // InternalContractSpec.g:139:19: '//' (~ ( ( '\\n' | '\\r' ) ) )* ( ( '\\r' )? '\\n' )?
+ {
+ match("//");
+
+ // InternalContractSpec.g:139:24: (~ ( ( '\\n' | '\\r' ) ) )*
+ loop8:
+ do {
+ int alt8=2;
+ int LA8_0 = input.LA(1);
+
+ if ( ((LA8_0>='\u0000' && LA8_0<='\t')||(LA8_0>='\u000B' && LA8_0<='\f')||(LA8_0>='\u000E' && LA8_0<='\uFFFF')) ) {
+ alt8=1;
+ }
+
+
+ switch (alt8) {
+ case 1 :
+ // InternalContractSpec.g:139:24: ~ ( ( '\\n' | '\\r' ) )
+ {
+ if ( (input.LA(1)>='\u0000' && input.LA(1)<='\t')||(input.LA(1)>='\u000B' && input.LA(1)<='\f')||(input.LA(1)>='\u000E' && input.LA(1)<='\uFFFF') ) {
+ input.consume();
+
+ }
+ else {
+ MismatchedSetException mse = new MismatchedSetException(null,input);
+ recover(mse);
+ throw mse;}
+
+
+ }
+ break;
+
+ default :
+ break loop8;
+ }
+ } while (true);
+
+ // InternalContractSpec.g:139:40: ( ( '\\r' )? '\\n' )?
+ int alt10=2;
+ int LA10_0 = input.LA(1);
+
+ if ( (LA10_0=='\n'||LA10_0=='\r') ) {
+ alt10=1;
+ }
+ switch (alt10) {
+ case 1 :
+ // InternalContractSpec.g:139:41: ( '\\r' )? '\\n'
+ {
+ // InternalContractSpec.g:139:41: ( '\\r' )?
+ int alt9=2;
+ int LA9_0 = input.LA(1);
+
+ if ( (LA9_0=='\r') ) {
+ alt9=1;
+ }
+ switch (alt9) {
+ case 1 :
+ // InternalContractSpec.g:139:41: '\\r'
+ {
+ match('\r');
+
+ }
+ break;
+
+ }
+
+ match('\n');
+
+ }
+ break;
+
+ }
+
+
+ }
+
+ state.type = _type;
+ state.channel = _channel;
+ }
+ finally {
+ }
+ }
+ // $ANTLR end "RULE_SL_COMMENT"
+
+ // $ANTLR start "RULE_WS"
+ public final void mRULE_WS() throws RecognitionException {
+ try {
+ int _type = RULE_WS;
+ int _channel = DEFAULT_TOKEN_CHANNEL;
+ // InternalContractSpec.g:141:9: ( ( ' ' | '\\t' | '\\r' | '\\n' )+ )
+ // InternalContractSpec.g:141:11: ( ' ' | '\\t' | '\\r' | '\\n' )+
+ {
+ // InternalContractSpec.g:141:11: ( ' ' | '\\t' | '\\r' | '\\n' )+
+ int cnt11=0;
+ loop11:
+ do {
+ int alt11=2;
+ int LA11_0 = input.LA(1);
+
+ if ( ((LA11_0>='\t' && LA11_0<='\n')||LA11_0=='\r'||LA11_0==' ') ) {
+ alt11=1;
+ }
+
+
+ switch (alt11) {
+ case 1 :
+ // InternalContractSpec.g:
+ {
+ if ( (input.LA(1)>='\t' && input.LA(1)<='\n')||input.LA(1)=='\r'||input.LA(1)==' ' ) {
+ input.consume();
+
+ }
+ else {
+ MismatchedSetException mse = new MismatchedSetException(null,input);
+ recover(mse);
+ throw mse;}
+
+
+ }
+ break;
+
+ default :
+ if ( cnt11 >= 1 ) break loop11;
+ EarlyExitException eee =
+ new EarlyExitException(11, input);
+ throw eee;
+ }
+ cnt11++;
+ } while (true);
+
+
+ }
+
+ state.type = _type;
+ state.channel = _channel;
+ }
+ finally {
+ }
+ }
+ // $ANTLR end "RULE_WS"
+
+ // $ANTLR start "RULE_ANY_OTHER"
+ public final void mRULE_ANY_OTHER() throws RecognitionException {
+ try {
+ int _type = RULE_ANY_OTHER;
+ int _channel = DEFAULT_TOKEN_CHANNEL;
+ // InternalContractSpec.g:143:16: ( . )
+ // InternalContractSpec.g:143:18: .
+ {
+ matchAny();
+
+ }
+
+ state.type = _type;
+ state.channel = _channel;
+ }
+ finally {
+ }
+ }
+ // $ANTLR end "RULE_ANY_OTHER"
+
+ public void mTokens() throws RecognitionException {
+ // InternalContractSpec.g:1:8: ( T__11 | RULE_ID | RULE_INT | RULE_STRING | RULE_ML_COMMENT | RULE_SL_COMMENT | RULE_WS | RULE_ANY_OTHER )
+ int alt12=8;
+ alt12 = dfa12.predict(input);
+ switch (alt12) {
+ case 1 :
+ // InternalContractSpec.g:1:10: T__11
+ {
+ mT__11();
+
+ }
+ break;
+ case 2 :
+ // InternalContractSpec.g:1:16: RULE_ID
+ {
+ mRULE_ID();
+
+ }
+ break;
+ case 3 :
+ // InternalContractSpec.g:1:24: RULE_INT
+ {
+ mRULE_INT();
+
+ }
+ break;
+ case 4 :
+ // InternalContractSpec.g:1:33: RULE_STRING
+ {
+ mRULE_STRING();
+
+ }
+ break;
+ case 5 :
+ // InternalContractSpec.g:1:45: RULE_ML_COMMENT
+ {
+ mRULE_ML_COMMENT();
+
+ }
+ break;
+ case 6 :
+ // InternalContractSpec.g:1:61: RULE_SL_COMMENT
+ {
+ mRULE_SL_COMMENT();
+
+ }
+ break;
+ case 7 :
+ // InternalContractSpec.g:1:77: RULE_WS
+ {
+ mRULE_WS();
+
+ }
+ break;
+ case 8 :
+ // InternalContractSpec.g:1:85: RULE_ANY_OTHER
+ {
+ mRULE_ANY_OTHER();
+
+ }
+ break;
+
+ }
+
+ }
+
+
+ protected DFA12 dfa12 = new DFA12(this);
+ static final String DFA12_eotS =
+ "\1\uffff\1\13\1\11\2\uffff\3\11\2\uffff\1\13\6\uffff\7\13\1\31\1\uffff";
+ static final String DFA12_eofS =
+ "\32\uffff";
+ static final String DFA12_minS =
+ "\1\0\1\165\1\101\2\uffff\2\0\1\52\2\uffff\1\155\6\uffff\1\155\1\171\1\137\1\162\1\165\1\154\1\145\1\60\1\uffff";
+ static final String DFA12_maxS =
+ "\1\uffff\1\165\1\172\2\uffff\2\uffff\1\57\2\uffff\1\155\6\uffff\1\155\1\171\1\137\1\162\1\165\1\154\1\145\1\172\1\uffff";
+ static final String DFA12_acceptS =
+ "\3\uffff\1\2\1\3\3\uffff\1\7\1\10\1\uffff\1\2\1\3\1\4\1\5\1\6\1\7\10\uffff\1\1";
+ static final String DFA12_specialS =
+ "\1\0\4\uffff\1\1\1\2\23\uffff}>";
+ static final String[] DFA12_transitionS = {
+ "\11\11\2\10\2\11\1\10\22\11\1\10\1\11\1\5\4\11\1\6\7\11\1\7\12\4\7\11\32\3\3\11\1\2\1\3\1\11\3\3\1\1\26\3\uff85\11",
+ "\1\12",
+ "\32\13\4\uffff\1\13\1\uffff\32\13",
+ "",
+ "",
+ "\0\15",
+ "\0\15",
+ "\1\16\4\uffff\1\17",
+ "",
+ "",
+ "\1\21",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "\1\22",
+ "\1\23",
+ "\1\24",
+ "\1\25",
+ "\1\26",
+ "\1\27",
+ "\1\30",
+ "\12\13\7\uffff\32\13\4\uffff\1\13\1\uffff\32\13",
+ ""
+ };
+
+ static final short[] DFA12_eot = DFA.unpackEncodedString(DFA12_eotS);
+ static final short[] DFA12_eof = DFA.unpackEncodedString(DFA12_eofS);
+ static final char[] DFA12_min = DFA.unpackEncodedStringToUnsignedChars(DFA12_minS);
+ static final char[] DFA12_max = DFA.unpackEncodedStringToUnsignedChars(DFA12_maxS);
+ static final short[] DFA12_accept = DFA.unpackEncodedString(DFA12_acceptS);
+ static final short[] DFA12_special = DFA.unpackEncodedString(DFA12_specialS);
+ static final short[][] DFA12_transition;
+
+ static {
+ int numStates = DFA12_transitionS.length;
+ DFA12_transition = new short[numStates][];
+ for (int i=0; i+ * Contexts: + * Model returns Model + * + * Constraint: + * timeSpec+=TimeSpec+ + *+ */ + protected void sequence_Model(ISerializationContext context, Model semanticObject) { + genericSequencer.createSequence(context, semanticObject); + } + + +} diff --git a/plugins/org.eclipse.fordiac.ide.contractspec/src-gen/org/eclipse/fordiac/ide/serializer/ContractSpecSyntacticSequencer.java b/plugins/org.eclipse.fordiac.ide.contractspec/src-gen/org/eclipse/fordiac/ide/serializer/ContractSpecSyntacticSequencer.java new file mode 100644 index 0000000000..b6a6564f4c --- /dev/null +++ b/plugins/org.eclipse.fordiac.ide.contractspec/src-gen/org/eclipse/fordiac/ide/serializer/ContractSpecSyntacticSequencer.java @@ -0,0 +1,53 @@ +/******************************************************************************* + * Copyright (c) 2024 Felix Schmid + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * Felix Schmid + * - initial commit of contract specification editor + *******************************************************************************/ +package org.eclipse.fordiac.ide.serializer; + +import com.google.inject.Inject; +import java.util.List; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.fordiac.ide.services.ContractSpecGrammarAccess; +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 ContractSpecSyntacticSequencer extends AbstractSyntacticSequencer { + + protected ContractSpecGrammarAccess grammarAccess; + + @Inject + protected void init(IGrammarAccess access) { + grammarAccess = (ContractSpecGrammarAccess) 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