Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
View | Details | Raw Unified | Return to bug 288040
Collapse All | Expand All

(-)src/org/eclipse/ocl/uml/tests/PrecedenceTest.java (-1 / +41 lines)
Lines 1-7 Link Here
1
/**
1
/**
2
 * <copyright>
2
 * <copyright>
3
 * 
3
 * 
4
 * Copyright (c) 2005, 2008 IBM Corporation, Zeligsoft Inc., and others.
4
 * Copyright (c) 2005, 2009 IBM Corporation, Zeligsoft Inc., and others.
5
 * All rights reserved. This program and the accompanying materials
5
 * All rights reserved. This program and the accompanying materials
6
 * are made available under the terms of the Eclipse Public License v1.0
6
 * are made available under the terms of the Eclipse Public License v1.0
7
 * which accompanies this distribution, and is available at
7
 * which accompanies this distribution, and is available at
Lines 10-15 Link Here
10
 * Contributors:
10
 * Contributors:
11
 *   IBM - Initial API and implementation
11
 *   IBM - Initial API and implementation
12
 *   Zeligsoft - Bug 248869
12
 *   Zeligsoft - Bug 248869
13
 *   E.D.Willink - Bug 288040 xor/or/and
13
 *
14
 *
14
 * </copyright>
15
 * </copyright>
15
 *
16
 *
Lines 24-33 Link Here
24
import org.eclipse.emf.common.util.URI;
25
import org.eclipse.emf.common.util.URI;
25
import org.eclipse.emf.ecore.resource.Resource;
26
import org.eclipse.emf.ecore.resource.Resource;
26
import org.eclipse.emf.ecore.resource.impl.ResourceImpl;
27
import org.eclipse.emf.ecore.resource.impl.ResourceImpl;
28
import org.eclipse.ocl.ParserException;
29
import org.eclipse.ocl.SemanticException;
27
import org.eclipse.ocl.expressions.LetExp;
30
import org.eclipse.ocl.expressions.LetExp;
28
import org.eclipse.ocl.expressions.OCLExpression;
31
import org.eclipse.ocl.expressions.OCLExpression;
29
import org.eclipse.ocl.expressions.OperationCallExp;
32
import org.eclipse.ocl.expressions.OperationCallExp;
30
import org.eclipse.ocl.expressions.PropertyCallExp;
33
import org.eclipse.ocl.expressions.PropertyCallExp;
34
import org.eclipse.ocl.internal.l10n.OCLMessages;
35
import org.eclipse.ocl.options.ParsingOptions;
36
import org.eclipse.ocl.util.OCLUtil;
31
import org.eclipse.uml2.uml.Class;
37
import org.eclipse.uml2.uml.Class;
32
import org.eclipse.uml2.uml.Classifier;
38
import org.eclipse.uml2.uml.Classifier;
33
import org.eclipse.uml2.uml.Operation;
39
import org.eclipse.uml2.uml.Operation;
Lines 174-179 Link Here
174
            fail("Failed to parse: " + e.getLocalizedMessage()); //$NON-NLS-1$
180
            fail("Failed to parse: " + e.getLocalizedMessage()); //$NON-NLS-1$
175
        }
181
        }
176
    }
182
    }
183
        
184
    public void test_or_and_precedence() throws ParserException {
185
        helper.setContext(class1);
186
		assertTrue(check(helper, class1, "((true or false) and false) = false")); //$NON-NLS-1$
187
//1.x		assertTrue(check(helper, class1, "(true or false and false) = false")); //$NON-NLS-1$
188
		helper.createInvariant("(true or false and false) = true"); //$NON-NLS-1$
189
		try {
190
			OCLUtil.checkForErrorsOrWarnings(helper.getEnvironment());
191
			fail("Expected warning not found"); //$NON-NLS-1$
192
		} catch (SemanticException e) {
193
			System.out.println("Got expected warning: " + e.getLocalizedMessage()); //$NON-NLS-1$
194
			assertEquals(OCLMessages.XorOrAndPrecedence_WARNING, e.getMessage());
195
		}
196
		ParsingOptions.setOption(helper.getEnvironment(), ParsingOptions.WARN_OF_XOR_OR_AND_PRECEDENCE_CHANGE, false);
197
		helper.createInvariant("(true or false and false) = true"); //$NON-NLS-1$
198
		OCLUtil.checkForErrorsOrWarnings(helper.getEnvironment());
199
    }
200
    
201
    public void test_xor_or_precedence() throws ParserException {
202
        helper.setContext(class1);
203
		assertTrue(check(helper, class1, "((true xor false) or true) = true")); //$NON-NLS-1$
204
//1.x		assertTrue(check(helper, class1, "(true xor false or true) = true")); //$NON-NLS-1$
205
		helper.createInvariant("(true xor false or true) = false"); //$NON-NLS-1$
206
		try {
207
			OCLUtil.checkForErrorsOrWarnings(helper.getEnvironment());
208
			fail("Expected warning not found"); //$NON-NLS-1$
209
		} catch (SemanticException e) {
210
			System.out.println("Got expected warning: " + e.getLocalizedMessage()); //$NON-NLS-1$
211
			assertEquals(OCLMessages.XorOrAndPrecedence_WARNING, e.getMessage());
212
		}
213
		ParsingOptions.setOption(helper.getEnvironment(), ParsingOptions.WARN_OF_XOR_OR_AND_PRECEDENCE_CHANGE, false);
214
		helper.createInvariant("(true xor false or true) = false"); //$NON-NLS-1$
215
		OCLUtil.checkForErrorsOrWarnings(helper.getEnvironment());
216
    }
177
    
217
    
178
    //
218
    //
179
    // Framework methods
219
    // Framework methods
(-)META-INF/MANIFEST.MF (+1 lines)
Lines 15-20 Link Here
15
 org.eclipse.ocl.expressions.operations,
15
 org.eclipse.ocl.expressions.operations,
16
 org.eclipse.ocl.expressions.util,
16
 org.eclipse.ocl.expressions.util,
17
 org.eclipse.ocl.helper,
17
 org.eclipse.ocl.helper,
18
 org.eclipse.ocl.internal.l10n;x-friends:="org.eclipse.ocl.ecore.tests,org.eclipse.ocl.uml.tests",
18
 org.eclipse.ocl.lpg,
19
 org.eclipse.ocl.lpg,
19
 org.eclipse.ocl.options,
20
 org.eclipse.ocl.options,
20
 org.eclipse.ocl.parser,
21
 org.eclipse.ocl.parser,
(-)src/org/eclipse/ocl/cst/OperationCallExpCS.java (+35 lines)
Lines 22-27 Link Here
22
 * A representation of the model object '<em><b>Operation Call Exp CS</b></em>'.
22
 * A representation of the model object '<em><b>Operation Call Exp CS</b></em>'.
23
 * <!-- end-user-doc -->
23
 * <!-- end-user-doc -->
24
 *
24
 *
25
 * <p>
26
 * The following features are supported:
27
 * <ul>
28
 *   <li>{@link org.eclipse.ocl.cst.OperationCallExpCS#getIsParenthesized <em>Is Parenthesized</em>}</li>
29
 * </ul>
30
 * </p>
25
 *
31
 *
26
 * @see org.eclipse.ocl.cst.CSTPackage#getOperationCallExpCS()
32
 * @see org.eclipse.ocl.cst.CSTPackage#getOperationCallExpCS()
27
 * @model
33
 * @model
Lines 31-34 Link Here
31
 */
