Переглянути джерело

Added NullLiteral to expression language

Andreas Mülder 11 роки тому
батько
коміт
ac8258262c

+ 9 - 0
plugins/org.yakindu.base.expressions/emf-gen/org/yakindu/base/expressions/expressions/ExpressionsFactory.java

@@ -84,6 +84,15 @@ public interface ExpressionsFactory extends EFactory {
 	 */
 	StringLiteral createStringLiteral();
 
+	/**
+	 * Returns a new object of class '<em>Null Literal</em>'.
+	 * <!-- begin-user-doc -->
+	 * <!-- end-user-doc -->
+	 * @return a new object of class '<em>Null Literal</em>'.
+	 * @generated
+	 */
+	NullLiteral createNullLiteral();
+
 	/**
 	 * Returns a new object of class '<em>Assignment Expression</em>'.
 	 * <!-- begin-user-doc -->

+ 62 - 23
plugins/org.yakindu.base.expressions/emf-gen/org/yakindu/base/expressions/expressions/ExpressionsPackage.java

@@ -234,6 +234,25 @@ public interface ExpressionsPackage extends EPackage {
 	 */
 	int STRING_LITERAL_FEATURE_COUNT = LITERAL_FEATURE_COUNT + 1;
 
+	/**
+	 * The meta object id for the '{@link org.yakindu.base.expressions.expressions.impl.NullLiteralImpl <em>Null Literal</em>}' class.
+	 * <!-- begin-user-doc -->
+	 * <!-- end-user-doc -->
+	 * @see org.yakindu.base.expressions.expressions.impl.NullLiteralImpl
+	 * @see org.yakindu.base.expressions.expressions.impl.ExpressionsPackageImpl#getNullLiteral()
+	 * @generated
+	 */
+	int NULL_LITERAL = 7;
+
+	/**
+	 * The number of structural features of the '<em>Null Literal</em>' class.
+	 * <!-- begin-user-doc -->
+	 * <!-- end-user-doc -->
+	 * @generated
+	 * @ordered
+	 */
+	int NULL_LITERAL_FEATURE_COUNT = LITERAL_FEATURE_COUNT + 0;
+
 	/**
 	 * The meta object id for the '{@link org.yakindu.base.expressions.expressions.impl.AssignmentExpressionImpl <em>Assignment Expression</em>}' class.
 	 * <!-- begin-user-doc -->
@@ -242,7 +261,7 @@ public interface ExpressionsPackage extends EPackage {
 	 * @see org.yakindu.base.expressions.expressions.impl.ExpressionsPackageImpl#getAssignmentExpression()
 	 * @generated
 	 */
-	int ASSIGNMENT_EXPRESSION = 7;
+	int ASSIGNMENT_EXPRESSION = 8;
 
 	/**
 	 * The feature id for the '<em><b>Var Ref</b></em>' containment reference.
@@ -288,7 +307,7 @@ public interface ExpressionsPackage extends EPackage {
 	 * @see org.yakindu.base.expressions.expressions.impl.ExpressionsPackageImpl#getConditionalExpression()
 	 * @generated
 	 */
-	int CONDITIONAL_EXPRESSION = 8;
+	int CONDITIONAL_EXPRESSION = 9;
 
 	/**
 	 * The feature id for the '<em><b>Condition</b></em>' containment reference.
@@ -334,7 +353,7 @@ public interface ExpressionsPackage extends EPackage {
 	 * @see org.yakindu.base.expressions.expressions.impl.ExpressionsPackageImpl#getLogicalOrExpression()
 	 * @generated
 	 */
-	int LOGICAL_OR_EXPRESSION = 9;
+	int LOGICAL_OR_EXPRESSION = 10;
 
 	/**
 	 * The feature id for the '<em><b>Left Operand</b></em>' containment reference.
@@ -371,7 +390,7 @@ public interface ExpressionsPackage extends EPackage {
 	 * @see org.yakindu.base.expressions.expressions.impl.ExpressionsPackageImpl#getLogicalAndExpression()
 	 * @generated
 	 */
-	int LOGICAL_AND_EXPRESSION = 10;
+	int LOGICAL_AND_EXPRESSION = 11;
 
 	/**
 	 * The feature id for the '<em><b>Left Operand</b></em>' containment reference.
@@ -408,7 +427,7 @@ public interface ExpressionsPackage extends EPackage {
 	 * @see org.yakindu.base.expressions.expressions.impl.ExpressionsPackageImpl#getLogicalNotExpression()
 	 * @generated
 	 */
-	int LOGICAL_NOT_EXPRESSION = 11;
+	int LOGICAL_NOT_EXPRESSION = 12;
 
 	/**
 	 * The feature id for the '<em><b>Operand</b></em>' containment reference.
@@ -436,7 +455,7 @@ public interface ExpressionsPackage extends EPackage {
 	 * @see org.yakindu.base.expressions.expressions.impl.ExpressionsPackageImpl#getBitwiseXorExpression()
 	 * @generated
 	 */
-	int BITWISE_XOR_EXPRESSION = 12;
+	int BITWISE_XOR_EXPRESSION = 13;
 
 	/**
 	 * The feature id for the '<em><b>Left Operand</b></em>' containment reference.
@@ -473,7 +492,7 @@ public interface ExpressionsPackage extends EPackage {
 	 * @see org.yakindu.base.expressions.expressions.impl.ExpressionsPackageImpl#getBitwiseOrExpression()
 	 * @generated
 	 */
-	int BITWISE_OR_EXPRESSION = 13;
+	int BITWISE_OR_EXPRESSION = 14;
 
 	/**
 	 * The feature id for the '<em><b>Left Operand</b></em>' containment reference.
@@ -510,7 +529,7 @@ public interface ExpressionsPackage extends EPackage {
 	 * @see org.yakindu.base.expressions.expressions.impl.ExpressionsPackageImpl#getBitwiseAndExpression()
 	 * @generated
 	 */
-	int BITWISE_AND_EXPRESSION = 14;
+	int BITWISE_AND_EXPRESSION = 15;
 
 	/**
 	 * The feature id for the '<em><b>Left Operand</b></em>' containment reference.
@@ -547,7 +566,7 @@ public interface ExpressionsPackage extends EPackage {
 	 * @see org.yakindu.base.expressions.expressions.impl.ExpressionsPackageImpl#getLogicalRelationExpression()
 	 * @generated
 	 */
-	int LOGICAL_RELATION_EXPRESSION = 15;
+	int LOGICAL_RELATION_EXPRESSION = 16;
 
 	/**
 	 * The feature id for the '<em><b>Left Operand</b></em>' containment reference.
@@ -593,7 +612,7 @@ public interface ExpressionsPackage extends EPackage {
 	 * @see org.yakindu.base.expressions.expressions.impl.ExpressionsPackageImpl#getShiftExpression()
 	 * @generated
 	 */
-	int SHIFT_EXPRESSION = 16;
+	int SHIFT_EXPRESSION = 17;
 
 	/**
 	 * The feature id for the '<em><b>Left Operand</b></em>' containment reference.
@@ -639,7 +658,7 @@ public interface ExpressionsPackage extends EPackage {
 	 * @see org.yakindu.base.expressions.expressions.impl.ExpressionsPackageImpl#getNumericalAddSubtractExpression()
 	 * @generated
 	 */
-	int NUMERICAL_ADD_SUBTRACT_EXPRESSION = 17;
+	int NUMERICAL_ADD_SUBTRACT_EXPRESSION = 18;
 
 	/**
 	 * The feature id for the '<em><b>Left Operand</b></em>' containment reference.
@@ -685,7 +704,7 @@ public interface ExpressionsPackage extends EPackage {
 	 * @see org.yakindu.base.expressions.expressions.impl.ExpressionsPackageImpl#getNumericalMultiplyDivideExpression()
 	 * @generated
 	 */
-	int NUMERICAL_MULTIPLY_DIVIDE_EXPRESSION = 18;
+	int NUMERICAL_MULTIPLY_DIVIDE_EXPRESSION = 19;
 
 	/**
 	 * The feature id for the '<em><b>Left Operand</b></em>' containment reference.
@@ -731,7 +750,7 @@ public interface ExpressionsPackage extends EPackage {
 	 * @see org.yakindu.base.expressions.expressions.impl.ExpressionsPackageImpl#getNumericalUnaryExpression()
 	 * @generated
 	 */
-	int NUMERICAL_UNARY_EXPRESSION = 19;
+	int NUMERICAL_UNARY_EXPRESSION = 20;
 
 	/**
 	 * The feature id for the '<em><b>Operator</b></em>' attribute.
@@ -768,7 +787,7 @@ public interface ExpressionsPackage extends EPackage {
 	 * @see org.yakindu.base.expressions.expressions.impl.ExpressionsPackageImpl#getPrimitiveValueExpression()
 	 * @generated
 	 */
-	int PRIMITIVE_VALUE_EXPRESSION = 20;
+	int PRIMITIVE_VALUE_EXPRESSION = 21;
 
 	/**
 	 * The feature id for the '<em><b>Value</b></em>' containment reference.
@@ -796,7 +815,7 @@ public interface ExpressionsPackage extends EPackage {
 	 * @see org.yakindu.base.expressions.expressions.impl.ExpressionsPackageImpl#getFeatureCall()
 	 * @generated
 	 */
-	int FEATURE_CALL = 21;
+	int FEATURE_CALL = 22;
 
 	/**
 	 * The feature id for the '<em><b>Owner</b></em>' containment reference.
@@ -851,7 +870,7 @@ public interface ExpressionsPackage extends EPackage {
 	 * @see org.yakindu.base.expressions.expressions.impl.ExpressionsPackageImpl#getElementReferenceExpression()
 	 * @generated
 	 */
-	int ELEMENT_REFERENCE_EXPRESSION = 22;
+	int ELEMENT_REFERENCE_EXPRESSION = 23;
 
 	/**
 	 * The feature id for the '<em><b>Reference</b></em>' reference.
@@ -897,7 +916,7 @@ public interface ExpressionsPackage extends EPackage {
 	 * @see org.yakindu.base.expressions.expressions.impl.ExpressionsPackageImpl#getParenthesizedExpression()
 	 * @generated
 	 */
-	int PARENTHESIZED_EXPRESSION = 23;
+	int PARENTHESIZED_EXPRESSION = 24;
 
 	/**
 	 * The feature id for the '<em><b>Expression</b></em>' containment reference.
@@ -925,7 +944,7 @@ public interface ExpressionsPackage extends EPackage {
 	 * @see org.yakindu.base.expressions.expressions.impl.ExpressionsPackageImpl#getAssignmentOperator()
 	 * @generated
 	 */
-	int ASSIGNMENT_OPERATOR = 24;
+	int ASSIGNMENT_OPERATOR = 25;
 
 	/**
 	 * The meta object id for the '{@link org.yakindu.base.expressions.expressions.ShiftOperator <em>Shift Operator</em>}' enum.
@@ -935,7 +954,7 @@ public interface ExpressionsPackage extends EPackage {
 	 * @see org.yakindu.base.expressions.expressions.impl.ExpressionsPackageImpl#getShiftOperator()
 	 * @generated
 	 */
-	int SHIFT_OPERATOR = 25;
+	int SHIFT_OPERATOR = 26;
 
 	/**
 	 * The meta object id for the '{@link org.yakindu.base.expressions.expressions.AdditiveOperator <em>Additive Operator</em>}' enum.
@@ -945,7 +964,7 @@ public interface ExpressionsPackage extends EPackage {
 	 * @see org.yakindu.base.expressions.expressions.impl.ExpressionsPackageImpl#getAdditiveOperator()
 	 * @generated
 	 */
-	int ADDITIVE_OPERATOR = 26;
+	int ADDITIVE_OPERATOR = 27;
 
 	/**
 	 * The meta object id for the '{@link org.yakindu.base.expressions.expressions.MultiplicativeOperator <em>Multiplicative Operator</em>}' enum.
@@ -955,7 +974,7 @@ public interface ExpressionsPackage extends EPackage {
 	 * @see org.yakindu.base.expressions.expressions.impl.ExpressionsPackageImpl#getMultiplicativeOperator()
 	 * @generated
 	 */
-	int MULTIPLICATIVE_OPERATOR = 27;
+	int MULTIPLICATIVE_OPERATOR = 28;
 
 	/**
 	 * The meta object id for the '{@link org.yakindu.base.expressions.expressions.UnaryOperator <em>Unary Operator</em>}' enum.
@@ -965,7 +984,7 @@ public interface ExpressionsPackage extends EPackage {
 	 * @see org.yakindu.base.expressions.expressions.impl.ExpressionsPackageImpl#getUnaryOperator()
 	 * @generated
 	 */
-	int UNARY_OPERATOR = 28;
+	int UNARY_OPERATOR = 29;
 
 	/**
 	 * The meta object id for the '{@link org.yakindu.base.expressions.expressions.RelationalOperator <em>Relational Operator</em>}' enum.
@@ -975,7 +994,7 @@ public interface ExpressionsPackage extends EPackage {
 	 * @see org.yakindu.base.expressions.expressions.impl.ExpressionsPackageImpl#getRelationalOperator()
 	 * @generated
 	 */
-	int RELATIONAL_OPERATOR = 29;
+	int RELATIONAL_OPERATOR = 30;
 
 
 	/**
@@ -1103,6 +1122,16 @@ public interface ExpressionsPackage extends EPackage {
 	 */
 	EAttribute getStringLiteral_Value();
 
+	/**
+	 * Returns the meta object for class '{@link org.yakindu.base.expressions.expressions.NullLiteral <em>Null Literal</em>}'.
+	 * <!-- begin-user-doc -->
+	 * <!-- end-user-doc -->
+	 * @return the meta object for class '<em>Null Literal</em>'.
+	 * @see org.yakindu.base.expressions.expressions.NullLiteral
+	 * @generated
+	 */
+	EClass getNullLiteral();
+
 	/**
 	 * Returns the meta object for class '{@link org.yakindu.base.expressions.expressions.AssignmentExpression <em>Assignment Expression</em>}'.
 	 * <!-- begin-user-doc -->
@@ -1905,6 +1934,16 @@ public interface ExpressionsPackage extends EPackage {
 		 */
 		EAttribute STRING_LITERAL__VALUE = eINSTANCE.getStringLiteral_Value();
 
+		/**
+		 * The meta object literal for the '{@link org.yakindu.base.expressions.expressions.impl.NullLiteralImpl <em>Null Literal</em>}' class.
+		 * <!-- begin-user-doc -->
+		 * <!-- end-user-doc -->
+		 * @see org.yakindu.base.expressions.expressions.impl.NullLiteralImpl
+		 * @see org.yakindu.base.expressions.expressions.impl.ExpressionsPackageImpl#getNullLiteral()
+		 * @generated
+		 */
+		EClass NULL_LITERAL = eINSTANCE.getNullLiteral();
+
 		/**
 		 * The meta object literal for the '{@link org.yakindu.base.expressions.expressions.impl.AssignmentExpressionImpl <em>Assignment Expression</em>}' class.
 		 * <!-- begin-user-doc -->

+ 17 - 0
plugins/org.yakindu.base.expressions/emf-gen/org/yakindu/base/expressions/expressions/NullLiteral.java

@@ -0,0 +1,17 @@
+/**
+ */
+package org.yakindu.base.expressions.expressions;
+
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the model object '<em><b>Null Literal</b></em>'.
+ * <!-- end-user-doc -->
+ *
+ *
+ * @see org.yakindu.base.expressions.expressions.ExpressionsPackage#getNullLiteral()
+ * @model
+ * @generated
+ */
+public interface NullLiteral extends Literal {
+} // NullLiteral

+ 11 - 0
plugins/org.yakindu.base.expressions/emf-gen/org/yakindu/base/expressions/expressions/impl/ExpressionsFactoryImpl.java

@@ -64,6 +64,7 @@ public class ExpressionsFactoryImpl extends EFactoryImpl implements ExpressionsF
 			case ExpressionsPackage.REAL_LITERAL: return createRealLiteral();
 			case ExpressionsPackage.HEX_LITERAL: return createHexLiteral();
 			case ExpressionsPackage.STRING_LITERAL: return createStringLiteral();
+			case ExpressionsPackage.NULL_LITERAL: return createNullLiteral();
 			case ExpressionsPackage.ASSIGNMENT_EXPRESSION: return createAssignmentExpression();
 			case ExpressionsPackage.CONDITIONAL_EXPRESSION: return createConditionalExpression();
 			case ExpressionsPackage.LOGICAL_OR_EXPRESSION: return createLogicalOrExpression();
@@ -206,6 +207,16 @@ public class ExpressionsFactoryImpl extends EFactoryImpl implements ExpressionsF
 		return stringLiteral;
 	}
 