37
 */
32
public interface OperationCallExpCS
38
public interface OperationCallExpCS
33
		extends FeatureCallExpCS {
39
		extends FeatureCallExpCS {
40
41
	/**
42
	 * Returns the value of the '<em><b>Is Parenthesized</b></em>' attribute.
43
	 * The default value is <code>"false"</code>.
44
	 * <!-- begin-user-doc -->
45
	 * <p>
46
	 * If the meaning of the '<em>Is Parenthesized</em>' attribute isn't clear,
47
	 * there really should be more of a description here...
48
	 * </p>
49
	 * @since 3.0
50
	 * <!-- end-user-doc -->
51
	 * @return the value of the '<em>Is Parenthesized</em>' attribute.
52
	 * @see #setIsParenthesized(Boolean)
53
	 * @see org.eclipse.ocl.cst.CSTPackage#getOperationCallExpCS_IsParenthesized()
54
	 * @model default="false"
55
	 * @generated
56
	 */
57
	Boolean getIsParenthesized();
58
59
	/**
60
	 * Sets the value of the '{@link org.eclipse.ocl.cst.OperationCallExpCS#getIsParenthesized <em>Is Parenthesized</em>}' attribute.
61
	 * <!-- begin-user-doc -->
62
	 * @since 3.0
63
	 * <!-- end-user-doc -->
64
	 * @param value the new value of the '<em>Is Parenthesized</em>' attribute.
65
	 * @see #getIsParenthesized()
66
	 * @generated
67
	 */
68
	void setIsParenthesized(Boolean value);
34
} // OperationCallExpCS
69
} // OperationCallExpCS
(-)src/org/eclipse/ocl/cst/CSTPackage.java (-1 / +33 lines)
Lines 4707-4712 Link Here
4707
	int OPERATION_CALL_EXP_CS__IS_MARKED_PRE_CS = FEATURE_CALL_EXP_CS__IS_MARKED_PRE_CS;
4707
	int OPERATION_CALL_EXP_CS__IS_MARKED_PRE_CS = FEATURE_CALL_EXP_CS__IS_MARKED_PRE_CS;
4708
4708
4709
	/**
4709
	/**
4710
	 * The feature id for the '<em><b>Is Parenthesized</b></em>' attribute.
4711
	 * <!-- begin-user-doc -->
4712
	 * <!-- end-user-doc -->
4713
	 * @generated
4714
	 * @ordered
4715
	 * @noreference This field is not intended to be referenced by clients.
4716
	 */
4717
	int OPERATION_CALL_EXP_CS__IS_PARENTHESIZED = FEATURE_CALL_EXP_CS_FEATURE_COUNT + 0;
4718
4719
	/**
4710
	 * The number of structural features of the '<em>Operation Call Exp CS</em>' class.
4720
	 * The number of structural features of the '<em>Operation Call Exp CS</em>' class.
4711
	 * <!-- begin-user-doc -->
4721
	 * <!-- begin-user-doc -->
4712
	 * <!-- end-user-doc -->
4722
	 * <!-- end-user-doc -->
Lines 4714-4720 Link Here
4714
	 * @ordered
4724
	 * @ordered
4715
	 * @noreference This field is not intended to be referenced by clients.
4725
	 * @noreference This field is not intended to be referenced by clients.
4716
	 */
4726
	 */
4717
	int OPERATION_CALL_EXP_CS_FEATURE_COUNT = FEATURE_CALL_EXP_CS_FEATURE_COUNT + 0;
4727
	int OPERATION_CALL_EXP_CS_FEATURE_COUNT = FEATURE_CALL_EXP_CS_FEATURE_COUNT + 1;
4718
4728
4719
	/**
4729
	/**
4720
	 * The meta object id for the '{@link org.eclipse.ocl.cst.impl.StateExpCSImpl <em>State Exp CS</em>}' class.
4730
	 * The meta object id for the '{@link org.eclipse.ocl.cst.impl.StateExpCSImpl <em>State Exp CS</em>}' class.
Lines 6331-6336 Link Here
6331
	EClass getOperationCallExpCS();
6341
	EClass getOperationCallExpCS();
6332
6342
6333
	/**
6343
	/**
6344
	 * Returns the meta object for the attribute '{@link org.eclipse.ocl.cst.OperationCallExpCS#getIsParenthesized <em>Is Parenthesized</em>}'.
6345
	 * <!-- begin-user-doc -->
6346
	 * @since 3.0
6347
	 * <!-- end-user-doc -->
6348
	 * @return the meta object for the attribute '<em>Is Parenthesized</em>'.
6349
	 * @see org.eclipse.ocl.cst.OperationCallExpCS#getIsParenthesized()
6350
	 * @see #getOperationCallExpCS()
6351
	 * @generated
6352
	 */
6353
	EAttribute getOperationCallExpCS_IsParenthesized();
6354
6355
	/**
6334
	 * Returns the meta object for class '{@link org.eclipse.ocl.cst.StateExpCS <em>State Exp CS</em>}'.
6356
	 * Returns the meta object for class '{@link org.eclipse.ocl.cst.StateExpCS <em>State Exp CS</em>}'.
6335
	 * <!-- begin-user-doc -->
6357
	 * <!-- begin-user-doc -->
6336
	 * <!-- end-user-doc -->
6358
	 * <!-- end-user-doc -->
Lines 7670-7675 Link Here
7670
		EClass OPERATION_CALL_EXP_CS = eINSTANCE.getOperationCallExpCS();
7692
		EClass OPERATION_CALL_EXP_CS = eINSTANCE.getOperationCallExpCS();
7671
7693
7672
		/**
7694
		/**
7695
		 * The meta object literal for the '<em><b>Is Parenthesized</b></em>' attribute feature.
7696
		 * <!-- begin-user-doc -->
7697
		 * @since 3.0
7698
		 * <!-- end-user-doc -->
7699
		 * @generated
7700
		 */
7701
		EAttribute OPERATION_CALL_EXP_CS__IS_PARENTHESIZED = eINSTANCE
7702
			.getOperationCallExpCS_IsParenthesized();
7703
7704
		/**
7673
		 * The meta object literal for the '{@link org.eclipse.ocl.cst.impl.StateExpCSImpl <em>State Exp CS</em>}' class.
7705
		 * The meta object literal for the '{@link org.eclipse.ocl.cst.impl.StateExpCSImpl <em>State Exp CS</em>}' class.
7674
		 * <!-- begin-user-doc -->
7706
		 * <!-- begin-user-doc -->
7675
		 * <!-- end-user-doc -->
7707
		 * <!-- end-user-doc -->
(-)src/org/eclipse/ocl/cst/impl/CSTPackageImpl.java (+17 lines)
Lines 1526-1531 Link Here
1526
1526
1527
	/**
1527
	/**
1528
	 * <!-- begin-user-doc -->
1528
	 * <!-- begin-user-doc -->
1529
	 * @since 3.0
1530
	 * <!-- end-user-doc -->
1531
	 * @generated
1532
	 */
1533
	public EAttribute getOperationCallExpCS_IsParenthesized() {
1534
		return (EAttribute) operationCallExpCSEClass.getEStructuralFeatures()
1535
			.get(0);
1536
	}
1537
1538
	/**
1539
	 * <!-- begin-user-doc -->
1529
	 * <!-- end-user-doc -->
1540
	 * <!-- end-user-doc -->
1530
	 * @generated
1541
	 * @generated
1531
	 */
1542
	 */
Lines 2109-2114 Link Here
2109
			FEATURE_CALL_EXP_CS__IS_MARKED_PRE_CS);
2120
			FEATURE_CALL_EXP_CS__IS_MARKED_PRE_CS);
2110
2121
2111
		operationCallExpCSEClass = createEClass(OPERATION_CALL_EXP_CS);
2122
		operationCallExpCSEClass = createEClass(OPERATION_CALL_EXP_CS);
2123
		createEAttribute(operationCallExpCSEClass,
2124
			OPERATION_CALL_EXP_CS__IS_PARENTHESIZED);
2112
2125
2113
		stateExpCSEClass = createEClass(STATE_EXP_CS);
2126
		stateExpCSEClass = createEClass(STATE_EXP_CS);
2114
		createEAttribute(stateExpCSEClass, STATE_EXP_CS__SEQUENCE_OF_NAMES);
2127
		createEAttribute(stateExpCSEClass, STATE_EXP_CS__SEQUENCE_OF_NAMES);
Lines 2836-2841 Link Here
2836
			operationCallExpCSEClass,
2849
			operationCallExpCSEClass,
2837
			OperationCallExpCS.class,
2850
			OperationCallExpCS.class,
2838
			"OperationCallExpCS", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$
2851
			"OperationCallExpCS", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$