+	/**
+	 * <!-- begin-user-doc -->
+	 * <!-- end-user-doc -->
+	 * @generated
+	 */
+	public NullLiteral createNullLiteral() {
+		NullLiteralImpl nullLiteral = new NullLiteralImpl();
+		return nullLiteral;
+	}
+
 	/**
 	 * <!-- begin-user-doc -->
 	 * <!-- end-user-doc -->

+ 22 - 0
plugins/org.yakindu.base.expressions/emf-gen/org/yakindu/base/expressions/expressions/impl/ExpressionsPackageImpl.java

@@ -31,6 +31,7 @@ import org.yakindu.base.expressions.expressions.LogicalNotExpression;
 import org.yakindu.base.expressions.expressions.LogicalOrExpression;
 import org.yakindu.base.expressions.expressions.LogicalRelationExpression;
 import org.yakindu.base.expressions.expressions.MultiplicativeOperator;
+import org.yakindu.base.expressions.expressions.NullLiteral;
 import org.yakindu.base.expressions.expressions.NumericalAddSubtractExpression;
 import org.yakindu.base.expressions.expressions.NumericalMultiplyDivideExpression;
 import org.yakindu.base.expressions.expressions.NumericalUnaryExpression;
@@ -99,6 +100,13 @@ public class ExpressionsPackageImpl extends EPackageImpl implements ExpressionsP
 	 */
 	private EClass stringLiteralEClass = null;
 
+	/**
+	 * <!-- begin-user-doc -->
+	 * <!-- end-user-doc -->
+	 * @generated
+	 */
+	private EClass nullLiteralEClass = null;
+
 	/**
 	 * <!-- begin-user-doc -->
 	 * <!-- end-user-doc -->
@@ -429,6 +437,15 @@ public class ExpressionsPackageImpl extends EPackageImpl implements ExpressionsP
 		return (EAttribute)stringLiteralEClass.getEStructuralFeatures().get(0);
 	}
 
+	/**
+	 * <!-- begin-user-doc -->
+	 * <!-- end-user-doc -->
+	 * @generated
+	 */
+	public EClass getNullLiteral() {
+		return nullLiteralEClass;
+	}
+
 	/**
 	 * <!-- begin-user-doc -->
 	 * <!-- end-user-doc -->
@@ -1043,6 +1060,8 @@ public class ExpressionsPackageImpl extends EPackageImpl implements ExpressionsP
 		stringLiteralEClass = createEClass(STRING_LITERAL);
 		createEAttribute(stringLiteralEClass, STRING_LITERAL__VALUE);
 
+		nullLiteralEClass = createEClass(NULL_LITERAL);
+
 		assignmentExpressionEClass = createEClass(ASSIGNMENT_EXPRESSION);
 		createEReference(assignmentExpressionEClass, ASSIGNMENT_EXPRESSION__VAR_REF);
 		createEAttribute(assignmentExpressionEClass, ASSIGNMENT_EXPRESSION__OPERATOR);
@@ -1159,6 +1178,7 @@ public class ExpressionsPackageImpl extends EPackageImpl implements ExpressionsP
 		realLiteralEClass.getESuperTypes().add(this.getLiteral());
 		hexLiteralEClass.getESuperTypes().add(this.getLiteral());
 		stringLiteralEClass.getESuperTypes().add(this.getLiteral());
+		nullLiteralEClass.getESuperTypes().add(this.getLiteral());
 		assignmentExpressionEClass.getESuperTypes().add(this.getExpression());
 		conditionalExpressionEClass.getESuperTypes().add(this.getExpression());
 		logicalOrExpressionEClass.getESuperTypes().add(this.getExpression());
@@ -1197,6 +1217,8 @@ public class ExpressionsPackageImpl extends EPackageImpl implements ExpressionsP
 		initEClass(stringLiteralEClass, StringLiteral.class, "StringLiteral", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
 		initEAttribute(getStringLiteral_Value(), ecorePackage.getEString(), "value", null, 0, 1, StringLiteral.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
 
+		initEClass(nullLiteralEClass, NullLiteral.class, "NullLiteral", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
+
 		initEClass(assignmentExpressionEClass, AssignmentExpression.class, "AssignmentExpression", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
 		initEReference(getAssignmentExpression_VarRef(), this.getExpression(), null, "varRef", null, 0, 1, AssignmentExpression.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
 		initEAttribute(getAssignmentExpression_Operator(), this.getAssignmentOperator(), "operator", null, 0, 1, AssignmentExpression.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);

+ 39 - 0
plugins/org.yakindu.base.expressions/emf-gen/org/yakindu/base/expressions/expressions/impl/NullLiteralImpl.java

@@ -0,0 +1,39 @@
+/**
+ */
+package org.yakindu.base.expressions.expressions.impl;
+
+import org.eclipse.emf.ecore.EClass;
+
+import org.yakindu.base.expressions.expressions.ExpressionsPackage;
+import org.yakindu.base.expressions.expressions.NullLiteral;
+
+/**
+ * <!-- begin-user-doc -->
+ * An implementation of the model object '<em><b>Null Literal</b></em>'.
+ * <!-- end-user-doc -->
+ * <p>
+ * </p>
+ *
+ * @generated
+ */
+public class NullLiteralImpl extends LiteralImpl implements NullLiteral {
+	/**
+	 * <!-- begin-user-doc -->
+	 * <!-- end-user-doc -->
+	 * @generated
+	 */
+	protected NullLiteralImpl() {
+		super();
+	}
+
+	/**
+	 * <!-- begin-user-doc -->
+	 * <!-- end-user-doc -->
+	 * @generated
+	 */
+	@Override
+	protected EClass eStaticClass() {
+		return ExpressionsPackage.Literals.NULL_LITERAL;
+	}
+
+} //NullLiteralImpl