2852
		initEAttribute(
2853
			getOperationCallExpCS_IsParenthesized(),
2854
			ecorePackage.getEBooleanObject(),
2855
			"isParenthesized", "false", 0, 1, OperationCallExpCS.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ //$NON-NLS-2$
2839
2856
2840
		initEClass(
2857
		initEClass(
2841
			stateExpCSEClass,
2858
			stateExpCSEClass,
(-)src/org/eclipse/ocl/cst/impl/OperationCallExpCSImpl.java (+130 lines)
Lines 17-23 Link Here
17
 */
17
 */
18
package org.eclipse.ocl.cst.impl;
18
package org.eclipse.ocl.cst.impl;
19
19
20
import org.eclipse.emf.common.notify.Notification;
20
import org.eclipse.emf.ecore.EClass;
21
import org.eclipse.emf.ecore.EClass;
22
import org.eclipse.emf.ecore.impl.ENotificationImpl;
21
import org.eclipse.ocl.cst.CSTPackage;
23
import org.eclipse.ocl.cst.CSTPackage;
22
import org.eclipse.ocl.cst.OperationCallExpCS;
24
import org.eclipse.ocl.cst.OperationCallExpCS;
23
25
Lines 26-31 Link Here
26
 * An implementation of the model object '<em><b>Operation Call Exp CS</b></em>'.
28
 * An implementation of the model object '<em><b>Operation Call Exp CS</b></em>'.
27
 * <!-- end-user-doc -->
29
 * <!-- end-user-doc -->
28
 * <p>
30
 * <p>
31
 * The following features are implemented:
32
 * <ul>
33
 *   <li>{@link org.eclipse.ocl.cst.impl.OperationCallExpCSImpl#getIsParenthesized <em>Is Parenthesized</em>}</li>
34
 * </ul>
29
 * </p>
35
 * </p>
30
 *
36
 *
31
 * @generated
37
 * @generated
Lines 35-40 Link Here
35
		implements OperationCallExpCS {
41
		implements OperationCallExpCS {
36
42
37
	/**
43
	/**
44
	 * The default value of the '{@link #getIsParenthesized() <em>Is Parenthesized</em>}' attribute.
45
	 * <!-- begin-user-doc -->
46
	 * @since 3.0
47
	 * <!-- end-user-doc -->
48
	 * @see #getIsParenthesized()
49
	 * @generated
50
	 * @ordered
51
	 */
52
	protected static final Boolean IS_PARENTHESIZED_EDEFAULT = Boolean.FALSE;
53
54
	/**
55
	 * The cached value of the '{@link #getIsParenthesized() <em>Is Parenthesized</em>}' attribute.
56
	 * <!-- begin-user-doc -->
57
	 * @since 3.0
58
	 * <!-- end-user-doc -->
59
	 * @see #getIsParenthesized()
60
	 * @generated
61
	 * @ordered
62
	 */
63
	protected Boolean isParenthesized = IS_PARENTHESIZED_EDEFAULT;
64
65
	/**
38
	 * <!-- begin-user-doc -->
66
	 * <!-- begin-user-doc -->
39
	 * <!-- end-user-doc -->
67
	 * <!-- end-user-doc -->
40
	 * @generated
68
	 * @generated
Lines 53-56 Link Here
53
		return CSTPackage.Literals.OPERATION_CALL_EXP_CS;
81
		return CSTPackage.Literals.OPERATION_CALL_EXP_CS;
54
	}
82
	}
55
83
84
	/**
85
	 * <!-- begin-user-doc -->
86
	 * @since 3.0
87
	 * <!-- end-user-doc -->
88
	 * @generated
89
	 */
90
	public Boolean getIsParenthesized() {
91
		return isParenthesized;
92
	}
93
94
	/**
95
	 * <!-- begin-user-doc -->
96
	 * @since 3.0
97
	 * <!-- end-user-doc -->
98
	 * @generated
99
	 */
100
	public void setIsParenthesized(Boolean newIsParenthesized) {
101
		Boolean oldIsParenthesized = isParenthesized;
102
		isParenthesized = newIsParenthesized;
103
		if (eNotificationRequired())
104
			eNotify(new ENotificationImpl(this, Notification.SET,
105
				CSTPackage.OPERATION_CALL_EXP_CS__IS_PARENTHESIZED,
106
				oldIsParenthesized, isParenthesized));
107
	}
108
109
	/**
110
	 * <!-- begin-user-doc -->
111
	 * <!-- end-user-doc -->
112
	 * @generated
113
	 */
114
	@Override
115
	public Object eGet(int featureID, boolean resolve, boolean coreType) {
116
		switch (featureID) {
117
			case CSTPackage.OPERATION_CALL_EXP_CS__IS_PARENTHESIZED :
118
				return getIsParenthesized();
119
		}
120
		return super.eGet(featureID, resolve, coreType);
121
	}
122
123
	/**
124
	 * <!-- begin-user-doc -->
125
	 * <!-- end-user-doc -->
126
	 * @generated
127
	 */
128
	@Override
129
	public void eSet(int featureID, Object newValue) {
130
		switch (featureID) {
131
			case CSTPackage.OPERATION_CALL_EXP_CS__IS_PARENTHESIZED :
132
				setIsParenthesized((Boolean) newValue);
133
				return;
134
		}
135
		super.eSet(featureID, newValue);
136
	}
137
138
	/**
139
	 * <!-- begin-user-doc -->
140
	 * <!-- end-user-doc -->
141
	 * @generated
142
	 */
143
	@Override
144
	public void eUnset(int featureID) {
145
		switch (featureID) {
146
			case CSTPackage.OPERATION_CALL_EXP_CS__IS_PARENTHESIZED :
147
				setIsParenthesized(IS_PARENTHESIZED_EDEFAULT);
148
				return;
149
		}
150
		super.eUnset(featureID);
151
	}
152
153
	/**
154
	 * <!-- begin-user-doc -->
155
	 * <!-- end-user-doc -->
156
	 * @generated
157
	 */
158
	@Override
159
	public boolean eIsSet(int featureID) {
160
		switch (featureID) {
161
			case CSTPackage.OPERATION_CALL_EXP_CS__IS_PARENTHESIZED :
162
				return IS_PARENTHESIZED_EDEFAULT == null
163
					? isParenthesized != null
164
					: !IS_PARENTHESIZED_EDEFAULT.equals(isParenthesized);
165
		}
166
		return super.eIsSet(featureID);
167
	}
168
169
	/**
170
	 * <!-- begin-user-doc -->
171
	 * <!-- end-user-doc -->
172
	 * @generated
173
	 */
174
	@Override
175
	public String toString() {
176
		if (eIsProxy())
177
			return super.toString();
178
179
		StringBuffer result = new StringBuffer(super.toString());
180
		result.append(" (isParenthesized: "); //$NON-NLS-1$
181
		result.append(isParenthesized);
182
		result.append(')');
183
		return result.toString();
184
	}
185
56
} //OperationCallExpCSImpl
186
} //OperationCallExpCSImpl
(-)src/org/eclipse/ocl/options/ParsingOptions.java (+29 lines)
Lines 68-73 Link Here
68
68
69
    /**
69
    /**
70
     * <p>
70
     * <p>
71
     * Parsing option indicating whether to generate a warning when the
72
     * OCL 2.1 parsing of distinct xor, or, and precedences leads to a different
73
     * parse to the OCL 2.0 specification of all levels equal.
74
     * The default value of this option is <tt>true</tt>.  To ignore
75
     * compatibility with the OCL 2.0  behaviour in the MDT-OCL 1.x release,
76
     * set this option <tt>false</tt>.
77
     * </p>
78
     * @since 3.0
79
     */
80
    public static final Option<Boolean> WARN_OF_XOR_OR_AND_PRECEDENCE_CHANGE =
81
        new BasicOption<Boolean>("warn.of.xor.or.and.precedence.change", true); //$NON-NLS-1$
82
83
    /**
84
     * <p>
85
     * Parsing option indicating whether to generate a warning when the
86
     * OCL 2.1 parsing of distinct message precedences leads to a different
87
     * parse to the MDT-OCL 1.x release where message and dot and arrow shared
88
     * the same precedence.
89
     * The default value of this option is <tt>true</tt>.  To ignore
90
     * compatibility with the DT-OCL 1.x release,
91
     * set this option <tt>false</tt>.
92
     * </p>
93
     * @since 3.0
94
     */
95
    public static final Option<Boolean> WARN_OF_MESSAGE_PRECEDENCE_CHANGE =
96
        new BasicOption<Boolean>("warn.of.message.precedence.change", true); //$NON-NLS-1$
97
98
    /**
99
     * <p>
71
     * Static instance for the implicit-root-class option token.  It is returned
100
     * Static instance for the implicit-root-class option token.  It is returned
72
     * via an unchecked cast by the {@link #implicitRootClass()} method.
101
     * via an unchecked cast by the {@link #implicitRootClass()} method.
73
     * </p>
102
     * </p>
(-)src/org/eclipse/ocl/parser/AbstractOCLAnalyzer.java (+26 lines)
Lines 3982-3987 Link Here
3982
			OperationCallExpCS operationCallExpCS,
3982
			OperationCallExpCS operationCallExpCS,
3983
			Environment<PK, C, O, P, EL, PM, S, COA, SSA, CT, CLS, E> env) {
3983
			Environment<PK, C, O, P, EL, PM, S, COA, SSA, CT, CLS, E> env) {
3984
3984
3985
		if (ParsingOptions.getValue(env, ParsingOptions.WARN_OF_XOR_OR_AND_PRECEDENCE_CHANGE)) {
3986
			checkForXorOrAndPrecedenceHazard(operationCallExpCS);
3987
		}
3988
3985
		OperationCallExp<C, O> astNode = null;
3989
		OperationCallExp<C, O> astNode = null;
3986
3990
3987
		List<OCLExpression<C>> args = new java.util.ArrayList<OCLExpression<C>>();
3991
		List<OCLExpression<C>> args = new java.util.ArrayList<OCLExpression<C>>();
Lines 4142-4147 Link Here
4142
		return result;
4146
		return result;
4143
	}
4147
	}
4144
4148
4149
	private void checkForXorOrAndPrecedenceHazard(OperationCallExpCS operationCallExpCS) {
4150
		String parentOperationName = operationCallExpCS.getSimpleNameCS().getValue();
4151
		if ("xor".equals(parentOperationName)) { //$NON-NLS-1$
4152
			OCLExpressionCS childExpression = operationCallExpCS.getArguments().get(0);
4153
			if (childExpression instanceof OperationCallExpCS) {
4154
				String childOperationName = ((OperationCallExpCS)childExpression).getSimpleNameCS().getValue();
4155
				if ("or".equals(childOperationName) || "and".equals(childOperationName)) { //$NON-NLS-1$ //$NON-NLS-2$
4156
					getEnvironment().analyzerWarning(OCLMessages.XorOrAndPrecedence_WARNING, "operationCallExpCS", operationCallExpCS); //$NON-NLS-1$
4157
				}
4158
			}
4159
		}
4160
		else if ("or".equals(parentOperationName)) { //$NON-NLS-1$
4161
			OCLExpressionCS childExpression = operationCallExpCS.getArguments().get(0);
4162
			if (childExpression instanceof OperationCallExpCS) {
4163
				String childOperationName = ((OperationCallExpCS)childExpression).getSimpleNameCS().getValue();
4164
				if ("and".equals(childOperationName)) { //$NON-NLS-1$
4165
					getEnvironment().analyzerWarning(OCLMessages.XorOrAndPrecedence_WARNING, "operationCallExpCS", operationCallExpCS); //$NON-NLS-1$
4166
				}
4167
			}
4168
		}
4169
	}
4170
4145
	/**
4171
	/**
4146
	 * MessageExpCS
4172
	 * MessageExpCS
4147
	 * 
4173
	 * 
(-)src/org/eclipse/ocl/parser/EssentialOCL.g
Lines 11-17 Link Here
11
-- *   IBM - Initial API and implementation
11
-- *   IBM - Initial API and implementation
12
-- *   E.D.Willink - Elimination of some shift-reduce conflicts
12
-- *   E.D.Willink - Elimination of some shift-reduce conflicts
13
-- *   E.D.Willink - Remove unnecessary warning suppression
13
-- *   E.D.Willink - Remove unnecessary warning suppression
(-)* E.D.Willink - Bugs 225493, 243976, 259818 (-183 / +32 lines)
Lines 551-636 Link Here
551
	oclExpressionCS -> impliesExpCS
551
	oclExpressionCS -> impliesExpCS
552
	oclExpressionCS -> impliesWithLet
552
	oclExpressionCS -> impliesWithLet
553
	
553
	
554
	impliesExpCS -> andOrXorExpCS
554
	impliesExpCS -> xorExpCS
555
	impliesWithLet -> andOrXorWithLet
555
	impliesWithLet -> xorWithLet
556
	impliesExpCS ::= impliesExpCS implies andOrXorExpCS
556
	impliesExpCS ::= impliesExpCS implies xorExpCS
557
		/.$NewCase./
557
		/.$NewCase./
558
	impliesWithLet ::= impliesExpCS implies andOrXorWithLet
558
	impliesWithLet ::= impliesExpCS implies xorWithLet
559
		/.$NewCase./
559
		/.$NewCase./
560
560
561
	andOrXorExpCS -> equalityExpCS
561
	xorExpCS -> orExpCS
562
	andOrXorWithLet -> equalityWithLet
562
	xorWithLet -> orWithLet
563
	andOrXorExpCS ::= andOrXorExpCS and equalityExpCS
563
	xorExpCS ::= xorExpCS xor orExpCS
564
		/.$NewCase./
564
		/.$NewCase./
565
	andOrXorExpCS ::= andOrXorExpCS or equalityExpCS
565
	xorWithLet ::= xorExpCS xor orWithLet
566
		/.$NewCase./
566
		/.$NewCase./
567
	andOrXorExpCS ::= andOrXorExpCS xor equalityExpCS
567
568
	orExpCS -> andExpCS
569
	orWithLet -> andWithLet
570
	orExpCS ::= orExpCS or andExpCS
568
		/.$NewCase./
571
		/.$NewCase./
569
	andOrXorWithLet ::= andOrXorExpCS and equalityWithLet
572
	orWithLet ::= orExpCS or andWithLet
570
		/.$NewCase./
573
		/.$NewCase./
571
	andOrXorWithLet ::= andOrXorExpCS or equalityWithLet
574
575
	andExpCS -> equalityExpCS
576
	andWithLet -> equalityWithLet
577
	andExpCS ::= andExpCS and equalityExpCS
578
		/.$NewCase./
579
	andWithLet ::= andExpCS and equalityWithLet
572
		/.$NewCase./
580
		/.$NewCase./
573
	andOrXorWithLet ::= andOrXorExpCS xor equalityWithLet
574
		/.$BeginJava
575
					SimpleNameCS simpleNameCS = createSimpleNameCS(
576
								SimpleTypeEnum.STRING_LITERAL,
577
								getTokenText($getToken(2))
578
							);
579
					setOffsets(simpleNameCS, getIToken($getToken(2)));
580
					EList args = new BasicEList();
581
					args.add($getSym(3));
582
					CSTNode result = createOperationCallExpCS(
583
							(OCLExpressionCS)$getSym(1),
584
							simpleNameCS,
585
							args
586
						);
587
					setOffsets(result, (CSTNode)$getSym(1), (CSTNode)$getSym(3));
588
					$setResult(result);
589
		  $EndJava
590
		./
591
581
592
	equalityExpCS -> relationalExpCS
582
	equalityExpCS -> relationalExpCS
593
	equalityWithLet -> relationalWithLet
583
	equalityWithLet -> relationalWithLet
594
	equalityExpCS ::= equalityExpCS '=' relationalExpCS
584
	equalityExpCS ::= equalityExpCS '=' relationalExpCS
595
		/.$NewCase./
585
		/.$NewCase./
596
	equalityWithLet ::= equalityExpCS '=' relationalWithLet
586
	equalityWithLet ::= equalityExpCS '=' relationalWithLet
597
		/.$BeginJava
587
		/.$NewCase./
598
					SimpleNameCS simpleNameCS = createSimpleNameCS(
599
								SimpleTypeEnum.STRING_LITERAL,
600
								OCLStandardLibraryUtil.getOperationName(PredefinedType.EQUAL)
601
							);
602
					setOffsets(simpleNameCS, getIToken($getToken(2)));
603
					EList args = new BasicEList();
604
					args.add($getSym(3));
605
					CSTNode result = createOperationCallExpCS(
606
							(OCLExpressionCS)$getSym(1),
607
							simpleNameCS,
608
							args
609
						);
610
					setOffsets(result, (CSTNode)$getSym(1), (CSTNode)$getSym(3));
611
					$setResult(result);
612
		  $EndJava
613
		./
614
	equalityExpCS ::= equalityExpCS '<>' relationalExpCS
588
	equalityExpCS ::= equalityExpCS '<>' relationalExpCS
615
		/.$NewCase./
589
		/.$NewCase./
616
	equalityWithLet ::= equalityExpCS '<>' relationalWithLet
590
	equalityWithLet ::= equalityExpCS '<>' relationalWithLet
617
		/.$BeginJava
591
		/.$NewCase./
618
					SimpleNameCS simpleNameCS = createSimpleNameCS(
619
								SimpleTypeEnum.STRING_LITERAL,
620
								OCLStandardLibraryUtil.getOperationName(PredefinedType.NOT_EQUAL)
621
							);
622
					setOffsets(simpleNameCS, getIToken($getToken(2)));
623
					EList args = new BasicEList();
624
					args.add($getSym(3));
625
					CSTNode result = createOperationCallExpCS(
626
							(OCLExpressionCS)$getSym(1),
627
							simpleNameCS,
628
							args
629
						);
630
					setOffsets(result, (CSTNode)$getSym(1), (CSTNode)$getSym(3));
631
					$setResult(result);
632
		  $EndJava
633
		./
634
	
592
	
635
	relationalExpCS -> ifExpCSPrec
593
	relationalExpCS -> ifExpCSPrec
636
	-- Note that ifExp already embeds let, so we needn't deal with it here
594
	-- Note that ifExp already embeds let, so we needn't deal with it here
Lines 638-720 Link Here
638
	relationalExpCS ::= relationalExpCS '>' ifExpCSPrec
596
	relationalExpCS ::= relationalExpCS '>' ifExpCSPrec
639
		/.$NewCase./
597
		/.$NewCase./
640
	relationalWithLet ::= relationalExpCS '>' additiveWithLet
598
	relationalWithLet ::= relationalExpCS '>' additiveWithLet
641
		/.$BeginJava
599
		/.$NewCase./
642
					SimpleNameCS simpleNameCS = createSimpleNameCS(
643
								SimpleTypeEnum.STRING_LITERAL,
644
								OCLStandardLibraryUtil.getOperationName(PredefinedType.GREATER_THAN)
645
							);
646
					setOffsets(simpleNameCS, getIToken($getToken(2)));
647
					EList args = new BasicEList();
648
					args.add($getSym(3));
649
					CSTNode result = createOperationCallExpCS(
650
							(OCLExpressionCS)$getSym(1),
651
							simpleNameCS,
652
							args
653
						);
654
					setOffsets(result, (CSTNode)$getSym(1), (CSTNode)$getSym(3));
655
					$setResult(result);
656
		  $EndJava
657
		./
658
	relationalExpCS ::= relationalExpCS '<' ifExpCSPrec
600
	relationalExpCS ::= relationalExpCS '<' ifExpCSPrec
659
		/.$NewCase./
601
		/.$NewCase./
660
	relationalWithLet ::= relationalExpCS '<' additiveWithLet
602
	relationalWithLet ::= relationalExpCS '<' additiveWithLet
661
		/.$BeginJava
603
		/.$NewCase./
662
					SimpleNameCS simpleNameCS = createSimpleNameCS(
663
								SimpleTypeEnum.STRING_LITERAL,
664
								OCLStandardLibraryUtil.getOperationName(PredefinedType.LESS_THAN)
665
							);
666
					setOffsets(simpleNameCS, getIToken($getToken(2)));
667
					EList args = new BasicEList();
668
					args.add($getSym(3));
669
					CSTNode result = createOperationCallExpCS(
670
							(OCLExpressionCS)$getSym(1),
671
							simpleNameCS,
672
							args
673
						);
674
					setOffsets(result, (CSTNode)$getSym(1), (CSTNode)$getSym(3));
675
					$setResult(result);
676
		  $EndJava
677
		./
678
	relationalExpCS ::= relationalExpCS '>=' ifExpCSPrec
604
	relationalExpCS ::= relationalExpCS '>=' ifExpCSPrec
679
		/.$NewCase./
605
		/.$NewCase./
680
	relationalWithLet ::= relationalExpCS '>=' additiveWithLet
606
	relationalWithLet ::= relationalExpCS '>=' additiveWithLet
681
		/.$BeginJava
607
		/.$NewCase./
682
					SimpleNameCS simpleNameCS = createSimpleNameCS(
683
								SimpleTypeEnum.STRING_LITERAL,
684
								OCLStandardLibraryUtil.getOperationName(PredefinedType.GREATER_THAN_EQUAL)
685
							);
686
					setOffsets(simpleNameCS, getIToken($getToken(2)));
687
					EList args = new BasicEList();
688
					args.add($getSym(3));
689
					CSTNode result = createOperationCallExpCS(
690
							(OCLExpressionCS)$getSym(1),
691
							simpleNameCS,
692
							args
693
						);
694
					setOffsets(result, (CSTNode)$getSym(1), (CSTNode)$getSym(3));
695
					$setResult(result);
696
		  $EndJava
697
		./
698
	relationalExpCS ::= relationalExpCS '<=' ifExpCSPrec
608
	relationalExpCS ::= relationalExpCS '<=' ifExpCSPrec
699
		/.$NewCase./
609
		/.$NewCase./
700
	relationalWithLet ::= relationalExpCS '<=' additiveWithLet
610
	relationalWithLet ::= relationalExpCS '<=' additiveWithLet
701
		/.$BeginJava
611
		/.$NewCase./
702
					SimpleNameCS simpleNameCS = createSimpleNameCS(
703
								SimpleTypeEnum.STRING_LITERAL,
704
								OCLStandardLibraryUtil.getOperationName(PredefinedType.LESS_THAN_EQUAL)
705
							);
706
					setOffsets(simpleNameCS, getIToken($getToken(2)));
707
					EList args = new BasicEList();
708
					args.add($getSym(3));
709
					CSTNode result = createOperationCallExpCS(
710
							(OCLExpressionCS)$getSym(1),
711
							simpleNameCS,
712
							args
713
						);
714
					setOffsets(result, (CSTNode)$getSym(1), (CSTNode)$getSym(3));
715
					$setResult(result);
716
		  $EndJava
717
		./
718
	
612
	
719
	ifExpCSPrec -> additiveExpCS
613
	ifExpCSPrec -> additiveExpCS
720
	ifExpCSPrec -> ifExpCS
614
	ifExpCSPrec -> ifExpCS
Lines 724-796 Link Here
724
	additiveExpCS ::= additiveExpCS '+' multiplicativeExpCS
618
	additiveExpCS ::= additiveExpCS '+' multiplicativeExpCS
725
		/.$NewCase./
619
		/.$NewCase./
726
	additiveWithLet ::= additiveExpCS '+' multiplicativeWithLet
620
	additiveWithLet ::= additiveExpCS '+' multiplicativeWithLet
727
		/.$BeginJava
621
		/.$NewCase./
728
					SimpleNameCS simpleNameCS = createSimpleNameCS(
729
								SimpleTypeEnum.STRING_LITERAL,
730
								OCLStandardLibraryUtil.getOperationName(PredefinedType.PLUS)
731
							);
732
					setOffsets(simpleNameCS, getIToken($getToken(2)));
733
					EList args = new BasicEList();
734
					args.add($getSym(3));
735
					CSTNode result = createOperationCallExpCS(
736
							(OCLExpressionCS)$getSym(1),
737
							simpleNameCS,
738
							args
739
						);
740
					setOffsets(result, (CSTNode)$getSym(1), (CSTNode)$getSym(3));
741
					$setResult(result);
742
		  $EndJava
743
		./
744
	additiveExpCS ::= additiveExpCS '-' multiplicativeExpCS
622
	additiveExpCS ::= additiveExpCS '-' multiplicativeExpCS
745
		/.$NewCase./
623
		/.$NewCase./
746
	additiveWithLet ::= additiveExpCS '-' multiplicativeWithLet
624
	additiveWithLet ::= additiveExpCS '-' multiplicativeWithLet
747
		/.$BeginJava
625
		/.$NewCase./
748
					SimpleNameCS simpleNameCS = createSimpleNameCS(
749
								SimpleTypeEnum.STRING_LITERAL,
750
								OCLStandardLibraryUtil.getOperationName(PredefinedType.MINUS)
751
							);
752
					setOffsets(simpleNameCS, getIToken($getToken(2)));
753
					EList args = new BasicEList();
754
					args.add($getSym(3));
755
					CSTNode result = createOperationCallExpCS(
756
							(OCLExpressionCS)$getSym(1),
757
							simpleNameCS,
758
							args
759
						);
760
					setOffsets(result, (CSTNode)$getSym(1), (CSTNode)$getSym(3));
761
					$setResult(result);
762
		  $EndJava
763
		./
764
	
626
	
765
	multiplicativeExpCS -> unaryExpCS
627
	multiplicativeExpCS -> unaryExpCS
766
	multiplicativeWithLet -> unaryWithLet
628
	multiplicativeWithLet -> unaryWithLet
767
	multiplicativeExpCS ::= multiplicativeExpCS '*' unaryExpCS
629
	multiplicativeExpCS ::= multiplicativeExpCS '*' unaryExpCS
768
		/.$NewCase./
630
		/.$NewCase./
769
	multiplicativeWithLet ::= multiplicativeExpCS '*' unaryWithLet
631
	multiplicativeWithLet ::= multiplicativeExpCS '*' unaryWithLet
770
		/.$BeginJava
632
		/.$NewCase./
771
					SimpleNameCS simpleNameCS = createSimpleNameCS(
772
								SimpleTypeEnum.STRING_LITERAL,
773
								OCLStandardLibraryUtil.getOperationName(PredefinedType.TIMES)
774
							);
775
					setOffsets(simpleNameCS, getIToken($getToken(2)));
776
					EList args = new BasicEList();
777
					args.add($getSym(3));
778
					CSTNode result = createOperationCallExpCS(
779
							(OCLExpressionCS)$getSym(1),
780
							simpleNameCS,
781
							args
782
						);
783
					setOffsets(result, (CSTNode)$getSym(1), (CSTNode)$getSym(3));
784
					$setResult(result);
785
		  $EndJava
786
		./
787
	multiplicativeExpCS ::= multiplicativeExpCS '/' unaryExpCS
633
	multiplicativeExpCS ::= multiplicativeExpCS '/' unaryExpCS
788
		/.$NewCase./
634
		/.$NewCase./
789
	multiplicativeWithLet ::= multiplicativeExpCS '/' unaryWithLet
635
	multiplicativeWithLet ::= multiplicativeExpCS '/' unaryWithLet
790
		/.$BeginJava
636
		/.$BeginJava
791
					SimpleNameCS simpleNameCS = createSimpleNameCS(
637
					SimpleNameCS simpleNameCS = createSimpleNameCS(
792
								SimpleTypeEnum.STRING_LITERAL,
638
								SimpleTypeEnum.STRING_LITERAL,
793
								OCLStandardLibraryUtil.getOperationName(PredefinedType.DIVIDE)
639
								getTokenText($getToken(2))
794
							);
640
							);
795
					setOffsets(simpleNameCS, getIToken($getToken(2)));
641
					setOffsets(simpleNameCS, getIToken($getToken(2)));
796
					EList args = new BasicEList();
642
					EList args = new BasicEList();
Lines 923-928 Link Here
923
	oclExpCS ::= '(' oclExpressionCS ')'
769
	oclExpCS ::= '(' oclExpressionCS ')'
924
		/.$BeginJava
770
		/.$BeginJava
925
					CSTNode result = (CSTNode)$getSym(2);
771
					CSTNode result = (CSTNode)$getSym(2);
772
					if (result instanceof OperationCallExpCS) {
773
						((OperationCallExpCS)result).setIsParenthesized(true);
774
					}
926
					setOffsets(result, getIToken($getToken(1)), getIToken($getToken(3)));
775
					setOffsets(result, getIToken($getToken(1)), getIToken($getToken(3)));
927
					$setResult(result);
776
					$setResult(result);
928
		  $EndJava
777
		  $EndJava
(-)model/OCLCST.genmodel (-1 / +3 lines)
Lines 295-301 Link Here
295
        <genFeatures xsi:type="genmodel:GenFeature" property="None" children="true"
295
        <genFeatures xsi:type="genmodel:GenFeature" property="None" children="true"
296
            createChild="true" ecoreFeature="ecore:EReference OCLCST.ecore#//cst/FeatureCallExpCS/isMarkedPreCS"/>
296
            createChild="true" ecoreFeature="ecore:EReference OCLCST.ecore#//cst/FeatureCallExpCS/isMarkedPreCS"/>
297
      </genClasses>
297
      </genClasses>
298
      <genClasses xsi:type="genmodel:GenClass" ecoreClass="OCLCST.ecore#//cst/OperationCallExpCS"/>
298
      <genClasses xsi:type="genmodel:GenClass" ecoreClass="OCLCST.ecore#//cst/OperationCallExpCS">
299
        <genFeatures xsi:type="genmodel:GenFeature" createChild="false" ecoreFeature="ecore:EAttribute OCLCST.ecore#//cst/OperationCallExpCS/isParenthesized"/>
300
      </genClasses>
299
      <genClasses xsi:type="genmodel:GenClass" ecoreClass="OCLCST.ecore#//cst/StateExpCS">
301
      <genClasses xsi:type="genmodel:GenClass" ecoreClass="OCLCST.ecore#//cst/StateExpCS">
300
        <genFeatures xsi:type="genmodel:GenFeature" createChild="false" ecoreFeature="ecore:EAttribute OCLCST.ecore#//cst/StateExpCS/sequenceOfNames"/>
302
        <genFeatures xsi:type="genmodel:GenFeature" createChild="false" ecoreFeature="ecore:EAttribute OCLCST.ecore#//cst/StateExpCS/sequenceOfNames"/>
301
      </genClasses>
303
      </genClasses>
(-)model/OCLCST.uml (+5 lines)
Lines 666-671 Link Here
666
      </packagedElement>
666
      </packagedElement>
667
      <packagedElement xmi:type="uml:Class" xmi:id="_qdx-Vf8fEduhWtVvKtiQ7w" name="OperationCallExpCS">
667
      <packagedElement xmi:type="uml:Class" xmi:id="_qdx-Vf8fEduhWtVvKtiQ7w" name="OperationCallExpCS">
668
        <generalization xmi:id="_qdx-Vv8fEduhWtVvKtiQ7w" general="_qdx-Sv8fEduhWtVvKtiQ7w"/>
668
        <generalization xmi:id="_qdx-Vv8fEduhWtVvKtiQ7w" general="_qdx-Sv8fEduhWtVvKtiQ7w"/>
669
        <ownedAttribute xmi:id="_306UMJXiEd6Wx-S3aeq4Aw" name="isParenthesized" visibility="public" isOrdered="true">
670
          <type xmi:type="uml:PrimitiveType" href="pathmap://UML_LIBRARIES/EcorePrimitiveTypes.library.uml#EBooleanObject"/>
671
          <lowerValue xmi:type="uml:LiteralInteger" xmi:id="_306UMZXiEd6Wx-S3aeq4Aw"/>
672
          <defaultValue xmi:type="uml:LiteralString" xmi:id="_8lGFsJXiEd6Wx-S3aeq4Aw" value="false"/>
673
        </ownedAttribute>
669
      </packagedElement>
674
      </packagedElement>
670
      <packagedElement xmi:type="uml:Class" xmi:id="_qdx-V_8fEduhWtVvKtiQ7w" name="StateExpCS">
675
      <packagedElement xmi:type="uml:Class" xmi:id="_qdx-V_8fEduhWtVvKtiQ7w" name="StateExpCS">
671
        <generalization xmi:id="_qdx-WP8fEduhWtVvKtiQ7w" general="_qdx8xP8fEduhWtVvKtiQ7w"/>
676
        <generalization xmi:id="_qdx-WP8fEduhWtVvKtiQ7w" general="_qdx8xP8fEduhWtVvKtiQ7w"/>
(-)model/OCLCST.ecore (-1 / +4 lines)
Lines 306-312 Link Here
306
      <eStructuralFeatures xsi:type="ecore:EReference" name="isMarkedPreCS" eType="#//cst/IsMarkedPreCS"
306
      <eStructuralFeatures xsi:type="ecore:EReference" name="isMarkedPreCS" eType="#//cst/IsMarkedPreCS"
307
          containment="true"/>
307
          containment="true"/>
308
    </eClassifiers>
308
    </eClassifiers>
309
    <eClassifiers xsi:type="ecore:EClass" name="OperationCallExpCS" eSuperTypes="#//cst/FeatureCallExpCS"/>
309
    <eClassifiers xsi:type="ecore:EClass" name="OperationCallExpCS" eSuperTypes="#//cst/FeatureCallExpCS">
310
      <eStructuralFeatures xsi:type="ecore:EAttribute" name="isParenthesized" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EBooleanObject"
311
          defaultValueLiteral="false"/>
312
    </eClassifiers>
310
    <eClassifiers xsi:type="ecore:EClass" name="StateExpCS" eSuperTypes="#//cst/TypeCS">
313
    <eClassifiers xsi:type="ecore:EClass" name="StateExpCS" eSuperTypes="#//cst/TypeCS">
311
      <eStructuralFeatures xsi:type="ecore:EAttribute" name="sequenceOfNames" upperBound="-1"
314
      <eStructuralFeatures xsi:type="ecore:EAttribute" name="sequenceOfNames" upperBound="-1"
312
          eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
315
          eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
(-)src/org/eclipse/ocl/internal/l10n/OCLMessages.properties (-2 / +7 lines)
Lines 1-5 Link Here
1
###############################################################################
1
###############################################################################
2
# Copyright (c) 2003, 2008 IBM Corporation, Borland Software Corp., and others.
2
# Copyright (c) 2003, 2009 IBM Corporation, Borland Software Corp., and others.
3
# All rights reserved. This program and the accompanying materials
3
# All rights reserved. This program and the accompanying materials
4
# are made available under the terms of the Eclipse Public License v1.0
4
# are made available under the terms of the Eclipse Public License v1.0
5
# which accompanies this distribution, and is available at
5
# which accompanies this distribution, and is available at
Lines 1343-1346 Link Here
1343
#
1343
#
1344
# Indicates that a string literal contains an invalid escape sequence
1344
# Indicates that a string literal contains an invalid escape sequence
1345
#
1345
#
1346
InvalidEscapeSequence_ERROR = Invalid escape sequence (valid ones are \\b \\t \\n \\f \\r \\\" \\\' \\\\)
1346
InvalidEscapeSequence_ERROR = Invalid escape sequence (valid ones are \\b \\t \\n \\f \\r \\\" \\\' \\\\)
1347
    
1348
#
1349
# Indicates that an xor,or,and expression is parsed differently for OCL 2.1 than its predecessors.
1350
#
1351
XorOrAndPrecedence_WARNING = Precedence of xor,or,and changed for OCL 2.1.
(-)src/org/eclipse/ocl/internal/l10n/OCLMessages.java (+2 lines)
Lines 245-250 Link Here
245
    
245
    
246
    public static String StringNotProperlyClosed_ERROR;
246
    public static String StringNotProperlyClosed_ERROR;
247
    public static String InvalidEscapeSequence_ERROR;
247
    public static String InvalidEscapeSequence_ERROR;
248
    
249
    public static String XorOrAndPrecedence_WARNING;
248
	
250
	
249
	private static IMessages messagesImpl;
251
	private static IMessages messagesImpl;
250
	
252
	
(-)src/org/eclipse/ocl/util/OCLUtil.java (+58 lines)
Lines 356-361 Link Here
356
		
356
		
357
		return result;
357
		return result;
358
	}
358
	}
359
    
360
    /**
361
	 * Checks whether the specified environment's problem handler has any
362
	 * diagnostics of warnings severity or worse and, if so, throws a semantic
363
	 * exception encapsulating these diagnostics.
364
	 * 
365
	 * @param env an environment in which we have parsed some OCL
366
	 * 
367
	 * @throws SyntaxException if there are any errors in parsing the concrete
368
	 *    syntax
369
	 * @throws SemanticException if there are any errors in analyzing the
370
	 *    abstract syntax 
371
	 * 
372
	 * @see #checkForErrors(ProblemHandler)
373
     * @since 3.0
374
	 */
375
	public static Diagnostic checkForErrorsOrWarnings(
376
			Environment<?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?> env)
377
			throws SyntaxException, SemanticException {
378
		
379
		return checkForErrorsOrWarnings(getAdapter(env, ProblemHandler.class));
380
	}
381
382
	/**
383
	 * Checks whether the specified problem handler has any
384
	 * diagnostics of warning severity or worse and, if so, throws a semantic
385
	 * exception encapsulating these diagnostics.
386
	 * 
387
	 * @param problemHandler a problem handler
388
	 * 
389
	 * @throws SyntaxException if there are any errors in parsing the concrete
390
	 *    syntax
391
	 * @throws SemanticException if there are any errors in analyzing the
392
	 *    abstract syntax 
393
	 * @since 3.0
394
	 */
395
	public static Diagnostic checkForErrorsOrWarnings(ProblemHandler problemHandler)
396
			throws SyntaxException, SemanticException {
397
		
398
		Diagnostic result = null;
399
		
400
		if (problemHandler instanceof OCLProblemHandler) {
401
			result = ((OCLProblemHandler) problemHandler).getDiagnostic();
402
			
403
			if ((result != null) && (result.getSeverity() >= Diagnostic.WARNING)) {
404
				List<?> data = result.getData();
405
				
406
				if (data.contains(ProblemHandler.Phase.LEXER)
407
						|| data.contains(ProblemHandler.Phase.PARSER)) {
408
					throw new SyntaxException(result);
409
				} else {
410
					throw new SemanticException(result);
411
				}
412
			}
413
		}
414
		
415
		return result;
416
	}
359
	
417
	
360
	/**
418
	/**
361
	 * Attempts to get an environment instance that is appropriate for introspection
419
	 * Attempts to get an environment instance that is appropriate for introspection
(-)plugin.properties (+2 lines)
Lines 17-22 Link Here
17
17
18
Plugin.name = Object Constraint Language (OCL) 2.0 Parser/Interpreter
18
Plugin.name = Object Constraint Language (OCL) 2.0 Parser/Interpreter
19
Plugin.providerName = Eclipse Modeling Project
19
Plugin.providerName = Eclipse Modeling Project
20
pluginName = Object Constraint Language (OCL) 2.0 Parser/Interpreter
21
providerName = Eclipse Modeling Project
20
22
21
oclenv.point.name = Registered OCL Environments
23
oclenv.point.name = Registered OCL Environments
22
UI_OCL_content_type = OCL Model File
24
UI_OCL_content_type = OCL Model File

Return to bug 288040