+ 18 - 0
plugins/org.yakindu.base.expressions/emf-gen/org/yakindu/base/expressions/expressions/util/ExpressionsAdapterFactory.java

@@ -96,6 +96,10 @@ public class ExpressionsAdapterFactory extends AdapterFactoryImpl {
 				return createStringLiteralAdapter();
 			}
 			@Override
+			public Adapter caseNullLiteral(NullLiteral object) {
+				return createNullLiteralAdapter();
+			}
+			@Override
 			public Adapter caseAssignmentExpression(AssignmentExpression object) {
 				return createAssignmentExpressionAdapter();
 			}
@@ -281,6 +285,20 @@ public class ExpressionsAdapterFactory extends AdapterFactoryImpl {
 		return null;
 	}
 
+	/**
+	 * Creates a new adapter for an object of class '{@link org.yakindu.base.expressions.expressions.NullLiteral <em>Null Literal</em>}'.
+	 * <!-- begin-user-doc -->
+	 * 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.
+	 * <!-- end-user-doc -->
+	 * @return the new adapter.
+	 * @see org.yakindu.base.expressions.expressions.NullLiteral
+	 * @generated
+	 */
+	public Adapter createNullLiteralAdapter() {
+		return null;
+	}
+
 	/**
 	 * Creates a new adapter for an object of class '{@link org.yakindu.base.expressions.expressions.AssignmentExpression <em>Assignment Expression</em>}'.
 	 * <!-- begin-user-doc -->

+ 22 - 0
plugins/org.yakindu.base.expressions/emf-gen/org/yakindu/base/expressions/expressions/util/ExpressionsSwitch.java

@@ -113,6 +113,13 @@ public class ExpressionsSwitch<T> extends Switch<T> {
 				if (result == null) result = defaultCase(theEObject);
 				return result;
 			}
+			case ExpressionsPackage.NULL_LITERAL: {
+				NullLiteral nullLiteral = (NullLiteral)theEObject;
+				T result = caseNullLiteral(nullLiteral);
+				if (result == null) result = caseLiteral(nullLiteral);
+				if (result == null) result = defaultCase(theEObject);
+				return result;
+			}
 			case ExpressionsPackage.ASSIGNMENT_EXPRESSION: {
 				AssignmentExpression assignmentExpression = (AssignmentExpression)theEObject;
 				T result = caseAssignmentExpression(assignmentExpression);
@@ -341,6 +348,21 @@ public class ExpressionsSwitch<T> extends Switch<T> {
 		return null;
 	}
 
+	/**
+	 * Returns the result of interpreting the object as an instance of '<em>Null Literal</em>'.
+	 * <!-- begin-user-doc -->
+	 * This implementation returns null;
+	 * returning a non-null result will terminate the switch.
+	 * <!-- end-user-doc -->
+	 * @param object the target of the switch.
+	 * @return the result of interpreting the object as an instance of '<em>Null Literal</em>'.
+	 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
+	 * @generated
+	 */
+	public T caseNullLiteral(NullLiteral object) {
+		return null;
+	}
+
 	/**
 	 * Returns the result of interpreting the object as an instance of '<em>Assignment Expression</em>'.
 	 * <!-- begin-user-doc -->

+ 1 - 0
plugins/org.yakindu.base.expressions/model/Expressions.ecore

@@ -19,6 +19,7 @@
   <eClassifiers xsi:type="ecore:EClass" name="StringLiteral" eSuperTypes="#//Literal">
     <eStructuralFeatures xsi:type="ecore:EAttribute" name="value" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
   </eClassifiers>
+  <eClassifiers xsi:type="ecore:EClass" name="NullLiteral" eSuperTypes="#//Literal"/>
   <eClassifiers xsi:type="ecore:EEnum" name="AssignmentOperator">
     <eLiterals name="assign" literal="="/>
     <eLiterals name="multAssign" value="1" literal="*="/>

+ 4 - 2
plugins/org.yakindu.base.expressions/src/org/yakindu/base/expressions/Expressions.xtext

@@ -97,7 +97,7 @@ ParenthesizedExpression returns Expression:
 	{ParenthesizedExpression} '(' expression=Expression ')';
 
 Literal:
-	BoolLiteral | IntLiteral | HexLiteral | RealLiteral | StringLiteral;
+	BoolLiteral | IntLiteral | HexLiteral | RealLiteral | StringLiteral | NullLiteral;
 
 BoolLiteral:
 	{BoolLiteral} value=BOOL;
@@ -113,7 +113,9 @@ HexLiteral:
 
 StringLiteral:
 	{StringLiteral} value=STRING;
-
+NullLiteral:
+	{NullLiteral} 'null'
+;
 LogicalAndOperator:
 	'&&';