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 242153 | Differences between
and this patch

Collapse All | Expand All

(-)src/org/eclipse/ocl/parser/OCLKWLexer.java (-124 / +191 lines)
Lines 1-7 Link Here
1
/**
1
/**
2
* <copyright>
2
* <copyright>
3
*
3
*
4
* Copyright (c) 2005, 2007 IBM Corporation and others.
4
* Copyright (c) 2005, 2009 IBM Corporation 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-19 Link Here
10
* Contributors:
10
* Contributors:
11
*   IBM - Initial API and implementation
11
*   IBM - Initial API and implementation
12
*   E.D.Willink - Lexer and Parser refactoring to support extensibility and flexible error handling
12
*   E.D.Willink - Lexer and Parser refactoring to support extensibility and flexible error handling
13
*   E.D.Willink - Bug 285633 static definitions
14
*   Adolfo Sanchez-Barbudo Herrera (Open Canarias) - LPG v 2.0.17 adoption (242153)
13
*
15
*
14
* </copyright>
16
* </copyright>
15
*
17
*
16
* $Id: OCLKWLexer.java,v 1.7 2009/09/04 13:40:43 ewillink Exp $
18
* 
17
*/
19
*/
18
20
19
package org.eclipse.ocl.parser;
21
package org.eclipse.ocl.parser;
Lines 57-122 Link Here
57
    final static int tokenKind[] = new int[128];
59
    final static int tokenKind[] = new int[128];
58
    static
60
    static
59
    {
61
    {
60
        tokenKind['$'] = Char_DollarSign;
62
        tokenKind['$'] = OCLKWLexersym.Char_DollarSign;
61
63
        tokenKind['%'] = OCLKWLexersym.Char_Percent;
62
        tokenKind['a'] = Char_a;
64
        tokenKind['_'] = OCLKWLexersym.Char__;
63
        tokenKind['b'] = Char_b;
65
64
        tokenKind['c'] = Char_c;
66
        tokenKind['a'] = OCLKWLexersym.Char_a;
65
        tokenKind['d'] = Char_d;
67
        tokenKind['b'] = OCLKWLexersym.Char_b;
66
        tokenKind['e'] = Char_e;
68
        tokenKind['c'] = OCLKWLexersym.Char_c;
67
        tokenKind['f'] = Char_f;
69
        tokenKind['d'] = OCLKWLexersym.Char_d;
68
        tokenKind['g'] = Char_g;
70
        tokenKind['e'] = OCLKWLexersym.Char_e;
69
        tokenKind['h'] = Char_h;
71
        tokenKind['f'] = OCLKWLexersym.Char_f;
70
        tokenKind['i'] = Char_i;
72
        tokenKind['g'] = OCLKWLexersym.Char_g;
71
        tokenKind['j'] = Char_j;
73
        tokenKind['h'] = OCLKWLexersym.Char_h;
72
        tokenKind['k'] = Char_k;
74
        tokenKind['i'] = OCLKWLexersym.Char_i;
73
        tokenKind['l'] = Char_l;
75
        tokenKind['j'] = OCLKWLexersym.Char_j;
74
        tokenKind['m'] = Char_m;
76
        tokenKind['k'] = OCLKWLexersym.Char_k;
75
        tokenKind['n'] = Char_n;
77
        tokenKind['l'] = OCLKWLexersym.Char_l;
76
        tokenKind['o'] = Char_o;
78
        tokenKind['m'] = OCLKWLexersym.Char_m;
77
        tokenKind['p'] = Char_p;
79
        tokenKind['n'] = OCLKWLexersym.Char_n;
78
        tokenKind['q'] = Char_q;
80
        tokenKind['o'] = OCLKWLexersym.Char_o;
79
        tokenKind['r'] = Char_r;
81
        tokenKind['p'] = OCLKWLexersym.Char_p;
80
        tokenKind['s'] = Char_s;
82
        tokenKind['q'] = OCLKWLexersym.Char_q;
81
        tokenKind['t'] = Char_t;
83
        tokenKind['r'] = OCLKWLexersym.Char_r;
82
        tokenKind['u'] = Char_u;
84
        tokenKind['s'] = OCLKWLexersym.Char_s;
83
        tokenKind['v'] = Char_v;
85
        tokenKind['t'] = OCLKWLexersym.Char_t;
84
        tokenKind['w'] = Char_w;
86
        tokenKind['u'] = OCLKWLexersym.Char_u;
85
        tokenKind['x'] = Char_x;
87
        tokenKind['v'] = OCLKWLexersym.Char_v;
86
        tokenKind['y'] = Char_y;
88
        tokenKind['w'] = OCLKWLexersym.Char_w;
87
        tokenKind['z'] = Char_z;
89
        tokenKind['x'] = OCLKWLexersym.Char_x;
88
90
        tokenKind['y'] = OCLKWLexersym.Char_y;
89
        tokenKind['A'] = Char_A;
91
        tokenKind['z'] = OCLKWLexersym.Char_z;
90
        tokenKind['B'] = Char_B;
92
91
        tokenKind['C'] = Char_C;
93
        tokenKind['A'] = OCLKWLexersym.Char_A;
92
        tokenKind['D'] = Char_D;
94
        tokenKind['B'] = OCLKWLexersym.Char_B;
93
        tokenKind['E'] = Char_E;
95
        tokenKind['C'] = OCLKWLexersym.Char_C;
94
        tokenKind['F'] = Char_F;
96
        tokenKind['D'] = OCLKWLexersym.Char_D;
95
        tokenKind['G'] = Char_G;
97
        tokenKind['E'] = OCLKWLexersym.Char_E;
96
        tokenKind['H'] = Char_H;
98
        tokenKind['F'] = OCLKWLexersym.Char_F;
97
        tokenKind['I'] = Char_I;
99
        tokenKind['G'] = OCLKWLexersym.Char_G;
98
        tokenKind['J'] = Char_J;
100
        tokenKind['H'] = OCLKWLexersym.Char_H;
99
        tokenKind['K'] = Char_K;
101
        tokenKind['I'] = OCLKWLexersym.Char_I;
100
        tokenKind['L'] = Char_L;
102
        tokenKind['J'] = OCLKWLexersym.Char_J;
101
        tokenKind['M'] = Char_M;
103
        tokenKind['K'] = OCLKWLexersym.Char_K;
102
        tokenKind['N'] = Char_N;
104
        tokenKind['L'] = OCLKWLexersym.Char_L;
103
        tokenKind['O'] = Char_O;
105
        tokenKind['M'] = OCLKWLexersym.Char_M;
104
        tokenKind['P'] = Char_P;
106
        tokenKind['N'] = OCLKWLexersym.Char_N;
105
        tokenKind['Q'] = Char_Q;
107
        tokenKind['O'] = OCLKWLexersym.Char_O;
106
        tokenKind['R'] = Char_R;
108
        tokenKind['P'] = OCLKWLexersym.Char_P;
107
        tokenKind['S'] = Char_S;
109
        tokenKind['Q'] = OCLKWLexersym.Char_Q;
108
        tokenKind['T'] = Char_T;
110
        tokenKind['R'] = OCLKWLexersym.Char_R;
109
        tokenKind['U'] = Char_U;
111
        tokenKind['S'] = OCLKWLexersym.Char_S;
110
        tokenKind['V'] = Char_V;
112
        tokenKind['T'] = OCLKWLexersym.Char_T;
111
        tokenKind['W'] = Char_W;
113
        tokenKind['U'] = OCLKWLexersym.Char_U;
112
        tokenKind['X'] = Char_X;
114
        tokenKind['V'] = OCLKWLexersym.Char_V;
113
        tokenKind['Y'] = Char_Y;
115
        tokenKind['W'] = OCLKWLexersym.Char_W;
114
        tokenKind['Z'] = Char_Z;
116
        tokenKind['X'] = OCLKWLexersym.Char_X;
117
        tokenKind['Y'] = OCLKWLexersym.Char_Y;
118
        tokenKind['Z'] = OCLKWLexersym.Char_Z;
115
    };
119
    };
116
120
117
    final int getKind(char c)
121
    final int getKind(int c)
118
    {
122
    {
119
        return (c < 128 ? tokenKind[c] : 0);
123
        return (((c & 0xFFFFFF80) == 0) /* 0 <= c < 128? */ ? tokenKind[c] : 0);
120
    }
124
    }
121
125
122
126
Lines 128-515 Link Here
128
        //
132
        //
129
        // Rule 1:  KeyWord ::= s e l f
133
        // Rule 1:  KeyWord ::= s e l f
130
        //
134
        //
131
		keywordKind[1] = (TK_self);
135
        
136
		keywordKind[1] = (OCLParsersym.TK_self);
132
	  
137
	  
133
	
138
	
134
        //
139
        //
135
        // Rule 2:  KeyWord ::= i n v
140
        // Rule 2:  KeyWord ::= i n v
136
        //
141
        //
137
		keywordKind[2] = (TK_inv);
142
        
143
		keywordKind[2] = (OCLParsersym.TK_inv);
138
	  
144
	  
139
	
145
	
140
        //
146
        //
141
        // Rule 3:  KeyWord ::= p r e
147
        // Rule 3:  KeyWord ::= p r e
142
        //
148
        //
143
		keywordKind[3] = (TK_pre);
149
        
150
		keywordKind[3] = (OCLParsersym.TK_pre);
144
	  
151
	  
145
	
152
	
146
        //
153
        //
147
        // Rule 4:  KeyWord ::= p o s t
154
        // Rule 4:  KeyWord ::= p o s t
148
        //
155
        //
149
		keywordKind[4] = (TK_post);
156
        
157
		keywordKind[4] = (OCLParsersym.TK_post);
150
	  
158
	  
151
	
159
	
152
        //
160
        //
153
        // Rule 5:  KeyWord ::= b o d y
161
        // Rule 5:  KeyWord ::= b o d y
154
        //
162
        //
155
		keywordKind[5] = (TK_body);
163
        
164
		keywordKind[5] = (OCLParsersym.TK_body);
156
	  
165
	  
157
	
166
	
158
        //
167
        //
159
        // Rule 6:  KeyWord ::= c o n t e x t
168
        // Rule 6:  KeyWord ::= c o n t e x t
160
        //
169
        //
161
		keywordKind[6] = (TK_context);
170
        
171
		keywordKind[6] = (OCLParsersym.TK_context);
162
	  
172
	  
163
	
173
	
164
        //
174
        //
165
        // Rule 7:  KeyWord ::= p a c k a g e
175
        // Rule 7:  KeyWord ::= p a c k a g e
166
        //
176
        //
167
		keywordKind[7] = (TK_package);
177
        
178
		keywordKind[7] = (OCLParsersym.TK_package);
168
	  
179
	  
169
	
180
	
170
        //
181
        //
171
        // Rule 8:  KeyWord ::= e n d p a c k a g e
182
        // Rule 8:  KeyWord ::= e n d p a c k a g e
172
        //
183
        //
173
		keywordKind[8] = (TK_endpackage);
184
        
185
		keywordKind[8] = (OCLParsersym.TK_endpackage);
174
	  
186
	  
175
	
187
	
176
        //
188
        //
177
        // Rule 9:  KeyWord ::= d e f
189
        // Rule 9:  KeyWord ::= d e f
178
        //
190
        //
179
		keywordKind[9] = (TK_def);
191
        
192
		keywordKind[9] = (OCLParsersym.TK_def);
180
	  
193
	  
181
	
194
	
182
        //
195
        //
183
        // Rule 10:  KeyWord ::= d e r i v e
196
        // Rule 10:  KeyWord ::= d e r i v e
184
        //
197
        //
185
		keywordKind[10] = (TK_derive);
198
        
199
		keywordKind[10] = (OCLParsersym.TK_derive);
186
	  
200
	  
187
	
201
	
188
        //
202
        //
189
        // Rule 11:  KeyWord ::= i n i t
203
        // Rule 11:  KeyWord ::= i n i t
190
        //
204
        //
191
		keywordKind[11] = (TK_init);
205
        
206
		keywordKind[11] = (OCLParsersym.TK_init);
192
	  
207
	  
193
	
208
	
194
        //
209
        //
195
        // Rule 12:  KeyWord ::= i f
210
        // Rule 12:  KeyWord ::= i f
196
        //
211
        //
197
		keywordKind[12] = (TK_if);
212
        
213
		keywordKind[12] = (OCLParsersym.TK_if);
198
	  
214
	  
199
	
215
	
200
        //
216
        //
201
        // Rule 13:  KeyWord ::= t h e n
217
        // Rule 13:  KeyWord ::= t h e n
202
        //
218
        //
203
		keywordKind[13] = (TK_then);
219
        
220
		keywordKind[13] = (OCLParsersym.TK_then);
204
	  
221
	  
205
	
222
	
206
        //
223
        //
207
        // Rule 14:  KeyWord ::= e l s e
224
        // Rule 14:  KeyWord ::= e l s e
208
        //
225
        //
209
		keywordKind[14] = (TK_else);
226
        
227
		keywordKind[14] = (OCLParsersym.TK_else);
210
	  
228
	  
211
	
229
	
212
        //
230
        //
213
        // Rule 15:  KeyWord ::= e n d i f
231
        // Rule 15:  KeyWord ::= e n d i f
214
        //
232
        //
215
		keywordKind[15] = (TK_endif);
233
        
234
		keywordKind[15] = (OCLParsersym.TK_endif);
216
	  
235
	  
217
	
236
	
218
        //
237
        //
219
        // Rule 16:  KeyWord ::= a n d
238
        // Rule 16:  KeyWord ::= a n d
220
        //
239
        //
221
		keywordKind[16] = (TK_and);
240
        
241
		keywordKind[16] = (OCLParsersym.TK_and);
222
	  
242
	  
223
	
243
	
224
        //
244
        //
225
        // Rule 17:  KeyWord ::= o r
245
        // Rule 17:  KeyWord ::= o r
226
        //
246
        //
227
		keywordKind[17] = (TK_or);
247
        
248
		keywordKind[17] = (OCLParsersym.TK_or);
228
	  
249
	  
229
	
250
	
230
        //
251
        //
231
        // Rule 18:  KeyWord ::= x o r
252
        // Rule 18:  KeyWord ::= x o r
232
        //
253
        //
233
		keywordKind[18] = (TK_xor);
254
        
255
		keywordKind[18] = (OCLParsersym.TK_xor);
234
	  
256
	  
235
	
257
	
236
        //
258
        //
237
        // Rule 19:  KeyWord ::= n o t
259
        // Rule 19:  KeyWord ::= n o t
238
        //
260
        //
239
		keywordKind[19] = (TK_not);
261
        
262
		keywordKind[19] = (OCLParsersym.TK_not);
240
	  
263
	  
241
	
264
	
242
        //
265
        //
243
        // Rule 20:  KeyWord ::= i m p l i e s
266
        // Rule 20:  KeyWord ::= i m p l i e s
244
        //
267
        //
245
		keywordKind[20] = (TK_implies);
268
        
269
		keywordKind[20] = (OCLParsersym.TK_implies);
246
	  
270
	  
247
	
271
	
248
        //
272
        //
249
        // Rule 21:  KeyWord ::= l e t
273
        // Rule 21:  KeyWord ::= l e t
250
        //
274
        //
251
		keywordKind[21] = (TK_let);
275
        
276
		keywordKind[21] = (OCLParsersym.TK_let);
252
	  
277
	  
253
	
278
	
254
        //
279
        //
255
        // Rule 22:  KeyWord ::= i n
280
        // Rule 22:  KeyWord ::= i n
256
        //
281
        //
257
		keywordKind[22] = (TK_in);
282
        
283
		keywordKind[22] = (OCLParsersym.TK_in);
258
	  
284
	  
259
	
285
	
260
        //
286
        //
261
        // Rule 23:  KeyWord ::= t r u e
287
        // Rule 23:  KeyWord ::= t r u e
262
        //
288
        //
263
		keywordKind[23] = (TK_true);
289
        
290
		keywordKind[23] = (OCLParsersym.TK_true);
264
	  
291
	  
265
	
292
	
266
        //
293
        //
267
        // Rule 24:  KeyWord ::= f a l s e
294
        // Rule 24:  KeyWord ::= f a l s e
268
        //
295
        //
269
		keywordKind[24] = (TK_false);
296
        
297
		keywordKind[24] = (OCLParsersym.TK_false);
270
	  
298
	  
271
	
299
	
272
        //
300
        //
273
        // Rule 25:  KeyWord ::= S e t
301
        // Rule 25:  KeyWord ::= S e t
274
        //
302
        //
275
		keywordKind[25] = (TK_Set);
303
        
304
		keywordKind[25] = (OCLParsersym.TK_Set);
276
	  
305
	  
277
	
306
	
278
        //
307
        //
279
        // Rule 26:  KeyWord ::= B a g
308
        // Rule 26:  KeyWord ::= B a g
280
        //
309
        //
281
		keywordKind[26] = (TK_Bag);
310
        
311
		keywordKind[26] = (OCLParsersym.TK_Bag);
282
	  
312
	  
283
	
313
	
284
        //
314
        //
285
        // Rule 27:  KeyWord ::= S e q u e n c e
315
        // Rule 27:  KeyWord ::= S e q u e n c e
286
        //
316
        //
287
		keywordKind[27] = (TK_Sequence);
317
        
318
		keywordKind[27] = (OCLParsersym.TK_Sequence);
288
	  
319
	  
289
	
320
	
290
        //
321
        //
291
        // Rule 28:  KeyWord ::= C o l l e c t i o n
322
        // Rule 28:  KeyWord ::= C o l l e c t i o n
292
        //
323
        //
293
		keywordKind[28] = (TK_Collection);
324
        
325
		keywordKind[28] = (OCLParsersym.TK_Collection);
294
	  
326
	  
295
	
327
	
296
        //
328
        //
297
        // Rule 29:  KeyWord ::= O r d e r e d S e t
329
        // Rule 29:  KeyWord ::= O r d e r e d S e t
298
        //
330
        //
299
		keywordKind[29] = (TK_OrderedSet);
331
        
332
		keywordKind[29] = (OCLParsersym.TK_OrderedSet);
300
	  
333
	  
301
	
334
	
302
        //
335
        //
303
        // Rule 30:  KeyWord ::= i t e r a t e
336
        // Rule 30:  KeyWord ::= i t e r a t e
304
        //
337
        //
305
		keywordKind[30] = (TK_iterate);
338
        
339
		keywordKind[30] = (OCLParsersym.TK_iterate);
306
	  
340
	  
307
	
341
	
308
        //
342
        //
309
        // Rule 31:  KeyWord ::= f o r A l l
343
        // Rule 31:  KeyWord ::= f o r A l l
310
        //
344
        //
311
		keywordKind[31] = (TK_forAll);
345
        
346
		keywordKind[31] = (OCLParsersym.TK_forAll);
312
	  
347
	  
313
	
348
	
314
        //
349
        //
315
        // Rule 32:  KeyWord ::= e x i s t s
350
        // Rule 32:  KeyWord ::= e x i s t s
316
        //
351
        //
317
		keywordKind[32] = (TK_exists);
352
        
353
		keywordKind[32] = (OCLParsersym.TK_exists);
318
	  
354
	  
319
	
355
	
320
        //
356
        //
321
        // Rule 33:  KeyWord ::= i s U n i q u e
357
        // Rule 33:  KeyWord ::= i s U n i q u e
322
        //
358
        //
323
		keywordKind[33] = (TK_isUnique);
359
        
360
		keywordKind[33] = (OCLParsersym.TK_isUnique);
324
	  
361
	  
325
	
362
	
326
        //
363
        //
327
        // Rule 34:  KeyWord ::= a n y
364
        // Rule 34:  KeyWord ::= a n y
328
        //
365
        //
329
		keywordKind[34] = (TK_any);
366
        
367
		keywordKind[34] = (OCLParsersym.TK_any);
330
	  
368
	  
331
	
369
	
332
        //
370
        //
333
        // Rule 35:  KeyWord ::= o n e
371
        // Rule 35:  KeyWord ::= o n e
334
        //
372
        //
335
		keywordKind[35] = (TK_one);
373
        
374
		keywordKind[35] = (OCLParsersym.TK_one);
336
	  
375
	  
337
	
376
	
338
        //
377
        //
339
        // Rule 36:  KeyWord ::= c o l l e c t
378
        // Rule 36:  KeyWord ::= c o l l e c t
340
        //
379
        //
341
		keywordKind[36] = (TK_collect);
380
        
381
		keywordKind[36] = (OCLParsersym.TK_collect);
342
	  
382
	  
343
	
383
	
344
        //
384
        //
345
        // Rule 37:  KeyWord ::= s e l e c t
385
        // Rule 37:  KeyWord ::= s e l e c t
346
        //
386
        //
347
		keywordKind[37] = (TK_select);
387
        
388
		keywordKind[37] = (OCLParsersym.TK_select);
348
	  
389
	  
349
	
390
	
350
        //
391
        //
351
        // Rule 38:  KeyWord ::= r e j e c t
392
        // Rule 38:  KeyWord ::= r e j e c t
352
        //
393
        //
353
		keywordKind[38] = (TK_reject);
394
        
395
		keywordKind[38] = (OCLParsersym.TK_reject);
354
	  
396
	  
355
	
397
	
356
        //
398
        //
357
        // Rule 39:  KeyWord ::= c o l l e c t N e s t e d
399
        // Rule 39:  KeyWord ::= c o l l e c t N e s t e d
358
        //
400
        //
359
		keywordKind[39] = (TK_collectNested);
401
        
402
		keywordKind[39] = (OCLParsersym.TK_collectNested);
360
	  
403
	  
361
	
404
	
362
        //
405
        //
363
        // Rule 40:  KeyWord ::= s o r t e d B y
406
        // Rule 40:  KeyWord ::= s o r t e d B y
364
        //
407
        //
365
		keywordKind[40] = (TK_sortedBy);
408
        
409
		keywordKind[40] = (OCLParsersym.TK_sortedBy);
366
	  
410
	  
367
	
411
	
368
        //
412
        //
369
        // Rule 41:  KeyWord ::= c l o s u r e
413
        // Rule 41:  KeyWord ::= c l o s u r e
370
        //
414
        //
371
		keywordKind[41] = (TK_closure);
415
        
416
		keywordKind[41] = (OCLParsersym.TK_closure);
372
	  
417
	  
373
	
418
	
374
        //
419
        //
375
        // Rule 42:  KeyWord ::= o c l I s K i n d O f
420
        // Rule 42:  KeyWord ::= o c l I s K i n d O f
376
        //
421
        //
377
		keywordKind[42] = (TK_oclIsKindOf);
422
        
423
		keywordKind[42] = (OCLParsersym.TK_oclIsKindOf);
378
	  
424
	  
379
	
425
	
380
        //
426
        //
381
        // Rule 43:  KeyWord ::= o c l I s T y p e O f
427
        // Rule 43:  KeyWord ::= o c l I s T y p e O f
382
        //
428
        //
383
		keywordKind[43] = (TK_oclIsTypeOf);
429
        
430
		keywordKind[43] = (OCLParsersym.TK_oclIsTypeOf);
384
	  
431
	  
385
	
432
	
386
        //
433
        //
387
        // Rule 44:  KeyWord ::= o c l A s T y p e
434
        // Rule 44:  KeyWord ::= o c l A s T y p e
388
        //
435
        //
389
		keywordKind[44] = (TK_oclAsType);
436
        
437
		keywordKind[44] = (OCLParsersym.TK_oclAsType);
390
	  
438
	  
391
	
439
	
392
        //
440
        //
393
        // Rule 45:  KeyWord ::= o c l I s N e w
441
        // Rule 45:  KeyWord ::= o c l I s N e w
394
        //
442
        //
395
		keywordKind[45] = (TK_oclIsNew);
443
        
444
		keywordKind[45] = (OCLParsersym.TK_oclIsNew);
396
	  
445
	  
397
	
446
	
398
        //
447
        //
399
        // Rule 46:  KeyWord ::= o c l I s U n d e f i n e d
448
        // Rule 46:  KeyWord ::= o c l I s U n d e f i n e d
400
        //
449
        //
401
		keywordKind[46] = (TK_oclIsUndefined);
450
        
451
		keywordKind[46] = (OCLParsersym.TK_oclIsUndefined);
402
	  
452
	  
403
	
453
	
404
        //
454
        //
405
        // Rule 47:  KeyWord ::= o c l I s I n v a l i d
455
        // Rule 47:  KeyWord ::= o c l I s I n v a l i d
406
        //
456
        //
407
		keywordKind[47] = (TK_oclIsInvalid);
457
        
458
		keywordKind[47] = (OCLParsersym.TK_oclIsInvalid);
408
	  
459
	  
409
	
460
	
410
        //
461
        //
411
        // Rule 48:  KeyWord ::= o c l I s I n S t a t e
462
        // Rule 48:  KeyWord ::= o c l I s I n S t a t e
412
        //
463
        //
413
		keywordKind[48] = (TK_oclIsInState);
464
        
465
		keywordKind[48] = (OCLParsersym.TK_oclIsInState);
414
	  
466
	  
415
	
467
	
416
        //
468
        //
417
        // Rule 49:  KeyWord ::= a l l I n s t a n c e s
469
        // Rule 49:  KeyWord ::= a l l I n s t a n c e s
418
        //
470
        //
419
		keywordKind[49] = (TK_allInstances);
471
        
472
		keywordKind[49] = (OCLParsersym.TK_allInstances);
420
	  
473
	  
421
	
474
	
422
        //
475
        //
423
        // Rule 50:  KeyWord ::= S t r i n g
476
        // Rule 50:  KeyWord ::= S t r i n g
424
        //
477
        //
425
		keywordKind[50] = (TK_String);
478
        
479
		keywordKind[50] = (OCLParsersym.TK_String);
426
	  
480
	  
427
	
481
	
428
        //
482
        //
429
        // Rule 51:  KeyWord ::= I n t e g e r
483
        // Rule 51:  KeyWord ::= I n t e g e r
430
        //
484
        //
431
		keywordKind[51] = (TK_Integer);
485
        
486
		keywordKind[51] = (OCLParsersym.TK_Integer);
432
	  
487
	  
433
	
488
	
434
        //
489
        //
435
        // Rule 52:  KeyWord ::= U n l i m i t e d N a t u r a l
490
        // Rule 52:  KeyWord ::= U n l i m i t e d N a t u r a l
436
        //
491
        //
437
		keywordKind[52] = (TK_UnlimitedNatural);
492
        
493
		keywordKind[52] = (OCLParsersym.TK_UnlimitedNatural);
438
	  
494
	  
439
	
495
	
440
        //
496
        //
441
        // Rule 53:  KeyWord ::= R e a l
497
        // Rule 53:  KeyWord ::= R e a l
442
        //
498
        //
443
		keywordKind[53] = (TK_Real);
499
        
500
		keywordKind[53] = (OCLParsersym.TK_Real);
444
	  
501
	  
445
	
502
	
446
        //
503
        //
447
        // Rule 54:  KeyWord ::= B o o l e a n
504
        // Rule 54:  KeyWord ::= B o o l e a n
448
        //
505
        //
449
		keywordKind[54] = (TK_Boolean);
506
        
507
		keywordKind[54] = (OCLParsersym.TK_Boolean);
450
	  
508
	  
451
	
509
	
452
        //
510
        //
453
        // Rule 55:  KeyWord ::= T u p l e
511
        // Rule 55:  KeyWord ::= T u p l e
454
        //
512
        //
455
		keywordKind[55] = (TK_Tuple);
513
        
514
		keywordKind[55] = (OCLParsersym.TK_Tuple);
456
	  
515
	  
457
	
516
	
458
        //
517
        //
459
        // Rule 56:  KeyWord ::= O c l A n y
518
        // Rule 56:  KeyWord ::= O c l A n y
460
        //
519
        //
461
		keywordKind[56] = (TK_OclAny);
520
        
521
		keywordKind[56] = (OCLParsersym.TK_OclAny);
462
	  
522
	  
463
	
523
	
464
        //
524
        //
465
        // Rule 57:  KeyWord ::= O c l V o i d
525
        // Rule 57:  KeyWord ::= O c l V o i d
466
        //
526
        //
467
		keywordKind[57] = (TK_OclVoid);
527
        
528
		keywordKind[57] = (OCLParsersym.TK_OclVoid);
468
	  
529
	  
469
	
530
	
470
        //
531
        //
471
        // Rule 58:  KeyWord ::= O c l I n v a l i d
532
        // Rule 58:  KeyWord ::= O c l I n v a l i d
472
        //
533
        //
473
		keywordKind[58] = (TK_OclInvalid);
534
        
535
		keywordKind[58] = (OCLParsersym.TK_OclInvalid);
474
	  
536
	  
475
	
537
	
476
        //
538
        //
477
        // Rule 59:  KeyWord ::= O c l M e s s a g e
539
        // Rule 59:  KeyWord ::= O c l M e s s a g e
478
        //
540
        //
479
		keywordKind[59] = (TK_OclMessage);
541
        
542
		keywordKind[59] = (OCLParsersym.TK_OclMessage);
480
	  
543
	  
481
	
544
	
482
        //
545
        //
483
        // Rule 60:  KeyWord ::= n u l l
546
        // Rule 60:  KeyWord ::= n u l l
484
        //
547
        //
485
		keywordKind[60] = (TK_null);
548
        
549
		keywordKind[60] = (OCLParsersym.TK_null);
486
	  
550
	  
487
	
551
	
488
        //
552
        //
489
        // Rule 61:  KeyWord ::= i n v a l i d
553
        // Rule 61:  KeyWord ::= i n v a l i d
490
        //
554
        //
491
		keywordKind[61] = (TK_invalid);
555
        
556
		keywordKind[61] = (OCLParsersym.TK_invalid);
492
	  
557
	  
493
	
558
	
494
        //
559
        //
495
        // Rule 62:  KeyWord ::= a t t r
560
        // Rule 62:  KeyWord ::= a t t r
496
        //
561
        //
497
		keywordKind[62] = (TK_attr);
562
        
563
		keywordKind[62] = (OCLParsersym.TK_attr);
498
	  
564
	  
499
	
565
	
500
        //
566
        //
501
        // Rule 63:  KeyWord ::= o p e r
567
        // Rule 63:  KeyWord ::= o p e r
502
        //
568
        //
503
		keywordKind[63] = (TK_oper);
569
        
570
		keywordKind[63] = (OCLParsersym.TK_oper);
504
	  
571
	  
505
	
572
	
506
        //
573
        //
507
        // Rule 64:  KeyWord ::= s t a t i c
574
        // Rule 64:  KeyWord ::= s t a t i c
508
        //
575
        //
509
		keywordKind[64] = (TK_static);
576
        
577
		keywordKind[64] = (OCLParsersym.TK_static);
510
	  
578
	  
511
	
579
	
512
513
        for (int i = 0; i < keywordKind.length; i++)
580
        for (int i = 0; i < keywordKind.length; i++)
514
        {
581
        {
515
            if (keywordKind[i] == 0)
582
            if (keywordKind[i] == 0)
(-)src/org/eclipse/ocl/parser/OCLParser.java (-10 / +12 lines)
Lines 12-22 Link Here
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
14
*   E.D.Willink - Bugs 225493, 243976, 259818, 282882, 287993
14
*   E.D.Willink - Bugs 225493, 243976, 259818, 282882, 287993
15
*   Zeligsoft - Bug 243976
15
*   Borland - Bug 242880
16
*   Borland - Bug 242880
17
*   Adolfo Sanchez-Barbudo Herrera (Open Canarias) - LPG v 2.0.17 adoption (242153)
16
*
18
*
17
* </copyright>
19
* </copyright>
18
*
20
*
19
* $Id: OCLParser.java,v 1.12 2009/09/04 13:40:43 ewillink Exp $
21
* $Id: EssentialOCL.g,v 1.7 2009/03/05 14:12:14 cdamus Exp $
20
*/
22
*/
21
23
22
package org.eclipse.ocl.parser;
24
package org.eclipse.ocl.parser;
Lines 43-57 Link Here
43
import org.eclipse.ocl.util.OCLStandardLibraryUtil;
45
import org.eclipse.ocl.util.OCLStandardLibraryUtil;
44
import org.eclipse.ocl.utilities.PredefinedType;
46
import org.eclipse.ocl.utilities.PredefinedType;
45
47
46
import lpg.lpgjavaruntime.BadParseException;
48
import lpg.runtime.BadParseException;
47
import lpg.lpgjavaruntime.BadParseSymFileException;
49
import lpg.runtime.BadParseSymFileException;
48
import lpg.lpgjavaruntime.DeterministicParser;
50
import lpg.runtime.DeterministicParser;
49
import lpg.lpgjavaruntime.DiagnoseParser;
51
import lpg.runtime.DiagnoseParser;
50
import lpg.lpgjavaruntime.IToken;
52
import lpg.runtime.IToken;
51
import lpg.lpgjavaruntime.Monitor;
53
import lpg.runtime.Monitor;
52
import lpg.lpgjavaruntime.NotDeterministicParseTableException;
54
import lpg.runtime.NotDeterministicParseTableException;
53
import lpg.lpgjavaruntime.ParseTable;
55
import lpg.runtime.ParseTable;
54
import lpg.lpgjavaruntime.RuleAction;
56
import lpg.runtime.RuleAction;
55
57
56
import org.eclipse.ocl.Environment;
58
import org.eclipse.ocl.Environment;
57
import org.eclipse.ocl.cst.DefCS;
59
import org.eclipse.ocl.cst.DefCS;
(-)src/org/eclipse/ocl/parser/OCLKWLexerprs.java (-46 / +95 lines)
Lines 1-7 Link Here
1
/**
1
/**
2
* <copyright>
2
* <copyright>
3
*
3
*
4
* Copyright (c) 2005, 2007 IBM Corporation and others.
4
* Copyright (c) 2005, 2009 IBM Corporation 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-24 Link Here
10
* Contributors:
10
* Contributors:
11
*   IBM - Initial API and implementation
11
*   IBM - Initial API and implementation
12
*   E.D.Willink - Lexer and Parser refactoring to support extensibility and flexible error handling
12
*   E.D.Willink - Lexer and Parser refactoring to support extensibility and flexible error handling
13
*   E.D.Willink - Bug 285633 static definitions
14
*   Adolfo Sanchez-Barbudo Herrera (Open Canarias) - LPG v 2.0.17 adoption (242153)
13
*
15
*
14
* </copyright>
16
* </copyright>
15
*
17
*
16
* $Id: OCLKWLexerprs.java,v 1.7 2009/09/04 13:40:43 ewillink Exp $
18
* 
17
*/
19
*/
18
20
19
package org.eclipse.ocl.parser;
21
package org.eclipse.ocl.parser;
20
22
21
public class OCLKWLexerprs implements lpg.lpgjavaruntime.ParseTable, OCLKWLexersym {
23
public class OCLKWLexerprs implements lpg.runtime.ParseTable, OCLKWLexersym {
24
    public final static int ERROR_SYMBOL = 0;
25
    public final int getErrorSymbol() { return ERROR_SYMBOL; }
26
27
    public final static int SCOPE_UBOUND = 0;
28
    public final int getScopeUbound() { return SCOPE_UBOUND; }
29
30
    public final static int SCOPE_SIZE = 0;
31
    public final int getScopeSize() { return SCOPE_SIZE; }
32
33
    public final static int MAX_NAME_LENGTH = 0;
34
    public final int getMaxNameLength() { return MAX_NAME_LENGTH; }
35
36
    public final static int NUM_STATES = 260;
37
    public final int getNumStates() { return NUM_STATES; }
38
39
    public final static int NT_OFFSET = 56;
40
    public final int getNtOffset() { return NT_OFFSET; }
41
42
    public final static int LA_STATE_OFFSET = 392;
43
    public final int getLaStateOffset() { return LA_STATE_OFFSET; }
44
45
    public final static int MAX_LA = 1;
46
    public final int getMaxLa() { return MAX_LA; }
47
48
    public final static int NUM_RULES = 64;
49
    public final int getNumRules() { return NUM_RULES; }
50
51
    public final static int NUM_NONTERMINALS = 2;
52
    public final int getNumNonterminals() { return NUM_NONTERMINALS; }
53
54
    public final static int NUM_SYMBOLS = 58;
55
    public final int getNumSymbols() { return NUM_SYMBOLS; }
56
57
    public final static int SEGMENT_SIZE = 8192;
58
    public final int getSegmentSize() { return SEGMENT_SIZE; }
59
60
    public final static int START_STATE = 65;
61
    public final int getStartState() { return START_STATE; }
62
63
    public final static int IDENTIFIER_SYMBOL = 0;
64
    public final int getIdentifier_SYMBOL() { return IDENTIFIER_SYMBOL; }
65
66
    public final static int EOFT_SYMBOL = 39;
67
    public final int getEoftSymbol() { return EOFT_SYMBOL; }
68
69
    public final static int EOLT_SYMBOL = 57;
70
    public final int getEoltSymbol() { return EOLT_SYMBOL; }
71
72
    public final static int ACCEPT_ACTION = 327;
73
    public final int getAcceptAction() { return ACCEPT_ACTION; }
74
75
    public final static int ERROR_ACTION = 328;
76
    public final int getErrorAction() { return ERROR_ACTION; }
77
78
    public final static boolean BACKTRACK = false;
79
    public final boolean getBacktrack() { return BACKTRACK; }
80
81
    public final int getStartSymbol() { return lhs(0); }
82
    public final boolean isValidForParser() { return OCLKWLexersym.isValidForParser; }
83
84
85
    public interface IsNullable {
86
        public final static byte isNullable[] = {0,
87
            0,0,0,0,0,0,0,0,0,0,
88
            0,0,0,0,0,0,0,0,0,0,
89
            0,0,0,0,0,0,0,0,0,0,
90
            0,0,0,0,0,0,0,0,0,0,
91
            0,0,0,0,0,0,0,0,0,0,
92
            0,0,0,0,0,0,0,0
93
        };
94
    };
95
    public final static byte isNullable[] = IsNullable.isNullable;
96
    public final boolean isNullable(int index) { return isNullable[index] != 0; }
97
98
    public interface ProsthesesIndex {
99
        public final static byte prosthesesIndex[] = {0,
100
            2,1
101
        };
102
    };
103
    public final static byte prosthesesIndex[] = ProsthesesIndex.prosthesesIndex;
104
    public final int prosthesesIndex(int index) { return prosthesesIndex[index]; }
22
105
23
    public interface IsKeyword {
106
    public interface IsKeyword {
24
        public final static byte isKeyword[] = {0,
107
        public final static byte isKeyword[] = {0,
Lines 27-33 Link Here
27
            0,0,0,0,0,0,0,0,0,0,
110
            0,0,0,0,0,0,0,0,0,0,
28
            0,0,0,0,0,0,0,0,0,0,
111
            0,0,0,0,0,0,0,0,0,0,
29
            0,0,0,0,0,0,0,0,0,0,
112
            0,0,0,0,0,0,0,0,0,0,
30
            0,0,0,0
113
            0,0,0,0,0,0
31
        };
114
        };
32
    };
115
    };
33
    public final static byte isKeyword[] = IsKeyword.isKeyword;
116
    public final static byte isKeyword[] = IsKeyword.isKeyword;
Lines 156-162 Link Here
156
            0,0,0,0,0,0,0,0,0,0,
239
            0,0,0,0,0,0,0,0,0,0,
157
            0,0,0,0,0,0,0,0,0,0,
240
            0,0,0,0,0,0,0,0,0,0,
158
            0,0,0,0,0,0,0,0,0,0,
241
            0,0,0,0,0,0,0,0,0,0,
159
            0,0,0,0,0,0,0,0,0,0
242
            0,0,0,0,0,0,0,0,0,0,
243
            0,0
160
        };
244
        };
161
    };
245
    };
162
    public final static byte termCheck[] = TermCheck.termCheck;
246
    public final static byte termCheck[] = TermCheck.termCheck;
Lines 242-297 Link Here
242
    public final int scopeState(int index) { return 0;}
326
    public final int scopeState(int index) { return 0;}
243
    public final int inSymb(int index) { return 0;}
327
    public final int inSymb(int index) { return 0;}
244
    public final String name(int index) { return null; }
328
    public final String name(int index) { return null; }
245
    public final int getErrorSymbol() { return 0; }
246
    public final int getScopeUbound() { return 0; }
247
    public final int getScopeSize() { return 0; }
248
    public final int getMaxNameLength() { return 0; }
249
250
    public final static int
251
           NUM_STATES        = 260,
252
           NT_OFFSET         = 54,
253
           LA_STATE_OFFSET   = 392,
254
           MAX_LA            = 1,
255
           NUM_RULES         = 64,
256
           NUM_NONTERMINALS  = 2,
257
           NUM_SYMBOLS       = 56,
258
           SEGMENT_SIZE      = 8192,
259
           START_STATE       = 65,
260
           IDENTIFIER_SYMBOL = 0,
261
           EOFT_SYMBOL       = 39,
262
           EOLT_SYMBOL       = 55,
263
           ACCEPT_ACTION     = 327,
264
           ERROR_ACTION      = 328;
265
266
    public final static boolean BACKTRACK = false;
267
268
    public final int getNumStates() { return NUM_STATES; }
269
    public final int getNtOffset() { return NT_OFFSET; }
270
    public final int getLaStateOffset() { return LA_STATE_OFFSET; }
271
    public final int getMaxLa() { return MAX_LA; }
272
    public final int getNumRules() { return NUM_RULES; }
273
    public final int getNumNonterminals() { return NUM_NONTERMINALS; }
274
    public final int getNumSymbols() { return NUM_SYMBOLS; }
275
    public final int getSegmentSize() { return SEGMENT_SIZE; }
276
    public final int getStartState() { return START_STATE; }
277
    public final int getStartSymbol() { return lhs[0]; }
278
    public final int getIdentifierSymbol() { return IDENTIFIER_SYMBOL; }
279
    public final int getEoftSymbol() { return EOFT_SYMBOL; }
280
    public final int getEoltSymbol() { return EOLT_SYMBOL; }
281
    public final int getAcceptAction() { return ACCEPT_ACTION; }
282
    public final int getErrorAction() { return ERROR_ACTION; }
283
    public final boolean isValidForParser() { return isValidForParser; }
284
    public final boolean getBacktrack() { return BACKTRACK; }
285
286
    public final int originalState(int state) { return 0; }
329
    public final int originalState(int state) { return 0; }
287
    public final int asi(int state) { return 0; }
330
    public final int asi(int state) { return 0; }
288
    public final int nasi(int state) { return 0; }
331
    public final int nasi(int state) { return 0; }
289
    public final int inSymbol(int state) { return 0; }
332
    public final int inSymbol(int state) { return 0; }
290
333
334
    /**
335
     * assert(! goto_default);
336
     */
291
    public final int ntAction(int state, int sym) {
337
    public final int ntAction(int state, int sym) {
292
        return baseAction[state + sym];
338
        return baseAction[state + sym];
293
    }
339
    }
294
340
341
    /**
342
     * assert(! shift_default);
343
     */
295
    public final int tAction(int state, int sym) {
344
    public final int tAction(int state, int sym) {
296
        int i = baseAction[state],
345
        int i = baseAction[state],
297
            k = i + sym;
346
            k = i + sym;
(-)src/org/eclipse/ocl/parser/OCLParser.g
Lines 1-7 Link Here
1
--/**
1
--/**
2
-- * <copyright>
2
-- * <copyright>
3
-- *
3
-- *
(-)* Copyright (c) 2005, 2009 IBM Corporation and others. (-66 / +67 lines)
Lines 12-17 Link Here
12
-- *   E.D. Willink - Elimination of some shift-reduce conflicts
12
-- *   E.D. Willink - Elimination of some shift-reduce conflicts
13
-- *      - Bug 259818
13
-- *      - Bug 259818
14
-- *   E.D.Willink - Bug 285633 static definitions
14
-- *   E.D.Willink - Bug 285633 static definitions
15
-- *   Adolfo Sanchez- Barbudo Herrera - LPG v 2.0.17 adoption
15
-- *
16
-- *
16
-- * </copyright>
17
-- * </copyright>
17
-- *
18
-- *
Lines 30-56 Link Here
30
%options margin=4
31
%options margin=4
31
%options noserialize
32
%options noserialize
32
%options package=org.eclipse.ocl.parser
33
%options package=org.eclipse.ocl.parser
33
%options import_terminals=OCLLexer.g
34
%options import_terminals=OCLLexer.gi
34
%options ast_type=CSTNode
35
%options ast_type=CSTNode
35
%options programming_language=java
36
%options programming_language=java
36
%options action=("*.java", "/.", "./")
37
%options action-block=("*.java", "/.", "./")
37
%options ParseTable=lpg.lpgjavaruntime.ParseTable
38
%options ParseTable=lpg.runtime.ParseTable
38
%options include_directory=".;../lpg"
39
%options include_directory=".;../lpg"
39
40
40
$Start
41
%Start
41
	goal
42
	goal
42
$End
43
%End
43
44
44
$Include
45
%Import
45
	EssentialOCL.g
46
	EssentialOCL.gi
46
$End
47
%End
47
48
48
$Define
49
%Define
49
    $environment_class /.Environment<?,?,?,?,?,?,?,?,?,?,?,?>./
50
    $environment_class /.Environment<?,?,?,?,?,?,?,?,?,?,?,?>./
50
	$lex_stream_class /.OCLLexer./
51
	$lex_stream_class /.OCLLexer./
51
$End
52
%End
52
53
53
$Globals
54
%Globals
54
	/.
55
	/.
55
	import org.eclipse.ocl.Environment;
56
	import org.eclipse.ocl.Environment;
56
	import org.eclipse.ocl.cst.DefCS;
57
	import org.eclipse.ocl.cst.DefCS;
Lines 61-69 Link Here
61
	import org.eclipse.ocl.cst.PackageDeclarationCS;
62
	import org.eclipse.ocl.cst.PackageDeclarationCS;
62
	import org.eclipse.ocl.cst.PrePostOrBodyEnum;
63
	import org.eclipse.ocl.cst.PrePostOrBodyEnum;
63
	./
64
	./
64
$End
65
%End
65
66
66
$KeyWords
67
%KeyWords
67
	context
68
	context
68
	package
69
	package
69
	
70
	
Lines 74-82 Link Here
74
	--
75
	--
75
	attr
76
	attr
76
	oper
77
	oper
77
$End
78
%End
78
79
79
$Rules
80
%Rules
80
	-- opt = optional
81
	-- opt = optional
81
	-- m = multiple
82
	-- m = multiple
82
	
83
	
Lines 86-141 Link Here
86
	goal -> prePostOrBodyDeclCS
87
	goal -> prePostOrBodyDeclCS
87
	goal -> initOrDerValueCS
88
	goal -> initOrDerValueCS
88
	goal -> variableCS
89
	goal -> variableCS
89
	goal -> $empty	
90
	goal -> %empty	
90
91
91
	packageDeclarationCSm -> packageDeclarationCS
92
	packageDeclarationCSm -> packageDeclarationCS
92
	packageDeclarationCSm ::= packageDeclarationCSm packageDeclarationCS
93
	packageDeclarationCSm ::= packageDeclarationCSm packageDeclarationCS
93
		/.$BeginJava
94
		/.$BeginCode
94
					PackageDeclarationCS result = (PackageDeclarationCS)$getSym(2);
95
					PackageDeclarationCS result = (PackageDeclarationCS)$getSym(2);
95
					result.setPackageDeclarationCS((PackageDeclarationCS) $getSym(1));
96
					result.setPackageDeclarationCS((PackageDeclarationCS) $getSym(1));
96
					$setResult(result);
97
					$setResult(result);
97
		  $EndJava
98
		  $EndCode
98
		./
99
		./
99
	packageDeclarationCS ::= package pathNameCS contextDeclCSmopt endpackage
100
	packageDeclarationCS ::= package pathNameCS contextDeclCSmopt endpackage
100
		/.$BeginJava
101
		/.$BeginCode
101
					CSTNode result = createPackageDeclarationCS(
102
					CSTNode result = createPackageDeclarationCS(
102
							(PathNameCS)$getSym(2),
103
							(PathNameCS)$getSym(2),
103
							(EList)$getSym(3)
104
							(EList)$getSym(3)
104
						);
105
						);
105
					setOffsets(result, getIToken($getToken(1)), getIToken($getToken(4)));
106
					setOffsets(result, getIToken($getToken(1)), getIToken($getToken(4)));
106
					$setResult(result);
107
					$setResult(result);
107
		  $EndJava
108
		  $EndCode
108
		./
109
		./
109
	
110
	
110
	packageDeclarationCS1 ::= contextDeclCSm
111
	packageDeclarationCS1 ::= contextDeclCSm
111
		/.$BeginJava
112
		/.$BeginCode
112
					EList contextDecls = (EList)$getSym(1);
113
					EList contextDecls = (EList)$getSym(1);
113
					CSTNode result = createPackageDeclarationCS(null, contextDecls);
114
					CSTNode result = createPackageDeclarationCS(null, contextDecls);
114
					if (!contextDecls.isEmpty()) {
115
					if (!contextDecls.isEmpty()) {
115
						setOffsets(result, (CSTNode)contextDecls.get(0), (CSTNode)contextDecls.get(contextDecls.size()-1));
116
						setOffsets(result, (CSTNode)contextDecls.get(0), (CSTNode)contextDecls.get(contextDecls.size()-1));
116
					}
117
					}
117
					$setResult(result);
118
					$setResult(result);
118
		  $EndJava
119
		  $EndCode
119
		./
120
		./
120
121
121
122
122
	contextDeclCSmopt ::= $empty
123
	contextDeclCSmopt ::= %empty
123
		/.$EmptyListAction./
124
		/.$EmptyListAction./
124
	contextDeclCSmopt -> contextDeclCSm
125
	contextDeclCSmopt -> contextDeclCSm
125
126
126
	contextDeclCSm ::= contextDeclCS
127
	contextDeclCSm ::= contextDeclCS
127
		/.$BeginJava
128
		/.$BeginCode
128
					EList result = new BasicEList();
129
					EList result = new BasicEList();
129
					result.add($getSym(1));
130
					result.add($getSym(1));
130
					$setResult(result);
131
					$setResult(result);
131
		  $EndJava
132
		  $EndCode
132
		./
133
		./
133
	contextDeclCSm ::= contextDeclCSm contextDeclCS
134
	contextDeclCSm ::= contextDeclCSm contextDeclCS
134
		/.$BeginJava
135
		/.$BeginCode
135
					EList result = (EList)$getSym(1);
136
					EList result = (EList)$getSym(1);
136
					result.add($getSym(2));
137
					result.add($getSym(2));
137
					$setResult(result);
138
					$setResult(result);
138
		  $EndJava
139
		  $EndCode
139
		./
140
		./
140
141
141
	contextDeclCS -> classifierContextDeclCS
142
	contextDeclCS -> classifierContextDeclCS
Lines 143-149 Link Here
143
	contextDeclCS -> propertyContextCS
144
	contextDeclCS -> propertyContextCS
144
145
145
	propertyContextCS ::= context pathNameCS '::' simpleNameCS ':' typeCS initOrDerValueCSm
146
	propertyContextCS ::= context pathNameCS '::' simpleNameCS ':' typeCS initOrDerValueCSm
146
		/.$BeginJava
147
		/.$BeginCode
147
					EList<InitOrDerValueCS> list = (EList<InitOrDerValueCS>)$getSym(7);
148
					EList<InitOrDerValueCS> list = (EList<InitOrDerValueCS>)$getSym(7);
148
					CSTNode result = createPropertyContextCS(
149
					CSTNode result = createPropertyContextCS(
149
							(PathNameCS)$getSym(2),
150
							(PathNameCS)$getSym(2),
Lines 153-193 Link Here
153
						);
154
						);
154
					setOffsets(result, getIToken($getToken(1)), list.get(list.size()-1));
155
					setOffsets(result, getIToken($getToken(1)), list.get(list.size()-1));
155
					$setResult(result);
156
					$setResult(result);
156
		  $EndJava
157
		  $EndCode
157
		./
158
		./
158
159
159
	initOrDerValueCSm ::= initOrDerValueCS
160
	initOrDerValueCSm ::= initOrDerValueCS
160
		/.$BeginJava
161
		/.$BeginCode
161
					EList<InitOrDerValueCS> result = new BasicEList<InitOrDerValueCS>();
162
					EList<InitOrDerValueCS> result = new BasicEList<InitOrDerValueCS>();
162
					result.add((InitOrDerValueCS)$getSym(1));
163
					result.add((InitOrDerValueCS)$getSym(1));
163
					$setResult(result);
164
					$setResult(result);
164
		  $EndJava
165
		  $EndCode
165
		./
166
		./
166
	initOrDerValueCSm ::= initOrDerValueCSm initOrDerValueCS
167
	initOrDerValueCSm ::= initOrDerValueCSm initOrDerValueCS
167
		/.$BeginJava
168
		/.$BeginCode
168
					EList<InitOrDerValueCS> result = (EList<InitOrDerValueCS>)$getSym(1);
169
					EList<InitOrDerValueCS> result = (EList<InitOrDerValueCS>)$getSym(1);
169
					result.add((InitOrDerValueCS)$getSym(2));
170
					result.add((InitOrDerValueCS)$getSym(2));
170
					$setResult(result);
171
					$setResult(result);
171
		  $EndJava
172
		  $EndCode
172
		./
173
		./
173
	initOrDerValueCS ::= init ':' oclExpressionCS
174
	initOrDerValueCS ::= init ':' oclExpressionCS
174
		/.$BeginJava
175
		/.$BeginCode
175
					CSTNode result = createInitValueCS((OCLExpressionCS)$getSym(3));
176
					CSTNode result = createInitValueCS((OCLExpressionCS)$getSym(3));
176
					setOffsets(result, getIToken($getToken(1)), (CSTNode)$getSym(3));
177
					setOffsets(result, getIToken($getToken(1)), (CSTNode)$getSym(3));
177
					$setResult(result);
178
					$setResult(result);
178
		  $EndJava
179
		  $EndCode
179
		./
180
		./
180
181
181
	initOrDerValueCS ::= derive ':' oclExpressionCS
182
	initOrDerValueCS ::= derive ':' oclExpressionCS
182
		/.$BeginJava
183
		/.$BeginCode
183
					CSTNode result = createDerValueCS((OCLExpressionCS)$getSym(3));
184
					CSTNode result = createDerValueCS((OCLExpressionCS)$getSym(3));
184
					setOffsets(result, getIToken($getToken(1)), (CSTNode)$getSym(3));
185
					setOffsets(result, getIToken($getToken(1)), (CSTNode)$getSym(3));
185
					$setResult(result);
186
					$setResult(result);
186
		  $EndJava
187
		  $EndCode
187
		./
188
		./
188
189
189
	classifierContextDeclCS ::= context pathNameCS invOrDefCSm
190
	classifierContextDeclCS ::= context pathNameCS invOrDefCSm
190
		/.$BeginJava
191
		/.$BeginCode
191
					EList<InvOrDefCS> list = (EList<InvOrDefCS>)$getSym(3);
192
					EList<InvOrDefCS> list = (EList<InvOrDefCS>)$getSym(3);
192
					CSTNode result = createClassifierContextDeclCS(
193
					CSTNode result = createClassifierContextDeclCS(
193
							(PathNameCS)$getSym(2),
194
							(PathNameCS)$getSym(2),
Lines 195-250 Link Here
195
						);
196
						);
196
					setOffsets(result, getIToken($getToken(1)), list.get(list.size()-1));
197
					setOffsets(result, getIToken($getToken(1)), list.get(list.size()-1));
197
					$setResult(result);
198
					$setResult(result);
198
		  $EndJava
199
		  $EndCode
199
		./
200
		./
200
201
201
	invOrDefCSm ::= invOrDefCS
202
	invOrDefCSm ::= invOrDefCS
202
		/.$BeginJava
203
		/.$BeginCode
203
					EList<InvOrDefCS> result = new BasicEList<InvOrDefCS>();
204
					EList<InvOrDefCS> result = new BasicEList<InvOrDefCS>();
204
					result.add((InvOrDefCS)$getSym(1));
205
					result.add((InvOrDefCS)$getSym(1));
205
					$setResult(result);
206
					$setResult(result);
206
		  $EndJava
207
		  $EndCode
207
		./
208
		./
208
	invOrDefCSm ::= invOrDefCSm invOrDefCS
209
	invOrDefCSm ::= invOrDefCSm invOrDefCS
209
		/.$BeginJava
210
		/.$BeginCode
210
					EList<InvOrDefCS> result = (EList<InvOrDefCS>)$getSym(1);
211
					EList<InvOrDefCS> result = (EList<InvOrDefCS>)$getSym(1);
211
					result.add((InvOrDefCS)$getSym(2));
212
					result.add((InvOrDefCS)$getSym(2));
212
					$setResult(result);
213
					$setResult(result);
213
		  $EndJava
214
		  $EndCode
214
		./
215
		./
215
	invOrDefCS ::= inv simpleNameCSopt ':' oclExpressionCS
216
	invOrDefCS ::= inv simpleNameCSopt ':' oclExpressionCS
216
		/.$BeginJava
217
		/.$BeginCode
217
					CSTNode result = createInvCS(
218
					CSTNode result = createInvCS(
218
							(SimpleNameCS)$getSym(2),
219
							(SimpleNameCS)$getSym(2),
219
							(OCLExpressionCS)$getSym(4)
220
							(OCLExpressionCS)$getSym(4)
220
						);
221
						);
221
					setOffsets(result, getIToken($getToken(1)), (CSTNode)$getSym(4));
222
					setOffsets(result, getIToken($getToken(1)), (CSTNode)$getSym(4));
222
					$setResult(result);
223
					$setResult(result);
223
		  $EndJava
224
		  $EndCode
224
		./
225
		./
225
	
226
	
226
	defCS ::= def simpleNameCSopt ':' defExpressionCS
227
	defCS ::= def simpleNameCSopt ':' defExpressionCS
227
		/.$BeginJava
228
		/.$BeginCode
228
					DefCS result = createDefCS(
229
					DefCS result = createDefCS(
229
							(SimpleNameCS)$getSym(2),
230
							(SimpleNameCS)$getSym(2),
230
							(DefExpressionCS)$getSym(4)
231
							(DefExpressionCS)$getSym(4)
231
						);
232
						);
232
					setOffsets(result, getIToken($getToken(1)), (CSTNode)$getSym(4));
233
					setOffsets(result, getIToken($getToken(1)), (CSTNode)$getSym(4));
233
					$setResult(result);
234
					$setResult(result);
234
		  $EndJava
235
		  $EndCode
235
		./
236
		./
236
	invOrDefCS -> defCS
237
	invOrDefCS -> defCS
237
	invOrDefCS ::= static defCS
238
	invOrDefCS ::= static defCS
238
		/.$BeginJava
239
		/.$BeginCode
239
					DefCS result = (DefCS)$getSym(2);
240
					DefCS result = (DefCS)$getSym(2);
240
					result.setStatic(true);
241
					result.setStatic(true);
241
					setOffsets(result, getIToken($getToken(1)), result);
242
					setOffsets(result, getIToken($getToken(1)), result);
242
					$setResult(result);
243
					$setResult(result);
243
		  $EndJava
244
		  $EndCode
244
		./
245
		./
245
246
246
	defExpressionCS ::= typedVariableCS '=' oclExpressionCS
247
	defExpressionCS ::= typedVariableCS '=' oclExpressionCS
247
		/.$BeginJava
248
		/.$BeginCode
248
					VariableCS variableCS = (VariableCS)$getSym(1);
249
					VariableCS variableCS = (VariableCS)$getSym(1);
249
					OCLExpressionCS expressionCS = (OCLExpressionCS)$getSym(3);
250
					OCLExpressionCS expressionCS = (OCLExpressionCS)$getSym(3);
250
					CSTNode result = createDefExpressionCS(
251
					CSTNode result = createDefExpressionCS(
Lines 254-263 Link Here
254
						);
255
						);
255
					setOffsets(result, variableCS, expressionCS);
256
					setOffsets(result, variableCS, expressionCS);
256
					$setResult(result);
257
					$setResult(result);
257
		  $EndJava
258
		  $EndCode
258
		./
259
		./
259
	defExpressionCS ::= operationCS1 '=' oclExpressionCS
260
	defExpressionCS ::= operationCS1 '=' oclExpressionCS
260
		/.$BeginJava
261
		/.$BeginCode
261
					CSTNode result = createDefExpressionCS(
262
					CSTNode result = createDefExpressionCS(
262
							null,
263
							null,
263
							(OperationCS)$getSym(1),
264
							(OperationCS)$getSym(1),
Lines 265-275 Link Here
265
						);
266
						);
266
					setOffsets(result, (CSTNode)$getSym(1), (CSTNode)$getSym(3));
267
					setOffsets(result, (CSTNode)$getSym(1), (CSTNode)$getSym(3));
267
					$setResult(result);
268
					$setResult(result);
268
		  $EndJava
269
		  $EndCode
269
		./
270
		./
270
271
271
	operationContextDeclCS ::= context operationCS2 prePostOrBodyDeclCSm
272
	operationContextDeclCS ::= context operationCS2 prePostOrBodyDeclCSm
272
		/.$BeginJava
273
		/.$BeginCode
273
					EList prePostOrBodyDecls = (EList)$getSym(3);
274
					EList prePostOrBodyDecls = (EList)$getSym(3);
274
					CSTNode result = createOperationContextDeclCS(
275
					CSTNode result = createOperationContextDeclCS(
275
							(OperationCS)$getSym(2),
276
							(OperationCS)$getSym(2),
Lines 277-302 Link Here
277
						);
278
						);
278
					setOffsets(result, getIToken($getToken(1)), (CSTNode)prePostOrBodyDecls.get(prePostOrBodyDecls.size()-1));
279
					setOffsets(result, getIToken($getToken(1)), (CSTNode)prePostOrBodyDecls.get(prePostOrBodyDecls.size()-1));
279
					$setResult(result);
280
					$setResult(result);
280
		  $EndJava
281
		  $EndCode
281
		./
282
		./
282
283
283
	prePostOrBodyDeclCSm ::= prePostOrBodyDeclCS
284
	prePostOrBodyDeclCSm ::= prePostOrBodyDeclCS
284
		/.$BeginJava
285
		/.$BeginCode
285
					EList result = new BasicEList();
286
					EList result = new BasicEList();
286
					result.add($getSym(1));
287
					result.add($getSym(1));
287
					$setResult(result);
288
					$setResult(result);
288
		  $EndJava
289
		  $EndCode
289
		./
290
		./
290
	prePostOrBodyDeclCSm ::= prePostOrBodyDeclCSm prePostOrBodyDeclCS
291
	prePostOrBodyDeclCSm ::= prePostOrBodyDeclCSm prePostOrBodyDeclCS
291
		/.$BeginJava
292
		/.$BeginCode
292
					EList result = (EList)$getSym(1);
293
					EList result = (EList)$getSym(1);
293
					result.add($getSym(2));
294
					result.add($getSym(2));
294
					$setResult(result);
295
					$setResult(result);
295
		  $EndJava
296
		  $EndCode
296
		./
297
		./
297
298
298
	prePostOrBodyDeclCS ::= pre simpleNameCSopt ':' oclExpressionCS
299
	prePostOrBodyDeclCS ::= pre simpleNameCSopt ':' oclExpressionCS
299
		/.$BeginJava
300
		/.$BeginCode
300
					CSTNode result = createPrePostOrBodyDeclCS(
301
					CSTNode result = createPrePostOrBodyDeclCS(
301
							PrePostOrBodyEnum.PRE_LITERAL,
302
							PrePostOrBodyEnum.PRE_LITERAL,
302
							(SimpleNameCS)$getSym(2),
303
							(SimpleNameCS)$getSym(2),
Lines 304-313 Link Here
304
						);
305
						);
305
					setOffsets(result, getIToken($getToken(1)), (CSTNode)$getSym(4));
306
					setOffsets(result, getIToken($getToken(1)), (CSTNode)$getSym(4));
306
					$setResult(result);
307
					$setResult(result);
307
		  $EndJava
308
		  $EndCode
308
		./
309
		./
309
	prePostOrBodyDeclCS ::= post simpleNameCSopt ':' oclExpressionCS
310
	prePostOrBodyDeclCS ::= post simpleNameCSopt ':' oclExpressionCS
310
		/.$BeginJava
311
		/.$BeginCode
311
					CSTNode result = createPrePostOrBodyDeclCS(
312
					CSTNode result = createPrePostOrBodyDeclCS(
312
							PrePostOrBodyEnum.POST_LITERAL,
313
							PrePostOrBodyEnum.POST_LITERAL,
313
							(SimpleNameCS)$getSym(2),
314
							(SimpleNameCS)$getSym(2),
Lines 315-324 Link Here
315
						);
316
						);
316
					setOffsets(result, getIToken($getToken(1)), (CSTNode)$getSym(4));
317
					setOffsets(result, getIToken($getToken(1)), (CSTNode)$getSym(4));
317
					$setResult(result);
318
					$setResult(result);
318
		  $EndJava
319
		  $EndCode
319
		./
320
		./
320
	prePostOrBodyDeclCS ::= body simpleNameCSopt ':' oclExpressionCS
321
	prePostOrBodyDeclCS ::= body simpleNameCSopt ':' oclExpressionCS
321
		/.$BeginJava
322
		/.$BeginCode
322
					CSTNode result = createPrePostOrBodyDeclCS(
323
					CSTNode result = createPrePostOrBodyDeclCS(
323
							PrePostOrBodyEnum.BODY_LITERAL,
324
							PrePostOrBodyEnum.BODY_LITERAL,
324
							(SimpleNameCS)$getSym(2),
325
							(SimpleNameCS)$getSym(2),
Lines 326-331 Link Here
326
						);
327
						);
327
					setOffsets(result, getIToken($getToken(1)), (CSTNode)$getSym(4));
328
					setOffsets(result, getIToken($getToken(1)), (CSTNode)$getSym(4));
328
					$setResult(result);
329
					$setResult(result);
329
		  $EndJava
330
		  $EndCode
330
		./
331
		./
331
$End
332
%End
(-)src/org/eclipse/ocl/parser/AbstractOCLParser.java (-9 / +10 lines)
Lines 20-31 Link Here
20
 */
20
 */
21
package org.eclipse.ocl.parser;
21
package org.eclipse.ocl.parser;
22
22
23
import lpg.lpgjavaruntime.IToken;
23
import lpg.runtime.IToken;
24
import lpg.lpgjavaruntime.NullExportedSymbolsException;
24
import lpg.runtime.NullExportedSymbolsException;
25
import lpg.lpgjavaruntime.NullTerminalSymbolsException;
25
import lpg.runtime.NullTerminalSymbolsException;
26
import lpg.lpgjavaruntime.ParseErrorCodes;
26
import lpg.runtime.ParseErrorCodes;
27
import lpg.lpgjavaruntime.UndefinedEofSymbolException;
27
import lpg.runtime.UndefinedEofSymbolException;
28
import lpg.lpgjavaruntime.UnimplementedTerminalsException;
28
import lpg.runtime.UnimplementedTerminalsException;
29
29
30
import org.eclipse.emf.common.util.EList;
30
import org.eclipse.emf.common.util.EList;
31
import org.eclipse.ocl.cst.BooleanLiteralExpCS;
31
import org.eclipse.ocl.cst.BooleanLiteralExpCS;
Lines 87-92 Link Here
87
import org.eclipse.ocl.options.ParsingOptions;
87
import org.eclipse.ocl.options.ParsingOptions;
88
import org.eclipse.ocl.options.ProblemOption;
88
import org.eclipse.ocl.options.ProblemOption;
89
89
90
90
public abstract class AbstractOCLParser
91
public abstract class AbstractOCLParser
91
		extends AbstractParser {
92
		extends AbstractParser {
92
	
93
	
Lines 671-677 Link Here
671
	 * @param stringLiteral a string literal token with escape notation 
672
	 * @param stringLiteral a string literal token with escape notation 
672
	 * @return the unescaped string
673
	 * @return the unescaped string
673
	 * 
674
	 * 
674
	 * @since 1.3
675
	 * @since 3.0
675
	 */
676
	 */
676
	protected String unescape(IToken stringLiteral) {
677
	protected String unescape(IToken stringLiteral) {
677
		String rawString = stringLiteral.toString();
678
		String rawString = stringLiteral.toString();
Lines 696-702 Link Here
696
				if (i >= n) {
697
				if (i >= n) {
697
					reportError(
698
					reportError(
698
						ParseErrorCodes.INVALID_CODE,
699
						ParseErrorCodes.INVALID_CODE,
699
						"", stringLiteral.getTokenIndex(), stringLiteral.getTokenIndex(), //$NON-NLS-1$
700
						stringLiteral.getTokenIndex(), stringLiteral.getTokenIndex(),
700
						OCLMessages.StringNotProperlyClosed_ERROR);
701
						OCLMessages.StringNotProperlyClosed_ERROR);
701
				}
702
				}
702
				char nextCh = rawString.charAt(i);
703
				char nextCh = rawString.charAt(i);
Lines 765-771 Link Here
765
							if (unescapedChar < 0) {
766
							if (unescapedChar < 0) {
766
								reportError(
767
								reportError(
767
									ParseErrorCodes.INVALID_CODE,
768
									ParseErrorCodes.INVALID_CODE,
768
									"", stringLiteral.getTokenIndex(), stringLiteral.getTokenIndex(), //$NON-NLS-1$
769
									stringLiteral.getTokenIndex(), stringLiteral.getTokenIndex(),
769
									OCLMessages.InvalidEscapeSequence_ERROR);
770
									OCLMessages.InvalidEscapeSequence_ERROR);
770
							}
771
							}
771
							break;
772
							break;
(-)src/org/eclipse/ocl/parser/OCLParserprs.java (-67 / +134 lines)
Lines 12-22 Link Here
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
14
*   E.D.Willink - Bugs 225493, 243976, 259818, 282882, 287993
14
*   E.D.Willink - Bugs 225493, 243976, 259818, 282882, 287993
15
*   Zeligsoft - Bug 243976
15
*   Borland - Bug 242880
16
*   Borland - Bug 242880
17
*   Adolfo Sanchez-Barbudo Herrera (Open Canarias) - LPG v 2.0.17 adoption (242153)
16
*
18
*
17
* </copyright>
19
* </copyright>
18
*
20
*
19
* $Id: OCLParserprs.java,v 1.11 2009/09/04 13:40:43 ewillink Exp $
21
* $Id: EssentialOCL.g,v 1.7 2009/03/05 14:12:14 cdamus Exp $
20
*/
22
*/
21
23
22
package org.eclipse.ocl.parser;
24
package org.eclipse.ocl.parser;
Lines 25-31 Link Here
25
 * @noextend This interface is not intended to be extended by clients.
27
 * @noextend This interface is not intended to be extended by clients.
26
 */
28
 */
27
@SuppressWarnings("nls")
29
@SuppressWarnings("nls")
28
public class OCLParserprs implements lpg.lpgjavaruntime.ParseTable, OCLParsersym {
30
public class OCLParserprs implements lpg.runtime.ParseTable, OCLParsersym {
31
    public final static int ERROR_SYMBOL = 102;
32
    public final int getErrorSymbol() { return ERROR_SYMBOL; }
33
34
    public final static int SCOPE_UBOUND = 43;
35
    public final int getScopeUbound() { return SCOPE_UBOUND; }
36
37
    public final static int SCOPE_SIZE = 44;
38
    public final int getScopeSize() { return SCOPE_SIZE; }
39
40
    public final static int MAX_NAME_LENGTH = 26;
41
    public final int getMaxNameLength() { return MAX_NAME_LENGTH; }
42
43
    public final static int NUM_STATES = 213;
44
    public final int getNumStates() { return NUM_STATES; }
45
46
    public final static int NT_OFFSET = 102;
47
    public final int getNtOffset() { return NT_OFFSET; }
48
49
    public final static int LA_STATE_OFFSET = 3457;
50
    public final int getLaStateOffset() { return LA_STATE_OFFSET; }
51
52
    public final static int MAX_LA = 2;
53
    public final int getMaxLa() { return MAX_LA; }
54
55
    public final static int NUM_RULES = 275;
56
    public final int getNumRules() { return NUM_RULES; }
57
58
    public final static int NUM_NONTERMINALS = 106;
59
    public final int getNumNonterminals() { return NUM_NONTERMINALS; }
60
61
    public final static int NUM_SYMBOLS = 208;
62
    public final int getNumSymbols() { return NUM_SYMBOLS; }
63
64
    public final static int SEGMENT_SIZE = 8192;
65
    public final int getSegmentSize() { return SEGMENT_SIZE; }
66
67
    public final static int START_STATE = 2971;
68
    public final int getStartState() { return START_STATE; }
69
70
    public final static int IDENTIFIER_SYMBOL = 2;
71
    public final int getIdentifier_SYMBOL() { return IDENTIFIER_SYMBOL; }
72
73
    public final static int EOFT_SYMBOL = 97;
74
    public final int getEoftSymbol() { return EOFT_SYMBOL; }
75
76
    public final static int EOLT_SYMBOL = 97;
77
    public final int getEoltSymbol() { return EOLT_SYMBOL; }
78
79
    public final static int ACCEPT_ACTION = 3181;
80
    public final int getAcceptAction() { return ACCEPT_ACTION; }
81
82
    public final static int ERROR_ACTION = 3182;
83
    public final int getErrorAction() { return ERROR_ACTION; }
84
85
    public final static boolean BACKTRACK = false;
86
    public final boolean getBacktrack() { return BACKTRACK; }
87
88
    public final int getStartSymbol() { return lhs(0); }
89
    public final boolean isValidForParser() { return OCLParsersym.isValidForParser; }
90
91
92
    public interface IsNullable {
93
        public final static byte isNullable[] = {0,
94
            0,0,0,0,0,0,0,0,0,0,
95
            0,0,0,0,0,0,0,0,0,0,
96
            0,0,0,0,0,0,0,0,0,0,
97
            0,0,0,0,0,0,0,0,0,0,
98
            0,0,0,0,0,0,0,0,0,0,
99
            0,0,0,0,0,0,0,0,0,0,
100
            0,0,0,0,0,0,0,0,0,0,
101
            0,0,0,0,0,0,0,0,0,0,
102
            0,0,0,0,0,0,0,0,0,0,
103
            0,0,0,0,0,0,0,0,0,0,
104
            0,0,0,0,0,0,0,0,0,0,
105
            0,0,0,0,0,0,0,0,0,0,
106
            0,0,0,0,0,0,0,0,0,0,
107
            0,0,0,0,0,0,0,0,0,0,
108
            0,0,0,0,0,0,0,0,0,0,
109
            0,0,1,0,0,0,0,1,1,0,
110
            0,0,0,0,0,0,0,0,0,0,
111
            1,1,0,0,0,0,0,0,0,1,
112
            0,0,0,1,0,0,0,0,0,0,
113
            1,1,0,0,0,0,0,1,1,0,
114
            0,1,0,0,0,0,0,0
115
        };
116
    };
117
    public final static byte isNullable[] = IsNullable.isNullable;
118
    public final boolean isNullable(int index) { return isNullable[index] != 0; }
119
120
    public interface ProsthesesIndex {
121
        public final static byte prosthesesIndex[] = {0,
122
            55,54,9,21,63,5,6,7,10,3,
123
            8,15,50,51,11,40,42,44,48,49,
124
            57,58,59,60,61,62,68,69,70,71,
125
            72,41,43,38,39,34,35,36,37,32,
126
            33,30,31,28,29,25,26,27,78,23,
127
            52,53,79,81,82,24,47,98,99,100,
128
            101,104,89,92,93,94,4,12,19,20,
129
            22,66,67,74,80,84,85,87,88,95,
130
            97,2,13,14,17,18,45,46,56,64,
131
            65,73,75,76,77,83,86,90,91,96,
132
            102,103,105,106,1,16
133
        };
134
    };
135
    public final static byte prosthesesIndex[] = ProsthesesIndex.prosthesesIndex;
136
    public final int prosthesesIndex(int index) { return prosthesesIndex[index]; }
29
137
30
    public interface IsKeyword {
138
    public interface IsKeyword {
31
        public final static byte isKeyword[] = {0,
139
        public final static byte isKeyword[] = {0,
Lines 1206-1234 Link Here
1206
1314
1207
    public interface ScopeRhs {
1315
    public interface ScopeRhs {
1208
        public final static char scopeRhs[] = {0,
1316
        public final static char scopeRhs[] = {0,
1209
            180,1,105,88,0,12,0,180,1,105,
1317
            180,1,105,88,0,4,0,180,1,105,
1210
            87,0,148,93,148,92,148,71,0,45,
1318
            87,0,148,93,148,92,148,71,0,94,
1211
            0,148,92,148,71,0,44,119,45,0,
1319
            0,148,92,148,71,0,93,148,94,0,
1212
            148,71,0,43,119,44,119,45,0,178,
1320
            148,71,0,92,148,93,148,94,0,178,
1213
            67,0,52,119,0,154,81,105,0,16,
1321
            67,0,96,148,0,154,81,105,0,75,
1214
            0,0,159,1,153,111,0,159,1,153,
1322
            153,0,159,1,153,111,0,159,1,153,
1215
            113,0,159,1,153,170,0,198,1,59,
1323
            113,0,159,1,153,170,0,198,1,59,
1216
            0,155,1,107,0,155,24,2,0,7,
1324
            0,155,1,107,0,155,24,2,0,3,
1217
            119,0,148,72,152,84,152,1,185,0,
1325
            148,0,148,72,152,84,152,1,185,0,
1218
            152,84,152,1,185,0,18,119,12,0,
1326
            152,84,152,1,185,0,72,148,4,0,
1219
            152,1,185,0,22,118,18,119,12,0,
1327
            152,1,185,0,84,152,72,148,4,0,
1220
            148,72,152,1,185,0,148,72,152,36,
1328
            148,72,152,1,185,0,148,72,152,36,
1221
            152,1,186,0,152,36,152,1,186,0,
1329
            152,1,186,0,152,36,152,1,186,0,
1222
            152,1,186,0,19,118,18,119,12,0,
1330
            152,1,186,0,36,152,72,148,4,0,
1223
            148,72,152,1,186,0,148,1,186,0,
1331
            148,72,152,1,186,0,148,1,186,0,
1224
            194,68,59,0,14,0,192,68,107,0,
1332
            194,68,59,0,80,0,192,68,107,0,
1225
            154,81,117,0,148,1,0,159,1,105,
1333
            154,81,117,0,148,1,0,159,1,105,
1226
            69,106,0,159,1,60,0,136,0,4,
1334
            69,106,0,159,1,60,0,136,0,19,
1227
            133,0,3,133,0,140,0,2,131,0,
1335
            134,0,18,134,0,140,0,35,137,0,
1228
            1,131,0,142,0,9,128,0,8,128,
1336
            34,137,0,142,0,23,139,0,22,139,
1229
            0,6,128,0,5,128,0,144,0,10,
1337
            0,21,139,0,20,139,0,144,0,5,
1230
            126,0,7,126,0,146,0,48,124,0,
1338
            143,0,3,143,0,146,0,28,145,0,
1231
            47,124,0,46,124,0
1339
            27,145,0,26,145,0
1232
        };
1340
        };
1233
    };
1341
    };
1234
    public final static char scopeRhs[] = ScopeRhs.scopeRhs;
1342
    public final static char scopeRhs[] = ScopeRhs.scopeRhs;
Lines 1450-1502 Link Here
1450
    public final static String name[] = Name.name;
1558
    public final static String name[] = Name.name;
1451
    public final String name(int index) { return name[index]; }
1559
    public final String name(int index) { return name[index]; }
1452
1560
1453
    public final static int
1454
           ERROR_SYMBOL      = 102,
1455
           SCOPE_UBOUND      = 43,
1456
           SCOPE_SIZE        = 44,
1457
           MAX_NAME_LENGTH   = 26;
1458
1459
    public final int getErrorSymbol() { return ERROR_SYMBOL; }
1460
    public final int getScopeUbound() { return SCOPE_UBOUND; }
1461
    public final int getScopeSize() { return SCOPE_SIZE; }
1462
    public final int getMaxNameLength() { return MAX_NAME_LENGTH; }
1463
1464
    public final static int
1465
           NUM_STATES        = 213,
1466
           NT_OFFSET         = 102,
1467
           LA_STATE_OFFSET   = 3457,
1468
           MAX_LA            = 2,
1469
           NUM_RULES         = 275,
1470
           NUM_NONTERMINALS  = 106,
1471
           NUM_SYMBOLS       = 208,
1472
           SEGMENT_SIZE      = 8192,
1473
           START_STATE       = 2971,
1474
           IDENTIFIER_SYMBOL = 2,
1475
           EOFT_SYMBOL       = 97,
1476
           EOLT_SYMBOL       = 97,
1477
           ACCEPT_ACTION     = 3181,
1478
           ERROR_ACTION      = 3182;
1479
1480
    public final static boolean BACKTRACK = false;
1481
1482
    public final int getNumStates() { return NUM_STATES; }
1483
    public final int getNtOffset() { return NT_OFFSET; }
1484
    public final int getLaStateOffset() { return LA_STATE_OFFSET; }
1485
    public final int getMaxLa() { return MAX_LA; }
1486
    public final int getNumRules() { return NUM_RULES; }
1487
    public final int getNumNonterminals() { return NUM_NONTERMINALS; }
1488
    public final int getNumSymbols() { return NUM_SYMBOLS; }
1489
    public final int getSegmentSize() { return SEGMENT_SIZE; }
1490
    public final int getStartState() { return START_STATE; }
1491
    public final int getStartSymbol() { return lhs[0]; }
1492
    public final int getIdentifierSymbol() { return IDENTIFIER_SYMBOL; }
1493
    public final int getEoftSymbol() { return EOFT_SYMBOL; }
1494
    public final int getEoltSymbol() { return EOLT_SYMBOL; }
1495
    public final int getAcceptAction() { return ACCEPT_ACTION; }
1496
    public final int getErrorAction() { return ERROR_ACTION; }
1497
    public final boolean isValidForParser() { return isValidForParser; }
1498
    public final boolean getBacktrack() { return BACKTRACK; }
1499
1500
    public final int originalState(int state) {
1561
    public final int originalState(int state) {
1501
        return -baseCheck[state];
1562
        return -baseCheck[state];
1502
    }
1563
    }
Lines 1510-1519 Link Here
1510
        return inSymb[originalState(state)];
1571
        return inSymb[originalState(state)];
1511
    }
1572
    }
1512
1573
1574
    /**
1575
     * assert(! goto_default);
1576
     */
1513
    public final int ntAction(int state, int sym) {
1577
    public final int ntAction(int state, int sym) {
1514
        return baseAction[state + sym];
1578
        return baseAction[state + sym];
1515
    }
1579
    }
1516
1580
1581
    /**
1582
     * assert(! shift_default);
1583
     */
1517
    public final int tAction(int state, int sym) {
1584
    public final int tAction(int state, int sym) {
1518
        int i = baseAction[state],
1585
        int i = baseAction[state],
1519
            k = i + sym;
1586
            k = i + sym;
(-)src/org/eclipse/ocl/parser/OCLKWLexersym.java (-17 / +24 lines)
Lines 1-7 Link Here
1
/**
1
/**
2
* <copyright>
2
* <copyright>
3
*
3
*
4
* Copyright (c) 2005, 2007 IBM Corporation and others.
4
* Copyright (c) 2005, 2009 IBM Corporation 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-19 Link Here
10
* Contributors:
10
* Contributors:
11
*   IBM - Initial API and implementation
11
*   IBM - Initial API and implementation
12
*   E.D.Willink - Lexer and Parser refactoring to support extensibility and flexible error handling
12
*   E.D.Willink - Lexer and Parser refactoring to support extensibility and flexible error handling
13
*   E.D.Willink - Bug 285633 static definitions
14
*   Adolfo Sanchez-Barbudo Herrera (Open Canarias) - LPG v 2.0.17 adoption (242153)
13
*
15
*
14
* </copyright>
16
* </copyright>
15
*
17
*
16
* $Id: OCLKWLexersym.java,v 1.6 2009/09/04 13:40:43 ewillink Exp $
18
* 
17
*/
19
*/
18
20
19
package org.eclipse.ocl.parser;
21
package org.eclipse.ocl.parser;
Lines 26-31 Link Here
26
public interface OCLKWLexersym {
28
public interface OCLKWLexersym {
27
    public final static int
29
    public final static int
28
      Char_DollarSign = 40,
30
      Char_DollarSign = 40,
31
      Char_Percent = 41,
32
      Char__ = 42,
29
      Char_a = 5,
33
      Char_a = 5,
30
      Char_b = 30,
34
      Char_b = 30,
31
      Char_c = 11,
35
      Char_c = 11,
Lines 51-86 Link Here
51
      Char_w = 33,
55
      Char_w = 33,
52
      Char_x = 19,
56
      Char_x = 19,
53
      Char_y = 16,
57
      Char_y = 16,
54
      Char_z = 41,
58
      Char_z = 43,
55
      Char_A = 20,
59
      Char_A = 20,
56
      Char_B = 29,
60
      Char_B = 29,
57
      Char_C = 34,
61
      Char_C = 34,
58
      Char_D = 42,
62
      Char_D = 44,
59
      Char_E = 43,
63
      Char_E = 45,
60
      Char_F = 44,
64
      Char_F = 46,
61
      Char_G = 45,
65
      Char_G = 47,
62
      Char_H = 46,
66
      Char_H = 48,
63
      Char_I = 17,
67
      Char_I = 17,
64
      Char_J = 47,
68
      Char_J = 49,
65
      Char_K = 35,
69
      Char_K = 35,
66
      Char_L = 48,
70
      Char_L = 50,
67
      Char_M = 36,
71
      Char_M = 36,
68
      Char_N = 21,
72
      Char_N = 21,
69
      Char_O = 22,
73
      Char_O = 22,
70
      Char_P = 49,
74
      Char_P = 51,
71
      Char_Q = 50,
75
      Char_Q = 52,
72
      Char_R = 37,
76
      Char_R = 37,
73
      Char_S = 23,
77
      Char_S = 23,
74
      Char_T = 24,
78
      Char_T = 24,
75
      Char_U = 25,
79
      Char_U = 25,
76
      Char_V = 38,
80
      Char_V = 38,
77
      Char_W = 51,
81
      Char_W = 53,
78
      Char_X = 52,
82
      Char_X = 54,
79
      Char_Y = 53,
83
      Char_Y = 55,
80
      Char_Z = 54,
84
      Char_Z = 56,
81
      Char_EOF = 39;
85
      Char_EOF = 39;
82
86
83
      public final static String orderedTerminalSymbols[] = {
87
    public final static String orderedTerminalSymbols[] = {
84
                 "",
88
                 "",
85
                 "e",
89
                 "e",
86
                 "t",
90
                 "t",
Lines 122-127 Link Here
122
                 "V",
126
                 "V",
123
                 "EOF",
127
                 "EOF",
124
                 "DollarSign",
128
                 "DollarSign",
129
                 "Percent",
130
                 "_",
125
                 "z",
131
                 "z",
126
                 "D",
132
                 "D",
127
                 "E",
133
                 "E",
Lines 138-142 Link Here
138
                 "Z"
144
                 "Z"
139
             };
145
             };
140
146
147
    public final static int numTokenKinds = orderedTerminalSymbols.length;
141
    public final static boolean isValidForParser = true;
148
    public final static boolean isValidForParser = true;
142
}
149
}
(-)src/org/eclipse/ocl/parser/OCLParsersym.java (-2 / +5 lines)
Lines 12-22 Link Here
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
14
*   E.D.Willink - Bugs 225493, 243976, 259818, 282882, 287993
14
*   E.D.Willink - Bugs 225493, 243976, 259818, 282882, 287993
15
*   Zeligsoft - Bug 243976
15
*   Borland - Bug 242880
16
*   Borland - Bug 242880
17
*   Adolfo Sanchez-Barbudo Herrera (Open Canarias) - LPG v 2.0.17 adoption (242153)
16
*
18
*
17
* </copyright>
19
* </copyright>
18
*
20
*
19
* $Id: OCLParsersym.java,v 1.10 2009/09/04 13:40:43 ewillink Exp $
21
* $Id: EssentialOCL.g,v 1.7 2009/03/05 14:12:14 cdamus Exp $
20
*/
22
*/
21
23
22
package org.eclipse.ocl.parser;
24
package org.eclipse.ocl.parser;
Lines 136-142 Link Here
136
      TK_MULTI_LINE_COMMENT = 101,
138
      TK_MULTI_LINE_COMMENT = 101,
137
      TK_ERROR_TOKEN = 102;
139
      TK_ERROR_TOKEN = 102;
138
140
139
      public final static String orderedTerminalSymbols[] = {
141
    public final static String orderedTerminalSymbols[] = {
140
                 "",
142
                 "",
141
                 "LPAREN",
143
                 "LPAREN",
142
                 "IDENTIFIER",
144
                 "IDENTIFIER",
Lines 242-246 Link Here
242
                 "ERROR_TOKEN"
244
                 "ERROR_TOKEN"
243
             };
245
             };
244
246
247
    public final static int numTokenKinds = orderedTerminalSymbols.length;
245
    public final static boolean isValidForParser = true;
248
    public final static boolean isValidForParser = true;
246
}
249
}
(-)src/org/eclipse/ocl/parser/OCLLexerprs.java (-44 / +105 lines)
Lines 1-7 Link Here
1
/**
1
/**
2
* <copyright>
2
* <copyright>
3
*
3
*
4
* Copyright (c) 2005, 2009 IBM Corporation, Borland Software Corp.,  and others.
4
* Copyright (c) 2005, 2009 IBM Corporation, Borland Software Corp. 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-25 Link Here
10
* Contributors:
10
* Contributors:
11
*   IBM - Initial API and implementation
11
*   IBM - Initial API and implementation
12
*   E.D.Willink - Lexer and Parser refactoring to support extensibility and flexible error handling
12
*   E.D.Willink - Lexer and Parser refactoring to support extensibility and flexible error handling
13
*               - Bug 259818
13
*   Borland - Bug 242880
14
*   Borland - Bug 242880
15
*   Adolfo Sanchez-Barbudo Herrera (Open Canarias) - LPG v 2.0.17 adoption (242153)
14
*
16
*
15
* </copyright>
17
* </copyright>
16
*
18
*
17
* $Id: OCLLexerprs.java,v 1.7 2009/09/04 13:40:43 ewillink Exp $
19
* $Id: OCLLexer.g,v 1.3 2009/08/28 20:43:11 ewillink Exp $
18
*/
20
*/
19
21
20
package org.eclipse.ocl.parser;
22
package org.eclipse.ocl.parser;
21
23
22
public class OCLLexerprs implements lpg.lpgjavaruntime.ParseTable, OCLLexersym {
24
public class OCLLexerprs implements lpg.runtime.ParseTable, OCLLexersym {
25
    public final static int ERROR_SYMBOL = 0;
26
    public final int getErrorSymbol() { return ERROR_SYMBOL; }
27
28
    public final static int SCOPE_UBOUND = 0;
29
    public final int getScopeUbound() { return SCOPE_UBOUND; }
30
31
    public final static int SCOPE_SIZE = 0;
32
    public final int getScopeSize() { return SCOPE_SIZE; }
33
34
    public final static int MAX_NAME_LENGTH = 0;
35
    public final int getMaxNameLength() { return MAX_NAME_LENGTH; }
36
37
    public final static int NUM_STATES = 50;
38
    public final int getNumStates() { return NUM_STATES; }
39
40
    public final static int NT_OFFSET = 103;
41
    public final int getNtOffset() { return NT_OFFSET; }
42
43
    public final static int LA_STATE_OFFSET = 824;
44
    public final int getLaStateOffset() { return LA_STATE_OFFSET; }
45
46
    public final static int MAX_LA = 1;
47
    public final int getMaxLa() { return MAX_LA; }
48
49
    public final static int NUM_RULES = 309;
50
    public final int getNumRules() { return NUM_RULES; }
51
52
    public final static int NUM_NONTERMINALS = 44;
53
    public final int getNumNonterminals() { return NUM_NONTERMINALS; }
54
55
    public final static int NUM_SYMBOLS = 147;
56
    public final int getNumSymbols() { return NUM_SYMBOLS; }
57
58
    public final static int SEGMENT_SIZE = 8192;
59
    public final int getSegmentSize() { return SEGMENT_SIZE; }
60
61
    public final static int START_STATE = 310;
62
    public final int getStartState() { return START_STATE; }
63
64
    public final static int IDENTIFIER_SYMBOL = 0;
65
    public final int getIdentifier_SYMBOL() { return IDENTIFIER_SYMBOL; }
66
67
    public final static int EOFT_SYMBOL = 99;
68
    public final int getEoftSymbol() { return EOFT_SYMBOL; }
69
70
    public final static int EOLT_SYMBOL = 104;
71
    public final int getEoltSymbol() { return EOLT_SYMBOL; }
72
73
    public final static int ACCEPT_ACTION = 514;
74
    public final int getAcceptAction() { return ACCEPT_ACTION; }
75
76
    public final static int ERROR_ACTION = 515;
77
    public final int getErrorAction() { return ERROR_ACTION; }
78
79
    public final static boolean BACKTRACK = false;
80
    public final boolean getBacktrack() { return BACKTRACK; }
81
82
    public final int getStartSymbol() { return lhs(0); }
83
    public final boolean isValidForParser() { return OCLLexersym.isValidForParser; }
84
85
86
    public interface IsNullable {
87
        public final static byte isNullable[] = {0,
88
            0,0,0,0,0,0,0,0,0,0,
89
            0,0,0,0,0,0,0,0,0,0,
90
            0,0,0,0,0,0,0,0,0,0,
91
            0,0,0,0,0,0,0,0,0,0,
92
            0,0,0,0,0,0,0,0,0,0,
93
            0,0,0,0,0,0,0,0,0,0,
94
            0,0,0,0,0,0,0,0,0,0,
95
            0,0,0,0,0,0,0,0,0,0,
96
            0,0,0,0,0,0,0,0,0,0,
97
            0,0,0,0,0,0,0,0,0,0,
98
            0,0,0,0,0,0,0,0,0,0,
99
            0,0,0,0,0,0,1,0,0,0,
100
            0,0,0,0,0,0,0,0,0,0,
101
            0,1,0,0,0,0,0,0,0,0,
102
            0,0,0,0,0,0,0
103
        };
104
    };
105
    public final static byte isNullable[] = IsNullable.isNullable;
106
    public final boolean isNullable(int index) { return isNullable[index] != 0; }
107
108
    public interface ProsthesesIndex {
109
        public final static byte prosthesesIndex[] = {0,
110
            20,25,26,27,35,4,15,37,40,43,
111
            24,5,3,6,17,18,23,32,34,36,
112
            41,42,2,7,8,9,10,11,12,13,
113
            14,16,19,33,38,39,44,1,21,22,
114
            28,29,30,31
115
        };
116
    };
117
    public final static byte prosthesesIndex[] = ProsthesesIndex.prosthesesIndex;
118
    public final int prosthesesIndex(int index) { return prosthesesIndex[index]; }
23
119
24
    public interface IsKeyword {
120
    public interface IsKeyword {
25
        public final static byte isKeyword[] = {0,
121
        public final static byte isKeyword[] = {0,
Lines 476-531 Link Here
476
    public final int scopeState(int index) { return 0;}
572
    public final int scopeState(int index) { return 0;}
477
    public final int inSymb(int index) { return 0;}
573
    public final int inSymb(int index) { return 0;}
478
    public final String name(int index) { return null; }
574
    public final String name(int index) { return null; }
479
    public final int getErrorSymbol() { return 0; }
480
    public final int getScopeUbound() { return 0; }
481
    public final int getScopeSize() { return 0; }
482
    public final int getMaxNameLength() { return 0; }
483
484
    public final static int
485
           NUM_STATES        = 50,
486
           NT_OFFSET         = 103,
487
           LA_STATE_OFFSET   = 824,
488
           MAX_LA            = 1,
489
           NUM_RULES         = 309,
490
           NUM_NONTERMINALS  = 44,
491
           NUM_SYMBOLS       = 147,
492
           SEGMENT_SIZE      = 8192,
493
           START_STATE       = 310,
494
           IDENTIFIER_SYMBOL = 0,
495
           EOFT_SYMBOL       = 99,
496
           EOLT_SYMBOL       = 104,
497
           ACCEPT_ACTION     = 514,
498
           ERROR_ACTION      = 515;
499
500
    public final static boolean BACKTRACK = false;
501
502
    public final int getNumStates() { return NUM_STATES; }
503
    public final int getNtOffset() { return NT_OFFSET; }
504
    public final int getLaStateOffset() { return LA_STATE_OFFSET; }
505
    public final int getMaxLa() { return MAX_LA; }
506
    public final int getNumRules() { return NUM_RULES; }
507
    public final int getNumNonterminals() { return NUM_NONTERMINALS; }
508
    public final int getNumSymbols() { return NUM_SYMBOLS; }
509
    public final int getSegmentSize() { return SEGMENT_SIZE; }
510
    public final int getStartState() { return START_STATE; }
511
    public final int getStartSymbol() { return lhs[0]; }
512
    public final int getIdentifierSymbol() { return IDENTIFIER_SYMBOL; }
513
    public final int getEoftSymbol() { return EOFT_SYMBOL; }
514
    public final int getEoltSymbol() { return EOLT_SYMBOL; }
515
    public final int getAcceptAction() { return ACCEPT_ACTION; }
516
    public final int getErrorAction() { return ERROR_ACTION; }
517
    public final boolean isValidForParser() { return isValidForParser; }
518
    public final boolean getBacktrack() { return BACKTRACK; }
519
520
    public final int originalState(int state) { return 0; }
575
    public final int originalState(int state) { return 0; }
521
    public final int asi(int state) { return 0; }
576
    public final int asi(int state) { return 0; }
522
    public final int nasi(int state) { return 0; }
577
    public final int nasi(int state) { return 0; }
523
    public final int inSymbol(int state) { return 0; }
578
    public final int inSymbol(int state) { return 0; }
524
579
580
    /**
581
     * assert(! goto_default);
582
     */
525
    public final int ntAction(int state, int sym) {
583
    public final int ntAction(int state, int sym) {
526
        return baseAction[state + sym];
584
        return baseAction[state + sym];
527
    }
585
    }
528
586
587
    /**
588
     * assert(! shift_default);
589
     */
529
    public final int tAction(int state, int sym) {
590
    public final int tAction(int state, int sym) {
530
        int i = baseAction[state],
591
        int i = baseAction[state],
531
            k = i + sym;
592
            k = i + sym;
(-)src/org/eclipse/ocl/parser/OCLLexersym.java (-3 / +6 lines)
Lines 1-7 Link Here
1
/**
1
/**
2
* <copyright>
2
* <copyright>
3
*
3
*
4
* Copyright (c) 2005, 2009 IBM Corporation, Borland Software Corp.,  and others.
4
* Copyright (c) 2005, 2009 IBM Corporation, Borland Software Corp. 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-20 Link Here
10
* Contributors:
10
* Contributors:
11
*   IBM - Initial API and implementation
11
*   IBM - Initial API and implementation
12
*   E.D.Willink - Lexer and Parser refactoring to support extensibility and flexible error handling
12
*   E.D.Willink - Lexer and Parser refactoring to support extensibility and flexible error handling
13
*               - Bug 259818
13
*   Borland - Bug 242880
14
*   Borland - Bug 242880
15
*   Adolfo Sanchez-Barbudo Herrera (Open Canarias) - LPG v 2.0.17 adoption (242153)
14
*
16
*
15
* </copyright>
17
* </copyright>
16
*
18
*
17
* $Id: OCLLexersym.java,v 1.6 2009/09/04 13:40:43 ewillink Exp $
19
* $Id: OCLLexer.g,v 1.3 2009/08/28 20:43:11 ewillink Exp $
18
*/
20
*/
19
21
20
package org.eclipse.ocl.parser;
22
package org.eclipse.ocl.parser;
Lines 130-136 Link Here
130
      Char_Equal = 15,
132
      Char_Equal = 15,
131
      Char_EOF = 99;
133
      Char_EOF = 99;
132
134
133
      public final static String orderedTerminalSymbols[] = {
135
    public final static String orderedTerminalSymbols[] = {
134
                 "",
136
                 "",
135
                 "0",
137
                 "0",
136
                 "1",
138
                 "1",
Lines 237-241 Link Here
237
                 "CtlCharNotWS"
239
                 "CtlCharNotWS"
238
             };
240
             };
239
241
242
    public final static int numTokenKinds = orderedTerminalSymbols.length;
240
    public final static boolean isValidForParser = true;
243
    public final static boolean isValidForParser = true;
241
}
244
}
(-)src/org/eclipse/ocl/parser/OCLLexer.java (-47 / +49 lines)
Lines 1-7 Link Here
1
/**
1
/**
2
* <copyright>
2
* <copyright>
3
*
3
*
4
* Copyright (c) 2005, 2009 IBM Corporation, Borland Software Corp.,  and others.
4
* Copyright (c) 2005, 2009 IBM Corporation, Borland Software Corp. 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-25 Link Here
10
* Contributors:
10
* Contributors:
11
*   IBM - Initial API and implementation
11
*   IBM - Initial API and implementation
12
*   E.D.Willink - Lexer and Parser refactoring to support extensibility and flexible error handling
12
*   E.D.Willink - Lexer and Parser refactoring to support extensibility and flexible error handling
13
*               - Bug 259818
13
*   Borland - Bug 242880
14
*   Borland - Bug 242880
15
*   Adolfo Sanchez-Barbudo Herrera (Open Canarias) - LPG v 2.0.17 adoption (242153)
14
*
16
*
15
* </copyright>
17
* </copyright>
16
*
18
*
17
* $Id: OCLLexer.java,v 1.8 2009/09/04 13:40:43 ewillink Exp $
19
* $Id: OCLLexer.g,v 1.3 2009/08/28 20:43:11 ewillink Exp $
18
*/
20
*/
19
21
20
package org.eclipse.ocl.parser;
22
package org.eclipse.ocl.parser;
21
23
22
import lpg.lpgjavaruntime.*;
24
import lpg.runtime.*;
23
import org.eclipse.ocl.lpg.AbstractLexer;
25
import org.eclipse.ocl.lpg.AbstractLexer;
24
import org.eclipse.ocl.lpg.AbstractParser;
26
import org.eclipse.ocl.lpg.AbstractParser;
25
import org.eclipse.ocl.Environment;
27
import org.eclipse.ocl.Environment;
Lines 52-58 Link Here
52
    
54
    
53
	public OCLLexer(Environment<?,?,?,?,?,?,?,?,?,?,?,?> environment, char[] chars) {
55
	public OCLLexer(Environment<?,?,?,?,?,?,?,?,?,?,?,?> environment, char[] chars) {
54
		this(environment, chars, "OCL", ECLIPSE_TAB_VALUE);
56
		this(environment, chars, "OCL", ECLIPSE_TAB_VALUE);
55
		kwLexer = new OCLKWLexer(getInputChars(), TK_IDENTIFIER);
57
		kwLexer = new OCLKWLexer(getInputChars(), OCLParsersym.TK_IDENTIFIER);
56
	}
58
	}
57
59
58
    public OCLLexer(Environment<?,?,?,?,?,?,?,?,?,?,?,?> environment, char[] input_chars, String filename, int tab)  {
60
    public OCLLexer(Environment<?,?,?,?,?,?,?,?,?,?,?,?> environment, char[] input_chars, String filename, int tab)  {
Lines 81-87 Link Here
81
    {
83
    {
82
        super.initialize(content, filename);
84
        super.initialize(content, filename);
83
        if (kwLexer == null)
85
        if (kwLexer == null)
84
             kwLexer = new OCLKWLexer(getInputChars(), TK_IDENTIFIER);
86
             kwLexer = new OCLKWLexer(getInputChars(), OCLParsersym.TK_IDENTIFIER);
85
        else
87
        else
86
             kwLexer.setInputChars(getInputChars());
88
             kwLexer.setInputChars(getInputChars());
87
    }
89
    }
Lines 92-98 Link Here
92
    @Override
94
    @Override
93
    public void setInputChars(char[] inputChars) {
95
    public void setInputChars(char[] inputChars) {
94
		super.setInputChars(inputChars);
96
		super.setInputChars(inputChars);
95
		kwLexer = new OCLKWLexer(getInputChars(), TK_IDENTIFIER);
97
		kwLexer = new OCLKWLexer(getInputChars(), OCLParsersym.TK_IDENTIFIER);
96
	}
98
	}
97
    
99
    
98
    @Override
100
    @Override
Lines 108-119 Link Here
108
        lexParser.parseCharacters(monitor);  // Lex the input characters
110
        lexParser.parseCharacters(monitor);  // Lex the input characters
109
            
111
            
110
        int i = getStreamIndex();
112
        int i = getStreamIndex();
111
        parser.makeToken(i, i, TK_EOF_TOKEN); // and end with the end of file token
113
        parser.makeToken(i, i, OCLParsersym.TK_EOF_TOKEN); // and end with the end of file token
112
        parser.setStreamLength(parser.getSize());
114
        parser.setStreamLength(parser.getSize());
113
            
115
            
114
        return;
116
        return;
115
    }
117
    }
116
    
118
        
117
    final void makeToken(int kind)
119
    final void makeToken(int kind)
118
    {
120
    {
119
        int startOffset = getLeftSpan(),
121
        int startOffset = getLeftSpan(),
Lines 126-132 Link Here
126
    {
128
    {
127
        int startOffset = getLeftSpan(),
129
        int startOffset = getLeftSpan(),
128
            endOffset = getRightSpan();
130
            endOffset = getRightSpan();
129
        super.getPrsStream().makeAdjunct(startOffset, endOffset, kind);
131
        super.getIPrsStream().makeAdjunct(startOffset, endOffset, kind);
130
    }
132
    }
131
133
132
    final void skipToken()
134
    final void skipToken()
Lines 317-323 Link Here
317
            // Rule 2:  Token ::= EscapedSQ
319
            // Rule 2:  Token ::= EscapedSQ
318
            //
320
            //
319
            case 2: { 
321
            case 2: { 
320
				makeToken(TK_STRING_LITERAL);
322
				makeToken(OCLParsersym.TK_STRING_LITERAL);
321
	            break;
323
	            break;
322
            }
324
            }
323
	 
325
	 
Lines 325-331 Link Here
325
            // Rule 3:  Token ::= SingleQuote SLNotSQ SingleQuote
327
            // Rule 3:  Token ::= SingleQuote SLNotSQ SingleQuote
326
            //
328
            //
327
            case 3: { 
329
            case 3: { 
328
				makeToken(TK_STRING_LITERAL);
330
				makeToken(OCLParsersym.TK_STRING_LITERAL);
329
	            break;
331
	            break;
330
            }
332
            }
331
	 
333
	 
Lines 333-339 Link Here
333
            // Rule 4:  Token ::= Acute SLNotSQOpt Acute
335
            // Rule 4:  Token ::= Acute SLNotSQOpt Acute
334
            //
336
            //
335
            case 4: { 
337
            case 4: { 
336
				makeToken(TK_STRING_LITERAL);
338
				makeToken(OCLParsersym.TK_STRING_LITERAL);
337
	            break;
339
	            break;
338
            }
340
            }
339
	 
341
	 
Lines 341-347 Link Here
341
            // Rule 5:  Token ::= BackQuote SLNotSQOpt Acute
343
            // Rule 5:  Token ::= BackQuote SLNotSQOpt Acute
342
            //
344
            //
343
            case 5: { 
345
            case 5: { 
344
				makeToken(TK_STRING_LITERAL);
346
				makeToken(OCLParsersym.TK_STRING_LITERAL);
345
	            break;
347
	            break;
346
            }
348
            }
347
	 
349
	 
Lines 349-355 Link Here
349
            // Rule 6:  Token ::= IntegerLiteral
351
            // Rule 6:  Token ::= IntegerLiteral
350
            //
352
            //
351
            case 6: { 
353
            case 6: { 
352
				makeToken(TK_INTEGER_LITERAL);
354
				makeToken(OCLParsersym.TK_INTEGER_LITERAL);
353
	            break;
355
	            break;
354
            }
356
            }
355
	 
357
	 
Lines 357-363 Link Here
357
            // Rule 7:  Token ::= RealLiteral
359
            // Rule 7:  Token ::= RealLiteral
358
            //
360
            //
359
            case 7: { 
361
            case 7: { 
360
				makeToken(TK_REAL_LITERAL);
362
				makeToken(OCLParsersym.TK_REAL_LITERAL);
361
	            break;
363
	            break;
362
            }
364
            }
363
	 
365
	 
Lines 365-371 Link Here
365
            // Rule 8:  Token ::= NumericOperation
367
            // Rule 8:  Token ::= NumericOperation
366
            //
368
            //
367
            case 8: { 
369
            case 8: { 
368
				makeToken(TK_NUMERIC_OPERATION);
370
				makeToken(OCLParsersym.TK_NUMERIC_OPERATION);
369
	            break;
371
	            break;
370
            }
372
            }
371
	 
373
	 
Lines 373-379 Link Here
373
            // Rule 9:  Token ::= IntegerRangeStart
375
            // Rule 9:  Token ::= IntegerRangeStart
374
            //
376
            //
375
            case 9: { 
377
            case 9: { 
376
				makeToken(TK_INTEGER_RANGE_START);
378
				makeToken(OCLParsersym.TK_INTEGER_RANGE_START);
377
	            break;
379
	            break;
378
            }
380
            }
379
	 
381
	 
Lines 381-387 Link Here
381
            // Rule 10:  Token ::= SLC
383
            // Rule 10:  Token ::= SLC
382
            //
384
            //
383
            case 10: { 
385
            case 10: { 
384
				makeComment(TK_SINGLE_LINE_COMMENT);
386
				makeComment(OCLParsersym.TK_SINGLE_LINE_COMMENT);
385
	            break;
387
	            break;
386
            }
388
            }
387
	 
389
	 
Lines 389-395 Link Here
389
            // Rule 11:  Token ::= / * Inside Stars /
391
            // Rule 11:  Token ::= / * Inside Stars /
390
            //
392
            //
391
            case 11: { 
393
            case 11: { 
392
                makeComment(TK_MULTI_LINE_COMMENT);
394
                makeComment(OCLParsersym.TK_MULTI_LINE_COMMENT);
393
                break;
395
                break;
394
            }
396
            }
395
     
397
     
Lines 405-411 Link Here
405
            // Rule 13:  Token ::= +
407
            // Rule 13:  Token ::= +
406
            //
408
            //
407
            case 13: { 
409
            case 13: { 
408
				makeToken(TK_PLUS);
410
				makeToken(OCLParsersym.TK_PLUS);
409
	            break;
411
	            break;
410
            }
412
            }
411
	 
413
	 
Lines 413-419 Link Here
413
            // Rule 14:  Token ::= -
415
            // Rule 14:  Token ::= -
414
            //
416
            //
415
            case 14: { 
417
            case 14: { 
416
				makeToken(TK_MINUS);
418
				makeToken(OCLParsersym.TK_MINUS);
417
	            break;
419
	            break;
418
            }
420
            }
419
	 
421
	 
Lines 421-427 Link Here
421
            // Rule 15:  Token ::= *
423
            // Rule 15:  Token ::= *
422
            //
424
            //
423
            case 15: { 
425
            case 15: { 
424
				makeToken(TK_MULTIPLY);
426
				makeToken(OCLParsersym.TK_MULTIPLY);
425
	            break;
427
	            break;
426
            }
428
            }
427
	 
429
	 
Lines 429-435 Link Here
429
            // Rule 16:  Token ::= /
431
            // Rule 16:  Token ::= /
430
            //
432
            //
431
            case 16: { 
433
            case 16: { 
432
				makeToken(TK_DIVIDE);
434
				makeToken(OCLParsersym.TK_DIVIDE);
433
	            break;
435
	            break;
434
            }
436
            }
435
	 
437
	 
Lines 437-443 Link Here
437
            // Rule 17:  Token ::= (
439
            // Rule 17:  Token ::= (
438
            //
440
            //
439
            case 17: { 
441
            case 17: { 
440
				makeToken(TK_LPAREN);
442
				makeToken(OCLParsersym.TK_LPAREN);
441
	            break;
443
	            break;
442
            }
444
            }
443
	 
445
	 
Lines 445-451 Link Here
445
            // Rule 18:  Token ::= )
447
            // Rule 18:  Token ::= )
446
            //
448
            //
447
            case 18: { 
449
            case 18: { 
448
				makeToken(TK_RPAREN);
450
				makeToken(OCLParsersym.TK_RPAREN);
449
	            break;
451
	            break;
450
            }
452
            }
451
	 
453
	 
Lines 453-459 Link Here
453
            // Rule 19:  Token ::= >
455
            // Rule 19:  Token ::= >
454
            //
456
            //
455
            case 19: { 
457
            case 19: { 
456
				makeToken(TK_GREATER);
458
				makeToken(OCLParsersym.TK_GREATER);
457
	            break;
459
	            break;
458
            }
460
            }
459
	 
461
	 
Lines 461-467 Link Here
461
            // Rule 20:  Token ::= <
463
            // Rule 20:  Token ::= <
462
            //
464
            //
463
            case 20: { 
465
            case 20: { 
464
				makeToken(TK_LESS);
466
				makeToken(OCLParsersym.TK_LESS);
465
	            break;
467
	            break;
466
            }
468
            }
467
	 
469
	 
Lines 469-475 Link Here
469
            // Rule 21:  Token ::= =
471
            // Rule 21:  Token ::= =
470
            //
472
            //
471
            case 21: { 
473
            case 21: { 
472
				makeToken(TK_EQUAL);
474
				makeToken(OCLParsersym.TK_EQUAL);
473
	            break;
475
	            break;
474
            }
476
            }
475
	 
477
	 
Lines 477-483 Link Here
477
            // Rule 22:  Token ::= > =
479
            // Rule 22:  Token ::= > =
478
            //
480
            //
479
            case 22: { 
481
            case 22: { 
480
				makeToken(TK_GREATER_EQUAL);
482
				makeToken(OCLParsersym.TK_GREATER_EQUAL);
481
	            break;
483
	            break;
482
            }
484
            }
483
	 
485
	 
Lines 485-491 Link Here
485
            // Rule 23:  Token ::= < =
487
            // Rule 23:  Token ::= < =
486
            //
488
            //
487
            case 23: { 
489
            case 23: { 
488
				makeToken(TK_LESS_EQUAL);
490
				makeToken(OCLParsersym.TK_LESS_EQUAL);
489
	            break;
491
	            break;
490
            }
492
            }
491
	 
493
	 
Lines 493-499 Link Here
493
            // Rule 24:  Token ::= < >
495
            // Rule 24:  Token ::= < >
494
            //
496
            //
495
            case 24: { 
497
            case 24: { 
496
				makeToken(TK_NOT_EQUAL);
498
				makeToken(OCLParsersym.TK_NOT_EQUAL);
497
	            break;
499
	            break;
498
            }
500
            }
499
	 
501
	 
Lines 501-507 Link Here
501
            // Rule 25:  Token ::= [
503
            // Rule 25:  Token ::= [
502
            //
504
            //
503
            case 25: { 
505
            case 25: { 
504
				makeToken(TK_LBRACKET);
506
				makeToken(OCLParsersym.TK_LBRACKET);
505
	            break;
507
	            break;
506
            }
508
            }
507
	 
509
	 
Lines 509-515 Link Here
509
            // Rule 26:  Token ::= ]
511
            // Rule 26:  Token ::= ]
510
            //
512
            //
511
            case 26: { 
513
            case 26: { 
512
				makeToken(TK_RBRACKET);
514
				makeToken(OCLParsersym.TK_RBRACKET);
513
	            break;
515
	            break;
514
            }
516
            }
515
	 
517
	 
Lines 517-523 Link Here
517
            // Rule 27:  Token ::= {
519
            // Rule 27:  Token ::= {
518
            //
520
            //
519
            case 27: { 
521
            case 27: { 
520
				makeToken(TK_LBRACE);
522
				makeToken(OCLParsersym.TK_LBRACE);
521
	            break;
523
	            break;
522
            }
524
            }
523
	 
525
	 
Lines 525-531 Link Here
525
            // Rule 28:  Token ::= }
527
            // Rule 28:  Token ::= }
526
            //
528
            //
527
            case 28: { 
529
            case 28: { 
528
				makeToken(TK_RBRACE);
530
				makeToken(OCLParsersym.TK_RBRACE);
529
	            break;
531
	            break;
530
            }
532
            }
531
	 
533
	 
Lines 533-539 Link Here
533
            // Rule 29:  Token ::= - >
535
            // Rule 29:  Token ::= - >
534
            //
536
            //
535
            case 29: { 
537
            case 29: { 
536
				makeToken(TK_ARROW);
538
				makeToken(OCLParsersym.TK_ARROW);
537
	            break;
539
	            break;
538
            }
540
            }
539
	 
541
	 
Lines 541-547 Link Here
541
            // Rule 30:  Token ::= |
543
            // Rule 30:  Token ::= |
542
            //
544
            //
543
            case 30: { 
545
            case 30: { 
544
				makeToken(TK_BAR);
546
				makeToken(OCLParsersym.TK_BAR);
545
	            break;
547
	            break;
546
            }
548
            }
547
	 
549
	 
Lines 549-555 Link Here
549
            // Rule 31:  Token ::= ,
551
            // Rule 31:  Token ::= ,
550
            //
552
            //
551
            case 31: { 
553
            case 31: { 
552
				makeToken(TK_COMMA);
554
				makeToken(OCLParsersym.TK_COMMA);
553
	            break;
555
	            break;
554
            }
556
            }
555
	 
557
	 
Lines 557-563 Link Here
557
            // Rule 32:  Token ::= :
559
            // Rule 32:  Token ::= :
558
            //
560
            //
559
            case 32: { 
561
            case 32: { 
560
				makeToken(TK_COLON);
562
				makeToken(OCLParsersym.TK_COLON);
561
	            break;
563
	            break;
562
            }
564
            }
563
	 
565
	 
Lines 565-571 Link Here
565
            // Rule 33:  Token ::= : :
567
            // Rule 33:  Token ::= : :
566
            //
568
            //
567
            case 33: { 
569
            case 33: { 
568
				makeToken(TK_COLONCOLON);
570
				makeToken(OCLParsersym.TK_COLONCOLON);
569
	            break;
571
	            break;
570
            }
572
            }
571
	 
573
	 
Lines 573-579 Link Here
573
            // Rule 34:  Token ::= ;
575
            // Rule 34:  Token ::= ;
574
            //
576
            //
575
            case 34: { 
577
            case 34: { 
576
				makeToken(TK_SEMICOLON);
578
				makeToken(OCLParsersym.TK_SEMICOLON);
577
	            break;
579
	            break;
578
            }
580
            }
579
	 
581
	 
Lines 581-587 Link Here
581
            // Rule 35:  Token ::= .
583
            // Rule 35:  Token ::= .
582
            //
584
            //
583
            case 35: { 
585
            case 35: { 
584
				makeToken(TK_DOT);
586
				makeToken(OCLParsersym.TK_DOT);
585
	            break;
587
	            break;
586
            }
588
            }
587
	 
589
	 
Lines 589-595 Link Here
589
            // Rule 36:  Token ::= . .
591
            // Rule 36:  Token ::= . .
590
            //
592
            //
591
            case 36: { 
593
            case 36: { 
592
				makeToken(TK_DOTDOT);
594
				makeToken(OCLParsersym.TK_DOTDOT);
593
	            break;
595
	            break;
594
            }
596
            }
595
	 
597
	 
Lines 597-603 Link Here
597
            // Rule 37:  Token ::= @ p r e
599
            // Rule 37:  Token ::= @ p r e
598
            //
600
            //
599
            case 37: { 
601
            case 37: { 
600
				makeToken(TK_ATPRE);
602
				makeToken(OCLParsersym.TK_ATPRE);
601
	            break;
603
	            break;
602
            }
604
            }
603
	 
605
	 
Lines 605-611 Link Here
605
            // Rule 38:  Token ::= ^
607
            // Rule 38:  Token ::= ^
606
            //
608
            //
607
            case 38: { 
609
            case 38: { 
608
				makeToken(TK_CARET);
610
				makeToken(OCLParsersym.TK_CARET);
609
	            break;
611
	            break;
610
            }
612
            }
611
	 
613
	 
Lines 613-619 Link Here
613
            // Rule 39:  Token ::= ^ ^
615
            // Rule 39:  Token ::= ^ ^
614
            //
616
            //
615
            case 39: { 
617
            case 39: { 
616
				makeToken(TK_CARETCARET);
618
				makeToken(OCLParsersym.TK_CARETCARET);
617
	            break;
619
	            break;
618
            }
620
            }
619
	 
621
	 
Lines 621-627 Link Here
621
            // Rule 40:  Token ::= ?
623
            // Rule 40:  Token ::= ?
622
            //
624
            //
623
            case 40: { 
625
            case 40: { 
624
				makeToken(TK_QUESTIONMARK);
626
				makeToken(OCLParsersym.TK_QUESTIONMARK);
625
	            break;
627
	            break;
626
            }
628
            }
627
	
629
	
(-)src/org/eclipse/ocl/lpg/AbstractLexer.java (-8 / +12 lines)
Lines 23-31 Link Here
23
import java.io.IOException;
23
import java.io.IOException;
24
import java.io.Reader;
24
import java.io.Reader;
25
25
26
import lpg.lpgjavaruntime.LpgLexStream;
26
import lpg.runtime.LpgLexStream;
27
import lpg.lpgjavaruntime.Monitor;
27
import lpg.runtime.Monitor;
28
import lpg.lpgjavaruntime.RuleAction;
28
import lpg.runtime.RuleAction;
29
29
30
30
31
/**
31
/**
Lines 118-123 Link Here
118
		lexToTokens(null, parser);
118
		lexToTokens(null, parser);
119
	}
119
	}
120
	
120
	
121
	/**
122
	 * @since 3.0
123
	 */
121
	public abstract void lexToTokens(Monitor monitor, AbstractParser parser);
124
	public abstract void lexToTokens(Monitor monitor, AbstractParser parser);
122
125
123
	/**
126
	/**
Lines 126-138 Link Here
126
	 * Note that other variants of reportError either feed this one, are fed from a default implementation
129
	 * Note that other variants of reportError either feed this one, are fed from a default implementation
127
	 * of this one or originate in the parser, where a ParserErrorHandler can intercept them.
130
	 * of this one or originate in the parser, where a ParserErrorHandler can intercept them.
128
	 */
131
	 */
129
	@Override public void reportError(int leftToken, int rightToken) {
132
	@Override public void reportError(int errorCode, int leftToken, int errorToken,
133
			int rightToken, String[] errorInfo) {
130
		BasicEnvironment environment = getEnvironment();
134
		BasicEnvironment environment = getEnvironment();
131
		if (environment != null)
135
		if (environment != null)
132
			environment.lexerError(computeErrorCode(leftToken, rightToken), leftToken, rightToken);
136
			environment.lexerError(errorCode, errorToken, rightToken);
133
		else
137
		super.reportError(errorCode, leftToken, errorToken, rightToken, errorInfo);
134
			super.reportError(leftToken, rightToken);
135
	}
138
	}
139
	
136
140
137
    /**
141
    /**
138
	 * Define the input text as a given array of characters.
142
	 * Define the input text as a given array of characters.
Lines 141-147 Link Here
141
	public void initialize(char[] inputChars) {
145
	public void initialize(char[] inputChars) {
142
		setInputChars(inputChars);
146
		setInputChars(inputChars);
143
        setStreamLength(inputChars.length);
147
        setStreamLength(inputChars.length);
144
        computeLineOffsets();        
148
        computeLineOffsets();
145
	}
149
	}
146
150
147
	/**
151
	/**
(-)src/org/eclipse/ocl/lpg/AbstractBasicEnvironment.java (-2 / +2 lines)
Lines 25-32 Link Here
25
import java.util.List;
25
import java.util.List;
26
import java.util.Map;
26
import java.util.Map;
27
27
28
import lpg.lpgjavaruntime.IToken;
28
import lpg.runtime.IToken;
29
import lpg.lpgjavaruntime.ParseErrorCodes;
29
import lpg.runtime.ParseErrorCodes;
30
30
31
import org.eclipse.ocl.cst.CSTNode;
31
import org.eclipse.ocl.cst.CSTNode;
32
import org.eclipse.ocl.internal.OCLDebugOptions;
32
import org.eclipse.ocl.internal.OCLDebugOptions;
(-)src/org/eclipse/ocl/lpg/AbstractParser.java (-19 / +44 lines)
Lines 21-33 Link Here
21
21
22
import java.util.ArrayList;
22
import java.util.ArrayList;
23
23
24
import lpg.lpgjavaruntime.ErrorToken;
24
import lpg.runtime.ErrorToken;
25
import lpg.lpgjavaruntime.IToken;
25
import lpg.runtime.IToken;
26
import lpg.lpgjavaruntime.LexStream;
26
import lpg.runtime.LexStream;
27
import lpg.lpgjavaruntime.Monitor;
27
import lpg.runtime.Monitor;
28
import lpg.lpgjavaruntime.ParseErrorCodes;
28
import lpg.runtime.ParseErrorCodes;
29
import lpg.lpgjavaruntime.PrsStream;
29
import lpg.runtime.PrsStream;
30
import lpg.lpgjavaruntime.Token;
30
import lpg.runtime.Token;
31
31
32
import org.eclipse.ocl.cst.CSTNode;
32
import org.eclipse.ocl.cst.CSTNode;
33
import org.eclipse.ocl.internal.l10n.OCLMessages;
33
import org.eclipse.ocl.internal.l10n.OCLMessages;
Lines 103-109 Link Here
103
	 * offset specified. If such a token does not exist, it returns the negation
103
	 * offset specified. If such a token does not exist, it returns the negation
104
	 * of the index of the element immediately preceding the offset.
104
	 * of the index of the element immediately preceding the offset.
105
	 * 
105
	 * 
106
	 * @since 1.3
106
	 * @since 3.0
107
	 */
107
	 */
108
	public ErrorToken getErrorTokenAtCharacter(int offset) {
108
	public ErrorToken getErrorTokenAtCharacter(int offset) {
109
		ErrorToken bestToken = null;
109
		ErrorToken bestToken = null;
Lines 141-147 Link Here
141
	}
141
	}
142
142
143
	public AbstractLexer getLexer() {
143
	public AbstractLexer getLexer() {
144
		return (AbstractLexer) super.getLexStream();
144
		return (AbstractLexer) super.getILexStream();
145
	}
145
	}
146
146
147
	/**
147
	/**
Lines 193-199 Link Here
193
193
194
			@Override
194
			@Override
195
			public String toString() {
195
			public String toString() {
196
				if (getPrsStream() == null) {
196
				if (getIPrsStream() == null) {
197
					return "<toString>"; //$NON-NLS-1$
197
					return "<toString>"; //$NON-NLS-1$
198
				}
198
				}
199
				int startOffset = getStartOffset();
199
				int startOffset = getStartOffset();
Lines 202-211 Link Here
202
					length = -length - 1;
202
					length = -length - 1;
203
					startOffset = getEndOffset();
203
					startOffset = getEndOffset();
204
				}
204
				}
205
				if ((startOffset + length) > getPrsStream().getInputChars().length) {
205
				if ((startOffset + length) > getIPrsStream().getInputChars().length) {
206
					return String.valueOf(IToken.EOF);
206
					return String.valueOf(IToken.EOF);
207
				}
207
				}
208
				return new String(getPrsStream().getInputChars(), startOffset,
208
				return new String(getIPrsStream().getInputChars(), startOffset,
209
					length);
209
					length);
210
			}
210
			}
211
211
Lines 220-229 Link Here
220
		return parseTokensToCST(null, defaultRepairCount);
220
		return parseTokensToCST(null, defaultRepairCount);
221
	}
221
	}
222
222
223
	/**
224
	 * @since 3.0
225
	 */
223
	public abstract CSTNode parseTokensToCST(Monitor monitor,
226
	public abstract CSTNode parseTokensToCST(Monitor monitor,
224
			int error_repair_count);
227
			int error_repair_count);
225
228
226
	@Override
229
	/*@Override
227
	public void reportError(int errorCode, String locationInfo, int leftToken,
230
	public void reportError(int errorCode, String locationInfo, int leftToken,
228
			int rightToken, String tokenText) {
231
			int rightToken, String tokenText) {
229
		BasicEnvironment environment = getEnvironment();
232
		BasicEnvironment environment = getEnvironment();
Lines 237-242 Link Here
237
			environment
240
			environment
238
				.parserError(errorCode, leftToken, rightToken, tokenText);
241
				.parserError(errorCode, leftToken, rightToken, tokenText);
239
		}
242
		}
243
	}*/
244
	
245
	@Override
246
	public void reportError(int errorCode, int leftToken, int errorToken,
247
			int rightToken, String[] errorInfo) {
248
		BasicEnvironment environment = getEnvironment();
249
		if (environment == null) {
250
			super.reportError(errorCode, leftToken, errorToken, rightToken, errorInfo);
251
		} else {			
252
			// TODO Revise this. BasicEnvironment.parserError doesn't have a String[] argument 
253
			String tokenText = errorInfo.length > 0 ? errorInfo[0] : ""; //$NON-NLS-1$		 
254
			if (errorCode == PrsStream.DELETION_CODE || errorCode == PrsStream.MISPLACED_CODE) { 
255
				tokenText = ""; //$NON-NLS-1$ 
256
			} 
257
			environment 
258
				.parserError(errorCode, leftToken, rightToken, tokenText);
259
		}
260
		
240
	}
261
	}
241
262
242
	/**
263
	/**
Lines 253-270 Link Here
253
		int firsttok = super.getFirstRealToken(error_token);
274
		int firsttok = super.getFirstRealToken(error_token);
254
		int lasttok = super.getLastRealToken(error_token);
275
		int lasttok = super.getLastRealToken(error_token);
255
		if (firsttok > lasttok) {
276
		if (firsttok > lasttok) {
256
			String location = super.getFileName() + ':'
277
			/*String location = super.getFileName() + ':'
257
				+ super.getEndLine(lasttok) + ':' + super.getEndColumn(lasttok)
278
				+ super.getEndLine(lasttok) + ':' + super.getEndColumn(lasttok)
258
				+ ": "; //$NON-NLS-1$
279
				+ ": "; //$NON-NLS-1$*/
259
			reportError(ParseErrorCodes.INSERTION_CODE, location, lasttok,
280
			reportError(ParseErrorCodes.INSERTION_CODE, lasttok,
260
				lasttok, msg);
281
				lasttok, msg);
261
		} else {
282
		} else {
262
			String location = super.getFileName() + ':'
283
			/*String location = super.getFileName() + ':'
263
				+ super.getLine(error_token) + ':'
284
				+ super.getLine(error_token) + ':'
264
				+ super.getColumn(error_token) + ':'
285
				+ super.getColumn(error_token) + ':'
265
				+ super.getEndLine(error_token) + ':'
286
				+ super.getEndLine(error_token) + ':'
266
				+ super.getEndColumn(error_token) + ": "; //$NON-NLS-1$
287
				+ super.getEndColumn(error_token) + ": "; //$NON-NLS-1$*/
267
			reportError(ParseErrorCodes.SUBSTITUTION_CODE, location, firsttok,
288
			reportError(ParseErrorCodes.SUBSTITUTION_CODE, firsttok,
268
				lasttok, msg);
289
				lasttok, msg);
269
		}
290
		}
270
	}
291
	}
Lines 307-312 Link Here
307
	 *            <code>CSTNode</code> to set offsets
328
	 *            <code>CSTNode</code> to set offsets
308
	 * @param startEnd
329
	 * @param startEnd
309
	 *            <code>IToken</code> to retrieve offsets from
330
	 *            <code>IToken</code> to retrieve offsets from
331
	 * @since 3.0
310
	 */
332
	 */
311
	protected void setOffsets(CSTNode cstNode, IToken startEnd) {
333
	protected void setOffsets(CSTNode cstNode, IToken startEnd) {
312
		cstNode.setStartToken(startEnd);
334
		cstNode.setStartToken(startEnd);
Lines 368-373 Link Here
368
	 *            <code>CSTNode</code> to retrieve start offset from
390
	 *            <code>CSTNode</code> to retrieve start offset from
369
	 * @param end
391
	 * @param end
370
	 *            <code>IToken</code> to retrieve end offset from
392
	 *            <code>IToken</code> to retrieve end offset from
393
	 * @since 3.0
371
	 */
394
	 */
372
	protected void setOffsets(CSTNode cstNode, CSTNode start, IToken end) {
395
	protected void setOffsets(CSTNode cstNode, CSTNode start, IToken end) {
373
		cstNode.setStartToken(start.getStartToken());
396
		cstNode.setStartToken(start.getStartToken());
Lines 387-392 Link Here
387
	 *            <code>IToken</code> to retrieve start offset from
410
	 *            <code>IToken</code> to retrieve start offset from
388
	 * @param end
411
	 * @param end
389
	 *            <code>CSTNode</code> to retrieve end offset from
412
	 *            <code>CSTNode</code> to retrieve end offset from
413
	 * @since 3.0
390
	 */
414
	 */
391
	protected void setOffsets(CSTNode cstNode, IToken start, CSTNode end) {
415
	protected void setOffsets(CSTNode cstNode, IToken start, CSTNode end) {
392
		cstNode.setStartToken(start);
416
		cstNode.setStartToken(start);
Lines 406-411 Link Here
406
	 *            <code>IToken</code> to retrieve start offset from
430
	 *            <code>IToken</code> to retrieve start offset from
407
	 * @param end
431
	 * @param end
408
	 *            <code>IToken</code> to retrieve end offset from
432
	 *            <code>IToken</code> to retrieve end offset from
433
	 * @since 3.0
409
	 */
434
	 */
410
	protected void setOffsets(CSTNode cstNode, IToken start, IToken end) {
435
	protected void setOffsets(CSTNode cstNode, IToken start, IToken end) {
411
		cstNode.setStartToken(start);
436
		cstNode.setStartToken(start);
(-)src/org/eclipse/ocl/lpg/AbstractProblemHandler.java (-1 / +1 lines)
Lines 17-23 Link Here
17
 */
17
 */
18
package org.eclipse.ocl.lpg;
18
package org.eclipse.ocl.lpg;
19
19
20
import lpg.lpgjavaruntime.ParseErrorCodes;
20
import lpg.runtime.ParseErrorCodes;
21
21
22
import org.eclipse.emf.common.util.Monitor;
22
import org.eclipse.emf.common.util.Monitor;
23
import org.eclipse.ocl.internal.l10n.OCLMessages;
23
import org.eclipse.ocl.internal.l10n.OCLMessages;
(-).settings/.api_filters (-2 / +386 lines)
Lines 1-8 Link Here
1
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
1
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
2
<component id="org.eclipse.ocl" version="2">
2
<component id="org.eclipse.ocl" version="2">
3
    <resource path="src/org/eclipse/ocl/parser/OCLKWLexerprs.java" type="org.eclipse.ocl.parser.OCLKWLexerprs">
4
        <filter id="1143996420">
5
            <message_arguments>
6
                <message_argument value="MAX_NAME_LENGTH"/>
7
            </message_arguments>
8
        </filter>
9
        <filter id="1143996420">
10
            <message_arguments>
11
                <message_argument value="isNullable"/>
12
            </message_arguments>
13
        </filter>
14
        <filter id="1143996420">
15
            <message_arguments>
16
                <message_argument value="SCOPE_SIZE"/>
17
            </message_arguments>
18
        </filter>
19
        <filter id="1143996420">
20
            <message_arguments>
21
                <message_argument value="prosthesesIndex"/>
22
            </message_arguments>
23
        </filter>
24
        <filter id="1143996420">
25
            <message_arguments>
26
                <message_argument value="SCOPE_UBOUND"/>
27
            </message_arguments>
28
        </filter>
29
        <filter id="1143996420">
30
            <message_arguments>
31
                <message_argument value="isNullable(int)"/>
32
            </message_arguments>
33
        </filter>
34
        <filter id="1143996420">
35
            <message_arguments>
36
                <message_argument value="getIdentifier_SYMBOL()"/>
37
            </message_arguments>
38
        </filter>
39
        <filter id="1143996420">
40
            <message_arguments>
41
                <message_argument value="ERROR_SYMBOL"/>
42
            </message_arguments>
43
        </filter>
44
        <filter id="1143996420">
45
            <message_arguments>
46
                <message_argument value="prosthesesIndex(int)"/>
47
            </message_arguments>
48
        </filter>
49
    </resource>
50
    <resource path="src/org/eclipse/ocl/parser/OCLKWLexerprs.java" type="org.eclipse.ocl.parser.OCLKWLexerprs$IsNullable">
51
        <filter id="1143996420">
52
            <message_arguments>
53
                <message_argument value="IsNullable"/>
54
            </message_arguments>
55
        </filter>
56
    </resource>
57
    <resource path="src/org/eclipse/ocl/parser/OCLKWLexerprs.java" type="org.eclipse.ocl.parser.OCLKWLexerprs$ProsthesesIndex">
58
        <filter id="1143996420">
59
            <message_arguments>
60
                <message_argument value="ProsthesesIndex"/>
61
            </message_arguments>
62
        </filter>
63
    </resource>
64
    <resource path="src/org/eclipse/ocl/parser/OCLKWLexersym.java" type="org.eclipse.ocl.parser.OCLKWLexersym">
65
        <filter id="1211105284">
66
            <message_arguments>
67
                <message_argument value="Char__"/>
68
            </message_arguments>
69
        </filter>
70
        <filter id="1211105284">
71
            <message_arguments>
72
                <message_argument value="numTokenKinds"/>
73
            </message_arguments>
74
        </filter>
75
        <filter id="1211105284">
76
            <message_arguments>
77
                <message_argument value="Char_Percent"/>
78
            </message_arguments>
79
        </filter>
80
    </resource>
81
    <resource path="src/org/eclipse/ocl/parser/OCLLexerprs.java" type="org.eclipse.ocl.parser.OCLLexerprs">
82
        <filter id="1143996420">
83
            <message_arguments>
84
                <message_argument value="SCOPE_UBOUND"/>
85
            </message_arguments>
86
        </filter>
87
        <filter id="1143996420">
88
            <message_arguments>
89
                <message_argument value="MAX_NAME_LENGTH"/>
90
            </message_arguments>
91
        </filter>
92
        <filter id="1143996420">
93
            <message_arguments>
94
                <message_argument value="isNullable(int)"/>
95
            </message_arguments>
96
        </filter>
97
        <filter id="1143996420">
98
            <message_arguments>
99
                <message_argument value="getIdentifier_SYMBOL()"/>
100
            </message_arguments>
101
        </filter>
102
        <filter id="1143996420">
103
            <message_arguments>
104
                <message_argument value="isNullable"/>
105
            </message_arguments>
106
        </filter>
107
        <filter id="1143996420">
108
            <message_arguments>
109
                <message_argument value="SCOPE_SIZE"/>
110
            </message_arguments>
111
        </filter>
112
        <filter id="1143996420">
113
            <message_arguments>
114
                <message_argument value="prosthesesIndex(int)"/>
115
            </message_arguments>
116
        </filter>
117
        <filter id="1143996420">
118
            <message_arguments>
119
                <message_argument value="prosthesesIndex"/>
120
            </message_arguments>
121
        </filter>
122
        <filter id="1143996420">
123
            <message_arguments>
124
                <message_argument value="ERROR_SYMBOL"/>
125
            </message_arguments>
126
        </filter>
127
    </resource>
128
    <resource path="src/org/eclipse/ocl/parser/OCLLexerprs.java" type="org.eclipse.ocl.parser.OCLLexerprs$IsNullable">
129
        <filter id="1143996420">
130
            <message_arguments>
131
                <message_argument value="IsNullable"/>
132
            </message_arguments>
133
        </filter>
134
    </resource>
135
    <resource path="src/org/eclipse/ocl/parser/OCLLexerprs.java" type="org.eclipse.ocl.parser.OCLLexerprs$ProsthesesIndex">
136
        <filter id="1143996420">
137
            <message_arguments>
138
                <message_argument value="ProsthesesIndex"/>
139
            </message_arguments>
140
        </filter>
141
    </resource>
142
    <resource path="src/org/eclipse/ocl/parser/OCLLexersym.java" type="org.eclipse.ocl.parser.OCLLexersym">
143
        <filter id="1211105284">
144
            <message_arguments>
145
                <message_argument value="numTokenKinds"/>
146
            </message_arguments>
147
        </filter>
148
    </resource>
149
    <resource path="src/org/eclipse/ocl/parser/OCLParserprs.java" type="org.eclipse.ocl.parser.OCLParserprs">
150
        <filter id="1143996420">
151
            <message_arguments>
152
                <message_argument value="prosthesesIndex(int)"/>
153
            </message_arguments>
154
        </filter>
155
        <filter id="1143996420">
156
            <message_arguments>
157
                <message_argument value="prosthesesIndex"/>
158
            </message_arguments>
159
        </filter>
160
        <filter id="1143996420">
161
            <message_arguments>
162
                <message_argument value="isNullable(int)"/>
163
            </message_arguments>
164
        </filter>
165
        <filter id="1143996420">
166
            <message_arguments>
167
                <message_argument value="isNullable"/>
168
            </message_arguments>
169
        </filter>
170
        <filter id="1143996420">
171
            <message_arguments>
172
                <message_argument value="getIdentifier_SYMBOL()"/>
173
            </message_arguments>
174
        </filter>
175
    </resource>
176
    <resource path="src/org/eclipse/ocl/parser/OCLParserprs.java" type="org.eclipse.ocl.parser.OCLParserprs$IsNullable">
177
        <filter id="1143996420">
178
            <message_arguments>
179
                <message_argument value="IsNullable"/>
180
            </message_arguments>
181
        </filter>
182
    </resource>
183
    <resource path="src/org/eclipse/ocl/parser/OCLParserprs.java" type="org.eclipse.ocl.parser.OCLParserprs$ProsthesesIndex">
184
        <filter id="1143996420">
185
            <message_arguments>
186
                <message_argument value="ProsthesesIndex"/>
187
            </message_arguments>
188
        </filter>
189
    </resource>
3
    <resource path="src/org/eclipse/ocl/parser/OCLParsersym.java" type="org.eclipse.ocl.parser.OCLParsersym">
190
    <resource path="src/org/eclipse/ocl/parser/OCLParsersym.java" type="org.eclipse.ocl.parser.OCLParsersym">
4
        <filter id="1211105284">
191
        <filter id="1211105284">
5
            <message_arguments>
192
            <message_arguments>
193
                <message_argument value="numTokenKinds"/>
194
            </message_arguments>
195
        </filter>
196
        <filter id="1211105284">
197
            <message_arguments>
6
                <message_argument value="TK_static"/>
198
                <message_argument value="TK_static"/>
7
            </message_arguments>
199
            </message_arguments>
8
        </filter>
200
        </filter>
Lines 22-31 Link Here
22
            </message_arguments>
214
            </message_arguments>
23
        </filter>
215
        </filter>
24
    </resource>
216
    </resource>
217
    <resource path="src/org/eclipse/ocl/parser/backtracking/OCLBacktrackingKWLexerprs.java" type="org.eclipse.ocl.parser.backtracking.OCLBacktrackingKWLexerprs">
218
        <filter id="1143996420">
219
            <message_arguments>
220
                <message_argument value="prosthesesIndex"/>
221
            </message_arguments>
222
        </filter>
223
        <filter id="1143996420">
224
            <message_arguments>
225
                <message_argument value="MAX_NAME_LENGTH"/>
226
            </message_arguments>
227
        </filter>
228
        <filter id="1143996420">
229
            <message_arguments>
230
                <message_argument value="isNullable"/>
231
            </message_arguments>
232
        </filter>
233
        <filter id="1143996420">
234
            <message_arguments>
235
                <message_argument value="ERROR_SYMBOL"/>
236
            </message_arguments>
237
        </filter>
238
        <filter id="1143996420">
239
            <message_arguments>
240
                <message_argument value="getIdentifier_SYMBOL()"/>
241
            </message_arguments>
242
        </filter>
243
        <filter id="1143996420">
244
            <message_arguments>
245
                <message_argument value="SCOPE_SIZE"/>
246
            </message_arguments>
247
        </filter>
248
        <filter id="1143996420">
249
            <message_arguments>
250
                <message_argument value="prosthesesIndex(int)"/>
251
            </message_arguments>
252
        </filter>
253
        <filter id="1143996420">
254
            <message_arguments>
255
                <message_argument value="SCOPE_UBOUND"/>
256
            </message_arguments>
257
        </filter>
258
        <filter id="1143996420">
259
            <message_arguments>
260
                <message_argument value="isNullable(int)"/>
261
            </message_arguments>
262
        </filter>
263
    </resource>
264
    <resource path="src/org/eclipse/ocl/parser/backtracking/OCLBacktrackingKWLexerprs.java" type="org.eclipse.ocl.parser.backtracking.OCLBacktrackingKWLexerprs$IsNullable">
265
        <filter id="1143996420">
266
            <message_arguments>
267
                <message_argument value="IsNullable"/>
268
            </message_arguments>
269
        </filter>
270
    </resource>
271
    <resource path="src/org/eclipse/ocl/parser/backtracking/OCLBacktrackingKWLexerprs.java" type="org.eclipse.ocl.parser.backtracking.OCLBacktrackingKWLexerprs$ProsthesesIndex">
272
        <filter id="1143996420">
273
            <message_arguments>
274
                <message_argument value="ProsthesesIndex"/>
275
            </message_arguments>
276
        </filter>
277
    </resource>
278
    <resource path="src/org/eclipse/ocl/parser/backtracking/OCLBacktrackingKWLexersym.java" type="org.eclipse.ocl.parser.backtracking.OCLBacktrackingKWLexersym">
279
        <filter id="1211105284">
280
            <message_arguments>
281
                <message_argument value="Char__"/>
282
            </message_arguments>
283
        </filter>
284
        <filter id="1211105284">
285
            <message_arguments>
286
                <message_argument value="Char_Percent"/>
287
            </message_arguments>
288
        </filter>
289
        <filter id="1211105284">
290
            <message_arguments>
291
                <message_argument value="numTokenKinds"/>
292
            </message_arguments>
293
        </filter>
294
    </resource>
295
    <resource path="src/org/eclipse/ocl/parser/backtracking/OCLBacktrackingLexerprs.java" type="org.eclipse.ocl.parser.backtracking.OCLBacktrackingLexerprs">
296
        <filter id="1143996420">
297
            <message_arguments>
298
                <message_argument value="isNullable"/>
299
            </message_arguments>
300
        </filter>
301
        <filter id="1143996420">
302
            <message_arguments>
303
                <message_argument value="isNullable(int)"/>
304
            </message_arguments>
305
        </filter>
306
        <filter id="1143996420">
307
            <message_arguments>
308
                <message_argument value="getIdentifier_SYMBOL()"/>
309
            </message_arguments>
310
        </filter>
311
        <filter id="1143996420">
312
            <message_arguments>
313
                <message_argument value="MAX_NAME_LENGTH"/>
314
            </message_arguments>
315
        </filter>
316
        <filter id="1143996420">
317
            <message_arguments>
318
                <message_argument value="ERROR_SYMBOL"/>
319
            </message_arguments>
320
        </filter>
321
        <filter id="1143996420">
322
            <message_arguments>
323
                <message_argument value="prosthesesIndex"/>
324
            </message_arguments>
325
        </filter>
326
        <filter id="1143996420">
327
            <message_arguments>
328
                <message_argument value="SCOPE_SIZE"/>
329
            </message_arguments>
330
        </filter>
331
        <filter id="1143996420">
332
            <message_arguments>
333
                <message_argument value="prosthesesIndex(int)"/>
334
            </message_arguments>
335
        </filter>
336
        <filter id="1143996420">
337
            <message_arguments>
338
                <message_argument value="SCOPE_UBOUND"/>
339
            </message_arguments>
340
        </filter>
341
    </resource>
342
    <resource path="src/org/eclipse/ocl/parser/backtracking/OCLBacktrackingLexerprs.java" type="org.eclipse.ocl.parser.backtracking.OCLBacktrackingLexerprs$IsNullable">
343
        <filter id="1143996420">
344
            <message_arguments>
345
                <message_argument value="IsNullable"/>
346
            </message_arguments>
347
        </filter>
348
    </resource>
349
    <resource path="src/org/eclipse/ocl/parser/backtracking/OCLBacktrackingLexerprs.java" type="org.eclipse.ocl.parser.backtracking.OCLBacktrackingLexerprs$ProsthesesIndex">
350
        <filter id="1143996420">
351
            <message_arguments>
352
                <message_argument value="ProsthesesIndex"/>
353
            </message_arguments>
354
        </filter>
355
    </resource>
356
    <resource path="src/org/eclipse/ocl/parser/backtracking/OCLBacktrackingLexersym.java" type="org.eclipse.ocl.parser.backtracking.OCLBacktrackingLexersym">
357
        <filter id="1211105284">
358
            <message_arguments>
359
                <message_argument value="numTokenKinds"/>
360
            </message_arguments>
361
        </filter>
362
    </resource>
363
    <resource path="src/org/eclipse/ocl/parser/backtracking/OCLBacktrackingParserprs.java" type="org.eclipse.ocl.parser.backtracking.OCLBacktrackingParserprs">
364
        <filter id="1143996420">
365
            <message_arguments>
366
                <message_argument value="prosthesesIndex(int)"/>
367
            </message_arguments>
368
        </filter>
369
        <filter id="1143996420">
370
            <message_arguments>
371
                <message_argument value="prosthesesIndex"/>
372
            </message_arguments>
373
        </filter>
374
        <filter id="1143996420">
375
            <message_arguments>
376
                <message_argument value="getIdentifier_SYMBOL()"/>
377
            </message_arguments>
378
        </filter>
379
        <filter id="1143996420">
380
            <message_arguments>
381
                <message_argument value="isNullable(int)"/>
382
            </message_arguments>
383
        </filter>
384
        <filter id="1143996420">
385
            <message_arguments>
386
                <message_argument value="isNullable"/>
387
            </message_arguments>
388
        </filter>
389
    </resource>
390
    <resource path="src/org/eclipse/ocl/parser/backtracking/OCLBacktrackingParserprs.java" type="org.eclipse.ocl.parser.backtracking.OCLBacktrackingParserprs$IsNullable">
391
        <filter id="1143996420">
392
            <message_arguments>
393
                <message_argument value="IsNullable"/>
394
            </message_arguments>
395
        </filter>
396
    </resource>
397
    <resource path="src/org/eclipse/ocl/parser/backtracking/OCLBacktrackingParserprs.java" type="org.eclipse.ocl.parser.backtracking.OCLBacktrackingParserprs$ProsthesesIndex">
398
        <filter id="1143996420">
399
            <message_arguments>
400
                <message_argument value="ProsthesesIndex"/>
401
            </message_arguments>
402
        </filter>
403
    </resource>
25
    <resource path="src/org/eclipse/ocl/parser/backtracking/OCLBacktrackingParsersym.java" type="org.eclipse.ocl.parser.backtracking.OCLBacktrackingParsersym">
404
    <resource path="src/org/eclipse/ocl/parser/backtracking/OCLBacktrackingParsersym.java" type="org.eclipse.ocl.parser.backtracking.OCLBacktrackingParsersym">
26
        <filter id="1211105284">
405
        <filter id="1211105284">
27
            <message_arguments>
406
            <message_arguments>
28
                <message_argument value="TK_static"/>
407
                <message_argument value="TK_SINGLE_LINE_COMMENT"/>
29
            </message_arguments>
408
            </message_arguments>
30
        </filter>
409
        </filter>
31
        <filter id="1211105284">
410
        <filter id="1211105284">
Lines 35-41 Link Here
35
        </filter>
414
        </filter>
36
        <filter id="1211105284">
415
        <filter id="1211105284">
37
            <message_arguments>
416
            <message_arguments>
38
                <message_argument value="TK_SINGLE_LINE_COMMENT"/>
417
                <message_argument value="TK_static"/>
418
            </message_arguments>
419
        </filter>
420
        <filter id="1211105284">
421
            <message_arguments>
422
                <message_argument value="numTokenKinds"/>
39
            </message_arguments>
423
            </message_arguments>
40
        </filter>
424
        </filter>
41
        <filter id="1211105284">
425
        <filter id="1211105284">
(-).settings/LPG Backtracking OCLParser.launch (-11 / +11 lines)
Lines 1-11 Link Here
1
<?xml version="1.0" encoding="UTF-8"?>
1
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
2
<launchConfiguration type="org.eclipse.ui.externaltools.ProgramLaunchConfigurationType">
2
<launchConfiguration type="org.eclipse.ui.externaltools.ProgramLaunchConfigurationType">
3
<stringAttribute key="org.eclipse.debug.core.ATTR_REFRESH_SCOPE" value="${working_set:&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;&#13;&#10;&lt;launchConfigurationWorkingSet editPageId=&quot;org.eclipse.ui.resourceWorkingSetPage&quot; factoryID=&quot;org.eclipse.ui.internal.WorkingSetFactory&quot; label=&quot;working set&quot; name=&quot;working set&quot;&gt;&#13;&#10;&lt;item factoryID=&quot;org.eclipse.ui.internal.model.ResourceFactory&quot; path=&quot;/org.eclipse.ocl/src/org/eclipse/ocl/lpg&quot; type=&quot;2&quot;/&gt;&#13;&#10;&lt;item factoryID=&quot;org.eclipse.ui.internal.model.ResourceFactory&quot; path=&quot;/org.eclipse.ocl/src/org/eclipse/ocl/parser/backtracking&quot; type=&quot;2&quot;/&gt;&#13;&#10;&lt;/launchConfigurationWorkingSet&gt;}"/>
3
<stringAttribute key="org.eclipse.debug.core.ATTR_REFRESH_SCOPE" value="${working_set:&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;&#13;&#10;&lt;launchConfigurationWorkingSet editPageId=&quot;org.eclipse.ui.resourceWorkingSetPage&quot; factoryID=&quot;org.eclipse.ui.internal.WorkingSetFactory&quot; id=&quot;1252079866558_7&quot; label=&quot;working set&quot; name=&quot;working set&quot;&gt;&#13;&#10;&lt;item factoryID=&quot;org.eclipse.ui.internal.model.ResourceFactory&quot; path=&quot;/org.eclipse.ocl/src/org/eclipse/ocl/parser/backtracking&quot; type=&quot;2&quot;/&gt;&#13;&#10;&lt;item factoryID=&quot;org.eclipse.ui.internal.model.ResourceFactory&quot; path=&quot;/org.eclipse.ocl/src/org/eclipse/ocl/lpg&quot; type=&quot;2&quot;/&gt;&#13;&#10;&lt;/launchConfigurationWorkingSet&gt;}"/>
4
<booleanAttribute key="org.eclipse.debug.core.appendEnvironmentVariables" value="true"/>
4
<booleanAttribute key="org.eclipse.debug.core.appendEnvironmentVariables" value="true"/>
5
<listAttribute key="org.eclipse.debug.ui.favoriteGroups">
5
<listAttribute key="org.eclipse.debug.ui.favoriteGroups">
6
<listEntry value="org.eclipse.ui.externaltools.launchGroup"/>
6
<listEntry value="org.eclipse.ui.externaltools.launchGroup"/>
7
</listAttribute>
7
</listAttribute>
8
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_LOCATION" value="${lpg.exe}"/>
8
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_LOCATION" value="${lpg2.exe}"/>
9
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_TOOL_ARGUMENTS" value="OCLBacktrackingParser.g"/>
9
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_TOOL_ARGUMENTS" value="OCLBacktrackingParser.g"/>
10
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_WORKING_DIRECTORY" value="${workspace_loc:/org.eclipse.ocl/src/org/eclipse/ocl/parser/backtracking}"/>
10
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_WORKING_DIRECTORY" value="${workspace_loc:/org.eclipse.ocl/src/org/eclipse/ocl/parser/backtracking}"/>
11
</launchConfiguration>
11
</launchConfiguration>
(-).settings/LPG OCLParser.launch (-3 / +3 lines)
Lines 1-11 Link Here
1
<?xml version="1.0" encoding="UTF-8"?>
1
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
2
<launchConfiguration type="org.eclipse.ui.externaltools.ProgramLaunchConfigurationType">
2
<launchConfiguration type="org.eclipse.ui.externaltools.ProgramLaunchConfigurationType">
3
<stringAttribute key="org.eclipse.debug.core.ATTR_REFRESH_SCOPE" value="${working_set:&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;&#13;&#10;&lt;launchConfigurationWorkingSet editPageId=&quot;org.eclipse.ui.resourceWorkingSetPage&quot; factoryID=&quot;org.eclipse.ui.internal.WorkingSetFactory&quot; label=&quot;working set&quot; name=&quot;working set&quot;&gt;&#13;&#10;&lt;item factoryID=&quot;org.eclipse.ui.internal.model.ResourceFactory&quot; path=&quot;/org.eclipse.ocl/src/org/eclipse/ocl/lpg&quot; type=&quot;2&quot;/&gt;&#13;&#10;&lt;item factoryID=&quot;org.eclipse.ui.internal.model.ResourceFactory&quot; path=&quot;/org.eclipse.ocl/src/org/eclipse/ocl/parser&quot; type=&quot;2&quot;/&gt;&#13;&#10;&lt;/launchConfigurationWorkingSet&gt;}"/>
3
<stringAttribute key="org.eclipse.debug.core.ATTR_REFRESH_SCOPE" value="${working_set:&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;&#13;&#10;&lt;launchConfigurationWorkingSet editPageId=&quot;org.eclipse.ui.resourceWorkingSetPage&quot; factoryID=&quot;org.eclipse.ui.internal.WorkingSetFactory&quot; id=&quot;1252080004239_73&quot; label=&quot;working set&quot; name=&quot;working set&quot;&gt;&#13;&#10;&lt;item factoryID=&quot;org.eclipse.ui.internal.model.ResourceFactory&quot; path=&quot;/org.eclipse.ocl/src/org/eclipse/ocl/parser&quot; type=&quot;2&quot;/&gt;&#13;&#10;&lt;item factoryID=&quot;org.eclipse.ui.internal.model.ResourceFactory&quot; path=&quot;/org.eclipse.ocl/src/org/eclipse/ocl/lpg&quot; type=&quot;2&quot;/&gt;&#13;&#10;&lt;/launchConfigurationWorkingSet&gt;}"/>
4
<booleanAttribute key="org.eclipse.debug.core.appendEnvironmentVariables" value="true"/>
4
<booleanAttribute key="org.eclipse.debug.core.appendEnvironmentVariables" value="true"/>
5
<listAttribute key="org.eclipse.debug.ui.favoriteGroups">
5
<listAttribute key="org.eclipse.debug.ui.favoriteGroups">
6
<listEntry value="org.eclipse.ui.externaltools.launchGroup"/>
6
<listEntry value="org.eclipse.ui.externaltools.launchGroup"/>
7
</listAttribute>
7
</listAttribute>
8
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_LOCATION" value="${lpg.exe}"/>
8
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_LOCATION" value="${lpg2.exe}"/>
9
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_TOOL_ARGUMENTS" value="OCLParser.g"/>
9
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_TOOL_ARGUMENTS" value="OCLParser.g"/>
10
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_WORKING_DIRECTORY" value="${workspace_loc:/org.eclipse.ocl/src/org/eclipse/ocl/parser}"/>
10
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_WORKING_DIRECTORY" value="${workspace_loc:/org.eclipse.ocl/src/org/eclipse/ocl/parser}"/>
11
</launchConfiguration>
11
</launchConfiguration>
(-)src/org/eclipse/ocl/parser/backtracking/OCLBacktrackingLexer.java (-47 / +49 lines)
Lines 1-7 Link Here
1
/**
1
/**
2
* <copyright>
2
* <copyright>
3
*
3
*
4
* Copyright (c) 2005, 2009 IBM Corporation, Borland Software Corp.,  and others.
4
* Copyright (c) 2005, 2009 IBM Corporation, Borland Software Corp. 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-25 Link Here
10
* Contributors:
10
* Contributors:
11
*   IBM - Initial API and implementation
11
*   IBM - Initial API and implementation
12
*   E.D.Willink - Lexer and Parser refactoring to support extensibility and flexible error handling
12
*   E.D.Willink - Lexer and Parser refactoring to support extensibility and flexible error handling
13
*               - Bug 259818
13
*   Borland - Bug 242880
14
*   Borland - Bug 242880
15
*   Adolfo Sanchez-Barbudo Herrera (Open Canarias) - LPG v 2.0.17 adoption (242153)
14
*
16
*
15
* </copyright>
17
* </copyright>
16
*
18
*
17
* $Id: OCLBacktrackingLexer.java,v 1.5 2009/09/04 13:40:44 ewillink Exp $
19
* $Id: OCLLexer.g,v 1.3 2009/08/28 20:43:11 ewillink Exp $
18
*/
20
*/
19
21
20
package org.eclipse.ocl.parser.backtracking;
22
package org.eclipse.ocl.parser.backtracking;
21
23
22
import lpg.lpgjavaruntime.*;
24
import lpg.runtime.*;
23
import org.eclipse.ocl.lpg.AbstractLexer;
25
import org.eclipse.ocl.lpg.AbstractLexer;
24
import org.eclipse.ocl.lpg.AbstractParser;
26
import org.eclipse.ocl.lpg.AbstractParser;
25
import org.eclipse.ocl.Environment;
27
import org.eclipse.ocl.Environment;
Lines 52-58 Link Here
52
    
54
    
53
	public OCLBacktrackingLexer(Environment<?,?,?,?,?,?,?,?,?,?,?,?> environment, char[] chars) {
55
	public OCLBacktrackingLexer(Environment<?,?,?,?,?,?,?,?,?,?,?,?> environment, char[] chars) {
54
		this(environment, chars, "OCL", ECLIPSE_TAB_VALUE);
56
		this(environment, chars, "OCL", ECLIPSE_TAB_VALUE);
55
		kwLexer = new OCLBacktrackingKWLexer(getInputChars(), TK_IDENTIFIER);
57
		kwLexer = new OCLBacktrackingKWLexer(getInputChars(), OCLBacktrackingParsersym.TK_IDENTIFIER);
56
	}
58
	}
57
59
58
    public OCLBacktrackingLexer(Environment<?,?,?,?,?,?,?,?,?,?,?,?> environment, char[] input_chars, String filename, int tab)  {
60
    public OCLBacktrackingLexer(Environment<?,?,?,?,?,?,?,?,?,?,?,?> environment, char[] input_chars, String filename, int tab)  {
Lines 81-87 Link Here
81
    {
83
    {
82
        super.initialize(content, filename);
84
        super.initialize(content, filename);
83
        if (kwLexer == null)
85
        if (kwLexer == null)
84
             kwLexer = new OCLBacktrackingKWLexer(getInputChars(), TK_IDENTIFIER);
86
             kwLexer = new OCLBacktrackingKWLexer(getInputChars(), OCLBacktrackingParsersym.TK_IDENTIFIER);
85
        else
87
        else
86
             kwLexer.setInputChars(getInputChars());
88
             kwLexer.setInputChars(getInputChars());
87
    }
89
    }
Lines 92-98 Link Here
92
    @Override
94
    @Override
93
    public void setInputChars(char[] inputChars) {
95
    public void setInputChars(char[] inputChars) {
94
		super.setInputChars(inputChars);
96
		super.setInputChars(inputChars);
95
		kwLexer = new OCLBacktrackingKWLexer(getInputChars(), TK_IDENTIFIER);
97
		kwLexer = new OCLBacktrackingKWLexer(getInputChars(), OCLBacktrackingParsersym.TK_IDENTIFIER);
96
	}
98
	}
97
    
99
    
98
    @Override
100
    @Override
Lines 108-119 Link Here
108
        lexParser.parseCharacters(monitor);  // Lex the input characters
110
        lexParser.parseCharacters(monitor);  // Lex the input characters
109
            
111
            
110
        int i = getStreamIndex();
112
        int i = getStreamIndex();
111
        parser.makeToken(i, i, TK_EOF_TOKEN); // and end with the end of file token
113
        parser.makeToken(i, i, OCLBacktrackingParsersym.TK_EOF_TOKEN); // and end with the end of file token
112
        parser.setStreamLength(parser.getSize());
114
        parser.setStreamLength(parser.getSize());
113
            
115
            
114
        return;
116
        return;
115
    }
117
    }
116
    
118
        
117
    final void makeToken(int kind)
119
    final void makeToken(int kind)
118
    {
120
    {
119
        int startOffset = getLeftSpan(),
121
        int startOffset = getLeftSpan(),
Lines 126-132 Link Here
126
    {
128
    {
127
        int startOffset = getLeftSpan(),
129
        int startOffset = getLeftSpan(),
128
            endOffset = getRightSpan();
130
            endOffset = getRightSpan();
129
        super.getPrsStream().makeAdjunct(startOffset, endOffset, kind);
131
        super.getIPrsStream().makeAdjunct(startOffset, endOffset, kind);
130
    }
132
    }
131
133
132
    final void skipToken()
134
    final void skipToken()
Lines 317-323 Link Here
317
            // Rule 2:  Token ::= EscapedSQ
319
            // Rule 2:  Token ::= EscapedSQ
318
            //
320
            //
319
            case 2: { 
321
            case 2: { 
320
				makeToken(TK_STRING_LITERAL);
322
				makeToken(OCLBacktrackingParsersym.TK_STRING_LITERAL);
321
	            break;
323
	            break;
322
            }
324
            }
323
	 
325
	 
Lines 325-331 Link Here
325
            // Rule 3:  Token ::= SingleQuote SLNotSQ SingleQuote
327
            // Rule 3:  Token ::= SingleQuote SLNotSQ SingleQuote
326
            //
328
            //
327
            case 3: { 
329
            case 3: { 
328
				makeToken(TK_STRING_LITERAL);
330
				makeToken(OCLBacktrackingParsersym.TK_STRING_LITERAL);
329
	            break;
331
	            break;
330
            }
332
            }
331
	 
333
	 
Lines 333-339 Link Here
333
            // Rule 4:  Token ::= Acute SLNotSQOpt Acute
335
            // Rule 4:  Token ::= Acute SLNotSQOpt Acute
334
            //
336
            //
335
            case 4: { 
337
            case 4: { 
336
				makeToken(TK_STRING_LITERAL);
338
				makeToken(OCLBacktrackingParsersym.TK_STRING_LITERAL);
337
	            break;
339
	            break;
338
            }
340
            }
339
	 
341
	 
Lines 341-347 Link Here
341
            // Rule 5:  Token ::= BackQuote SLNotSQOpt Acute
343
            // Rule 5:  Token ::= BackQuote SLNotSQOpt Acute
342
            //
344
            //
343
            case 5: { 
345
            case 5: { 
344
				makeToken(TK_STRING_LITERAL);
346
				makeToken(OCLBacktrackingParsersym.TK_STRING_LITERAL);
345
	            break;
347
	            break;
346
            }
348
            }
347
	 
349
	 
Lines 349-355 Link Here
349
            // Rule 6:  Token ::= IntegerLiteral
351
            // Rule 6:  Token ::= IntegerLiteral
350
            //
352
            //
351
            case 6: { 
353
            case 6: { 
352
				makeToken(TK_INTEGER_LITERAL);
354
				makeToken(OCLBacktrackingParsersym.TK_INTEGER_LITERAL);
353
	            break;
355
	            break;
354
            }
356
            }
355
	 
357
	 
Lines 357-363 Link Here
357
            // Rule 7:  Token ::= RealLiteral
359
            // Rule 7:  Token ::= RealLiteral
358
            //
360
            //
359
            case 7: { 
361
            case 7: { 
360
				makeToken(TK_REAL_LITERAL);
362
				makeToken(OCLBacktrackingParsersym.TK_REAL_LITERAL);
361
	            break;
363
	            break;
362
            }
364
            }
363
	 
365
	 
Lines 365-371 Link Here
365
            // Rule 8:  Token ::= NumericOperation
367
            // Rule 8:  Token ::= NumericOperation
366
            //
368
            //
367
            case 8: { 
369
            case 8: { 
368
				makeToken(TK_NUMERIC_OPERATION);
370
				makeToken(OCLBacktrackingParsersym.TK_NUMERIC_OPERATION);
369
	            break;
371
	            break;
370
            }
372
            }
371
	 
373
	 
Lines 373-379 Link Here
373
            // Rule 9:  Token ::= IntegerRangeStart
375
            // Rule 9:  Token ::= IntegerRangeStart
374
            //
376
            //
375
            case 9: { 
377
            case 9: { 
376
				makeToken(TK_INTEGER_RANGE_START);
378
				makeToken(OCLBacktrackingParsersym.TK_INTEGER_RANGE_START);
377
	            break;
379
	            break;
378
            }
380
            }
379
	 
381
	 
Lines 381-387 Link Here
381
            // Rule 10:  Token ::= SLC
383
            // Rule 10:  Token ::= SLC
382
            //
384
            //
383
            case 10: { 
385
            case 10: { 
384
				makeComment(TK_SINGLE_LINE_COMMENT);
386
				makeComment(OCLBacktrackingParsersym.TK_SINGLE_LINE_COMMENT);
385
	            break;
387
	            break;
386
            }
388
            }
387
	 
389
	 
Lines 389-395 Link Here
389
            // Rule 11:  Token ::= / * Inside Stars /
391
            // Rule 11:  Token ::= / * Inside Stars /
390
            //
392
            //
391
            case 11: { 
393
            case 11: { 
392
                makeComment(TK_MULTI_LINE_COMMENT);
394
                makeComment(OCLBacktrackingParsersym.TK_MULTI_LINE_COMMENT);
393
                break;
395
                break;
394
            }
396
            }
395
     
397
     
Lines 405-411 Link Here
405
            // Rule 13:  Token ::= +
407
            // Rule 13:  Token ::= +
406
            //
408
            //
407
            case 13: { 
409
            case 13: { 
408
				makeToken(TK_PLUS);
410
				makeToken(OCLBacktrackingParsersym.TK_PLUS);
409
	            break;
411
	            break;
410
            }
412
            }
411
	 
413
	 
Lines 413-419 Link Here
413
            // Rule 14:  Token ::= -
415
            // Rule 14:  Token ::= -
414
            //
416
            //
415
            case 14: { 
417
            case 14: { 
416
				makeToken(TK_MINUS);
418
				makeToken(OCLBacktrackingParsersym.TK_MINUS);
417
	            break;
419
	            break;
418
            }
420
            }
419
	 
421
	 
Lines 421-427 Link Here
421
            // Rule 15:  Token ::= *
423
            // Rule 15:  Token ::= *
422
            //
424
            //
423
            case 15: { 
425
            case 15: { 
424
				makeToken(TK_MULTIPLY);
426
				makeToken(OCLBacktrackingParsersym.TK_MULTIPLY);
425
	            break;
427
	            break;
426
            }
428
            }
427
	 
429
	 
Lines 429-435 Link Here
429
            // Rule 16:  Token ::= /
431
            // Rule 16:  Token ::= /
430
            //
432
            //
431
            case 16: { 
433
            case 16: { 
432
				makeToken(TK_DIVIDE);
434
				makeToken(OCLBacktrackingParsersym.TK_DIVIDE);
433
	            break;
435
	            break;
434
            }
436
            }
435
	 
437
	 
Lines 437-443 Link Here
437
            // Rule 17:  Token ::= (
439
            // Rule 17:  Token ::= (
438
            //
440
            //
439
            case 17: { 
441
            case 17: { 
440
				makeToken(TK_LPAREN);
442
				makeToken(OCLBacktrackingParsersym.TK_LPAREN);
441
	            break;
443
	            break;
442
            }
444
            }
443
	 
445
	 
Lines 445-451 Link Here
445
            // Rule 18:  Token ::= )
447
            // Rule 18:  Token ::= )
446
            //
448
            //
447
            case 18: { 
449
            case 18: { 
448
				makeToken(TK_RPAREN);
450
				makeToken(OCLBacktrackingParsersym.TK_RPAREN);
449
	            break;
451
	            break;
450
            }
452
            }
451
	 
453
	 
Lines 453-459 Link Here
453
            // Rule 19:  Token ::= >
455
            // Rule 19:  Token ::= >
454
            //
456
            //
455
            case 19: { 
457
            case 19: { 
456
				makeToken(TK_GREATER);
458
				makeToken(OCLBacktrackingParsersym.TK_GREATER);
457
	            break;
459
	            break;
458
            }
460
            }
459
	 
461
	 
Lines 461-467 Link Here
461
            // Rule 20:  Token ::= <
463
            // Rule 20:  Token ::= <
462
            //
464
            //
463
            case 20: { 
465
            case 20: { 
464
				makeToken(TK_LESS);
466
				makeToken(OCLBacktrackingParsersym.TK_LESS);
465
	            break;
467
	            break;
466
            }
468
            }
467
	 
469
	 
Lines 469-475 Link Here
469
            // Rule 21:  Token ::= =
471
            // Rule 21:  Token ::= =
470
            //
472
            //
471
            case 21: { 
473
            case 21: { 
472
				makeToken(TK_EQUAL);
474
				makeToken(OCLBacktrackingParsersym.TK_EQUAL);
473
	            break;
475
	            break;
474
            }
476
            }
475
	 
477
	 
Lines 477-483 Link Here
477
            // Rule 22:  Token ::= > =
479
            // Rule 22:  Token ::= > =
478
            //
480
            //
479
            case 22: { 
481
            case 22: { 
480
				makeToken(TK_GREATER_EQUAL);
482
				makeToken(OCLBacktrackingParsersym.TK_GREATER_EQUAL);
481
	            break;
483
	            break;
482
            }
484
            }
483
	 
485
	 
Lines 485-491 Link Here
485
            // Rule 23:  Token ::= < =
487
            // Rule 23:  Token ::= < =
486
            //
488
            //
487
            case 23: { 
489
            case 23: { 
488
				makeToken(TK_LESS_EQUAL);
490
				makeToken(OCLBacktrackingParsersym.TK_LESS_EQUAL);
489
	            break;
491
	            break;
490
            }
492
            }
491
	 
493
	 
Lines 493-499 Link Here
493
            // Rule 24:  Token ::= < >
495
            // Rule 24:  Token ::= < >
494
            //
496
            //
495
            case 24: { 
497
            case 24: { 
496
				makeToken(TK_NOT_EQUAL);
498
				makeToken(OCLBacktrackingParsersym.TK_NOT_EQUAL);
497
	            break;
499
	            break;
498
            }
500
            }
499
	 
501
	 
Lines 501-507 Link Here
501
            // Rule 25:  Token ::= [
503
            // Rule 25:  Token ::= [
502
            //
504
            //
503
            case 25: { 
505
            case 25: { 
504
				makeToken(TK_LBRACKET);
506
				makeToken(OCLBacktrackingParsersym.TK_LBRACKET);
505
	            break;
507
	            break;
506
            }
508
            }
507
	 
509
	 
Lines 509-515 Link Here
509
            // Rule 26:  Token ::= ]
511
            // Rule 26:  Token ::= ]
510
            //
512
            //
511
            case 26: { 
513
            case 26: { 
512
				makeToken(TK_RBRACKET);
514
				makeToken(OCLBacktrackingParsersym.TK_RBRACKET);
513
	            break;
515
	            break;
514
            }
516
            }
515
	 
517
	 
Lines 517-523 Link Here
517
            // Rule 27:  Token ::= {
519
            // Rule 27:  Token ::= {
518
            //
520
            //
519
            case 27: { 
521
            case 27: { 
520
				makeToken(TK_LBRACE);
522
				makeToken(OCLBacktrackingParsersym.TK_LBRACE);
521
	            break;
523
	            break;
522
            }
524
            }
523
	 
525
	 
Lines 525-531 Link Here
525
            // Rule 28:  Token ::= }
527
            // Rule 28:  Token ::= }
526
            //
528
            //
527
            case 28: { 
529
            case 28: { 
528
				makeToken(TK_RBRACE);
530
				makeToken(OCLBacktrackingParsersym.TK_RBRACE);
529
	            break;
531
	            break;
530
            }
532
            }
531
	 
533
	 
Lines 533-539 Link Here
533
            // Rule 29:  Token ::= - >
535
            // Rule 29:  Token ::= - >
534
            //
536
            //
535
            case 29: { 
537
            case 29: { 
536
				makeToken(TK_ARROW);
538
				makeToken(OCLBacktrackingParsersym.TK_ARROW);
537
	            break;
539
	            break;
538
            }
540
            }
539
	 
541
	 
Lines 541-547 Link Here
541
            // Rule 30:  Token ::= |
543
            // Rule 30:  Token ::= |
542
            //
544
            //
543
            case 30: { 
545
            case 30: { 
544
				makeToken(TK_BAR);
546
				makeToken(OCLBacktrackingParsersym.TK_BAR);
545
	            break;
547
	            break;
546
            }
548
            }
547
	 
549
	 
Lines 549-555 Link Here
549
            // Rule 31:  Token ::= ,
551
            // Rule 31:  Token ::= ,
550
            //
552
            //
551
            case 31: { 
553
            case 31: { 
552
				makeToken(TK_COMMA);
554
				makeToken(OCLBacktrackingParsersym.TK_COMMA);
553
	            break;
555
	            break;
554
            }
556
            }
555
	 
557
	 
Lines 557-563 Link Here
557
            // Rule 32:  Token ::= :
559
            // Rule 32:  Token ::= :
558
            //
560
            //
559
            case 32: { 
561
            case 32: { 
560
				makeToken(TK_COLON);
562
				makeToken(OCLBacktrackingParsersym.TK_COLON);
561
	            break;
563
	            break;
562
            }
564
            }
563
	 
565
	 
Lines 565-571 Link Here
565
            // Rule 33:  Token ::= : :
567
            // Rule 33:  Token ::= : :
566
            //
568
            //
567
            case 33: { 
569
            case 33: { 
568
				makeToken(TK_COLONCOLON);
570
				makeToken(OCLBacktrackingParsersym.TK_COLONCOLON);
569
	            break;
571
	            break;
570
            }
572
            }
571
	 
573
	 
Lines 573-579 Link Here
573
            // Rule 34:  Token ::= ;
575
            // Rule 34:  Token ::= ;
574
            //
576
            //
575
            case 34: { 
577
            case 34: { 
576
				makeToken(TK_SEMICOLON);
578
				makeToken(OCLBacktrackingParsersym.TK_SEMICOLON);
577
	            break;
579
	            break;
578
            }
580
            }
579
	 
581
	 
Lines 581-587 Link Here
581
            // Rule 35:  Token ::= .
583
            // Rule 35:  Token ::= .
582
            //
584
            //
583
            case 35: { 
585
            case 35: { 
584
				makeToken(TK_DOT);
586
				makeToken(OCLBacktrackingParsersym.TK_DOT);
585
	            break;
587
	            break;
586
            }
588
            }
587
	 
589
	 
Lines 589-595 Link Here
589
            // Rule 36:  Token ::= . .
591
            // Rule 36:  Token ::= . .
590
            //
592
            //
591
            case 36: { 
593
            case 36: { 
592
				makeToken(TK_DOTDOT);
594
				makeToken(OCLBacktrackingParsersym.TK_DOTDOT);
593
	            break;
595
	            break;
594
            }
596
            }
595
	 
597
	 
Lines 597-603 Link Here
597
            // Rule 37:  Token ::= @ p r e
599
            // Rule 37:  Token ::= @ p r e
598
            //
600
            //
599
            case 37: { 
601
            case 37: { 
600
				makeToken(TK_ATPRE);
602
				makeToken(OCLBacktrackingParsersym.TK_ATPRE);
601
	            break;
603
	            break;
602
            }
604
            }
603
	 
605
	 
Lines 605-611 Link Here
605
            // Rule 38:  Token ::= ^
607
            // Rule 38:  Token ::= ^
606
            //
608
            //
607
            case 38: { 
609
            case 38: { 
608
				makeToken(TK_CARET);
610
				makeToken(OCLBacktrackingParsersym.TK_CARET);
609
	            break;
611
	            break;
610
            }
612
            }
611
	 
613
	 
Lines 613-619 Link Here
613
            // Rule 39:  Token ::= ^ ^
615
            // Rule 39:  Token ::= ^ ^
614
            //
616
            //
615
            case 39: { 
617
            case 39: { 
616
				makeToken(TK_CARETCARET);
618
				makeToken(OCLBacktrackingParsersym.TK_CARETCARET);
617
	            break;
619
	            break;
618
            }
620
            }
619
	 
621
	 
Lines 621-627 Link Here
621
            // Rule 40:  Token ::= ?
623
            // Rule 40:  Token ::= ?
622
            //
624
            //
623
            case 40: { 
625
            case 40: { 
624
				makeToken(TK_QUESTIONMARK);
626
				makeToken(OCLBacktrackingParsersym.TK_QUESTIONMARK);
625
	            break;
627
	            break;
626
            }
628
            }
627
	
629
	
(-)src/org/eclipse/ocl/parser/backtracking/OCLBacktrackingKWLexersym.java (-17 / +24 lines)
Lines 1-7 Link Here
1
/**
1
/**
2
* <copyright>
2
* <copyright>
3
*
3
*
4
* Copyright (c) 2005, 2007 IBM Corporation and others.
4
* Copyright (c) 2005, 2009 IBM Corporation 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-19 Link Here
10
* Contributors:
10
* Contributors:
11
*   IBM - Initial API and implementation
11
*   IBM - Initial API and implementation
12
*   E.D.Willink - Lexer and Parser refactoring to support extensibility and flexible error handling
12
*   E.D.Willink - Lexer and Parser refactoring to support extensibility and flexible error handling
13
*   E.D.Willink - Bug 285633 static definitions
14
*   Adolfo Sanchez-Barbudo Herrera (Open Canarias) - LPG v 2.0.17 adoption (242153)
13
*
15
*
14
* </copyright>
16
* </copyright>
15
*
17
*
16
* $Id: OCLBacktrackingKWLexersym.java,v 1.5 2009/09/04 13:40:44 ewillink Exp $
18
* 
17
*/
19
*/
18
20
19
package org.eclipse.ocl.parser.backtracking;
21
package org.eclipse.ocl.parser.backtracking;
Lines 30-35 Link Here
30
public interface OCLBacktrackingKWLexersym {
32
public interface OCLBacktrackingKWLexersym {
31
    public final static int
33
    public final static int
32
      Char_DollarSign = 40,
34
      Char_DollarSign = 40,
35
      Char_Percent = 41,
36
      Char__ = 42,
33
      Char_a = 5,
37
      Char_a = 5,
34
      Char_b = 30,
38
      Char_b = 30,
35
      Char_c = 11,
39
      Char_c = 11,
Lines 55-90 Link Here
55
      Char_w = 33,
59
      Char_w = 33,
56
      Char_x = 19,
60
      Char_x = 19,
57
      Char_y = 16,
61
      Char_y = 16,
58
      Char_z = 41,
62
      Char_z = 43,
59
      Char_A = 20,
63
      Char_A = 20,
60
      Char_B = 29,
64
      Char_B = 29,
61
      Char_C = 34,
65
      Char_C = 34,
62
      Char_D = 42,
66
      Char_D = 44,
63
      Char_E = 43,
67
      Char_E = 45,
64
      Char_F = 44,
68
      Char_F = 46,
65
      Char_G = 45,
69
      Char_G = 47,
66
      Char_H = 46,
70
      Char_H = 48,
67
      Char_I = 17,
71
      Char_I = 17,
68
      Char_J = 47,
72
      Char_J = 49,
69
      Char_K = 35,
73
      Char_K = 35,
70
      Char_L = 48,
74
      Char_L = 50,
71
      Char_M = 36,
75
      Char_M = 36,
72
      Char_N = 21,
76
      Char_N = 21,
73
      Char_O = 22,
77
      Char_O = 22,
74
      Char_P = 49,
78
      Char_P = 51,
75
      Char_Q = 50,
79
      Char_Q = 52,
76
      Char_R = 37,
80
      Char_R = 37,
77
      Char_S = 23,
81
      Char_S = 23,
78
      Char_T = 24,
82
      Char_T = 24,
79
      Char_U = 25,
83
      Char_U = 25,
80
      Char_V = 38,
84
      Char_V = 38,
81
      Char_W = 51,
85
      Char_W = 53,
82
      Char_X = 52,
86
      Char_X = 54,
83
      Char_Y = 53,
87
      Char_Y = 55,
84
      Char_Z = 54,
88
      Char_Z = 56,
85
      Char_EOF = 39;
89
      Char_EOF = 39;
86
90
87
      public final static String orderedTerminalSymbols[] = {
91
    public final static String orderedTerminalSymbols[] = {
88
                 "",
92
                 "",
89
                 "e",
93
                 "e",
90
                 "t",
94
                 "t",
Lines 126-131 Link Here
126
                 "V",
130
                 "V",
127
                 "EOF",
131
                 "EOF",
128
                 "DollarSign",
132
                 "DollarSign",
133
                 "Percent",
134
                 "_",
129
                 "z",
135
                 "z",
130
                 "D",
136
                 "D",
131
                 "E",
137
                 "E",
Lines 142-146 Link Here
142
                 "Z"
148
                 "Z"
143
             };
149
             };
144
150
151
    public final static int numTokenKinds = orderedTerminalSymbols.length;
145
    public final static boolean isValidForParser = true;
152
    public final static boolean isValidForParser = true;
146
}
153
}
(-)src/org/eclipse/ocl/parser/backtracking/OCLBacktrackingParser.java (-10 / +12 lines)
Lines 12-22 Link Here
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
14
*   E.D.Willink - Bugs 225493, 243976, 259818, 282882, 287993
14
*   E.D.Willink - Bugs 225493, 243976, 259818, 282882, 287993
15
*   Zeligsoft - Bug 243976
15
*   Borland - Bug 242880
16
*   Borland - Bug 242880
17
*   Adolfo Sanchez-Barbudo Herrera (Open Canarias) - LPG v 2.0.17 adoption (242153)
16
*
18
*
17
* </copyright>
19
* </copyright>
18
*
20
*
19
* $Id: OCLBacktrackingParser.java,v 1.7 2009/09/04 13:40:44 ewillink Exp $
21
* $Id: EssentialOCL.g,v 1.7 2009/03/05 14:12:14 cdamus Exp $
20
*/
22
*/
21
23
22
package org.eclipse.ocl.parser.backtracking;
24
package org.eclipse.ocl.parser.backtracking;
Lines 43-57 Link Here
43
import org.eclipse.ocl.util.OCLStandardLibraryUtil;
45
import org.eclipse.ocl.util.OCLStandardLibraryUtil;
44
import org.eclipse.ocl.utilities.PredefinedType;
46
import org.eclipse.ocl.utilities.PredefinedType;
45
47
46
import lpg.lpgjavaruntime.BadParseException;
48
import lpg.runtime.BadParseException;
47
import lpg.lpgjavaruntime.BadParseSymFileException;
49
import lpg.runtime.BadParseSymFileException;
48
import lpg.lpgjavaruntime.BacktrackingParser;
50
import lpg.runtime.BacktrackingParser;
49
import lpg.lpgjavaruntime.DiagnoseParser;
51
import lpg.runtime.DiagnoseParser;
50
import lpg.lpgjavaruntime.IToken;
52
import lpg.runtime.IToken;
51
import lpg.lpgjavaruntime.Monitor;
53
import lpg.runtime.Monitor;
52
import lpg.lpgjavaruntime.NotBacktrackParseTableException;
54
import lpg.runtime.NotBacktrackParseTableException;
53
import lpg.lpgjavaruntime.ParseTable;
55
import lpg.runtime.ParseTable;
54
import lpg.lpgjavaruntime.RuleAction;
56
import lpg.runtime.RuleAction;
55
57
56
import org.eclipse.ocl.Environment;
58
import org.eclipse.ocl.Environment;
57
import org.eclipse.ocl.cst.DefCS;
59
import org.eclipse.ocl.cst.DefCS;
(-)src/org/eclipse/ocl/parser/backtracking/OCLBacktrackingParser.g (-10 / +12 lines)
Lines 9-14 Link Here
9
-- *
9
-- *
10
-- * Contributors:
10
-- * Contributors:
11
-- *   E.D. Willink - Initial API and implementation
11
-- *   E.D. Willink - Initial API and implementation
12
-- *   Adolfo Sanchez-Barbudo Herrera (Open Canarias) - LPG v 2.0.17 adoption (242153)
12
-- *
13
-- *
13
-- * </copyright>
14
-- * </copyright>
14
-- *
15
-- *
Lines 33-59 Link Here
33
%options backtrack
34
%options backtrack
34
%options noserialize
35
%options noserialize
35
%options package=org.eclipse.ocl.parser.backtracking
36
%options package=org.eclipse.ocl.parser.backtracking
36
%options import_terminals=OCLBacktrackingLexer.g
37
%options import_terminals=OCLBacktrackingLexer.gi
37
%options ast_type=CSTNode
38
%options ast_type=CSTNode
38
%options programming_language=java
39
%options programming_language=java
39
%options action=("*.java", "/.", "./")
40
%options action-block=("*.java", "/.", "./")
40
%options ParseTable=lpg.lpgjavaruntime.ParseTable
41
%options ParseTable=lpg.runtime.ParseTable
41
%options include_directory=".;..;../../lpg"
42
%options include_directory=".;..;../../lpg"
42
43
43
$Include
44
%Import
44
	OCLParserErrors.g
45
	OCLParserErrors.gi
45
$End
46
%End
46
47
47
$Globals
48
%Globals
48
	/.
49
	/.
49
		import org.eclipse.ocl.parser.AbstractOCLParser;
50
		import org.eclipse.ocl.parser.AbstractOCLParser;
50
	./
51
	./
51
$End
52
%End
52
53
53
$Define
54
%Define
54
	$lex_stream_class /.OCLBacktrackingLexer./
55
	$lex_stream_class /.OCLBacktrackingLexer./
55
	$prs_parser_class /.BacktrackingParser./
56
	$prs_parser_class /.BacktrackingParser./
56
	$prs_parser_exception /.NotBacktrackParseTableException./
57
	$prs_parser_exception /.NotBacktrackParseTableException./
57
	$prs_parser_throw /.throw new RuntimeException("****Error: Regenerate $prs_type.java with -BACKTRACK option")./
58
	$prs_parser_throw /.throw new RuntimeException("****Error: Regenerate $prs_type.java with -BACKTRACK option")./
58
	$prs_parse_args /.error_repair_count./
59
	$prs_parse_args /.error_repair_count./
59
$End
60
%End
61
(-)src/org/eclipse/ocl/parser/backtracking/OCLBacktrackingLexersym.java (-3 / +6 lines)
Lines 1-7 Link Here
1
/**
1
/**
2
* <copyright>
2
* <copyright>
3
*
3
*
4
* Copyright (c) 2005, 2009 IBM Corporation, Borland Software Corp.,  and others.
4
* Copyright (c) 2005, 2009 IBM Corporation, Borland Software Corp. 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-20 Link Here
10
* Contributors:
10
* Contributors:
11
*   IBM - Initial API and implementation
11
*   IBM - Initial API and implementation
12
*   E.D.Willink - Lexer and Parser refactoring to support extensibility and flexible error handling
12
*   E.D.Willink - Lexer and Parser refactoring to support extensibility and flexible error handling
13
*               - Bug 259818
13
*   Borland - Bug 242880
14
*   Borland - Bug 242880
15
*   Adolfo Sanchez-Barbudo Herrera (Open Canarias) - LPG v 2.0.17 adoption (242153)
14
*
16
*
15
* </copyright>
17
* </copyright>
16
*
18
*
17
* $Id: OCLBacktrackingLexersym.java,v 1.5 2009/09/04 13:40:44 ewillink Exp $
19
* $Id: OCLLexer.g,v 1.3 2009/08/28 20:43:11 ewillink Exp $
18
*/
20
*/
19
21
20
package org.eclipse.ocl.parser.backtracking;
22
package org.eclipse.ocl.parser.backtracking;
Lines 134-140 Link Here
134
      Char_Equal = 15,
136
      Char_Equal = 15,
135
      Char_EOF = 99;
137
      Char_EOF = 99;
136
138
137
      public final static String orderedTerminalSymbols[] = {
139
    public final static String orderedTerminalSymbols[] = {
138
                 "",
140
                 "",
139
                 "0",
141
                 "0",
140
                 "1",
142
                 "1",
Lines 241-245 Link Here
241
                 "CtlCharNotWS"
243
                 "CtlCharNotWS"
242
             };
244
             };
243
245
246
    public final static int numTokenKinds = orderedTerminalSymbols.length;
244
    public final static boolean isValidForParser = true;
247
    public final static boolean isValidForParser = true;
245
}
248
}
(-)src/org/eclipse/ocl/parser/backtracking/OCLBacktrackingKWLexer.java (-124 / +191 lines)
Lines 1-7 Link Here
1
/**
1
/**
2
* <copyright>
2
* <copyright>
3
*
3
*
4
* Copyright (c) 2005, 2007 IBM Corporation and others.
4
* Copyright (c) 2005, 2009 IBM Corporation 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-19 Link Here
10
* Contributors:
10
* Contributors:
11
*   IBM - Initial API and implementation
11
*   IBM - Initial API and implementation
12
*   E.D.Willink - Lexer and Parser refactoring to support extensibility and flexible error handling
12
*   E.D.Willink - Lexer and Parser refactoring to support extensibility and flexible error handling
13
*   E.D.Willink - Bug 285633 static definitions
14
*   Adolfo Sanchez-Barbudo Herrera (Open Canarias) - LPG v 2.0.17 adoption (242153)
13
*
15
*
14
* </copyright>
16
* </copyright>
15
*
17
*
16
* $Id: OCLBacktrackingKWLexer.java,v 1.6 2009/09/04 13:40:44 ewillink Exp $
18
* 
17
*/
19
*/
18
20
19
package org.eclipse.ocl.parser.backtracking;
21
package org.eclipse.ocl.parser.backtracking;
Lines 57-122 Link Here
57
    final static int tokenKind[] = new int[128];
59
    final static int tokenKind[] = new int[128];
58
    static
60
    static
59
    {
61
    {
60
        tokenKind['$'] = Char_DollarSign;
62
        tokenKind['$'] = OCLBacktrackingKWLexersym.Char_DollarSign;
61
63
        tokenKind['%'] = OCLBacktrackingKWLexersym.Char_Percent;
62
        tokenKind['a'] = Char_a;
64
        tokenKind['_'] = OCLBacktrackingKWLexersym.Char__;
63
        tokenKind['b'] = Char_b;
65
64
        tokenKind['c'] = Char_c;
66
        tokenKind['a'] = OCLBacktrackingKWLexersym.Char_a;
65
        tokenKind['d'] = Char_d;
67
        tokenKind['b'] = OCLBacktrackingKWLexersym.Char_b;
66
        tokenKind['e'] = Char_e;
68
        tokenKind['c'] = OCLBacktrackingKWLexersym.Char_c;
67
        tokenKind['f'] = Char_f;
69
        tokenKind['d'] = OCLBacktrackingKWLexersym.Char_d;
68
        tokenKind['g'] = Char_g;
70
        tokenKind['e'] = OCLBacktrackingKWLexersym.Char_e;
69
        tokenKind['h'] = Char_h;
71
        tokenKind['f'] = OCLBacktrackingKWLexersym.Char_f;
70
        tokenKind['i'] = Char_i;
72
        tokenKind['g'] = OCLBacktrackingKWLexersym.Char_g;
71
        tokenKind['j'] = Char_j;
73
        tokenKind['h'] = OCLBacktrackingKWLexersym.Char_h;
72
        tokenKind['k'] = Char_k;
74
        tokenKind['i'] = OCLBacktrackingKWLexersym.Char_i;
73
        tokenKind['l'] = Char_l;
75
        tokenKind['j'] = OCLBacktrackingKWLexersym.Char_j;
74
        tokenKind['m'] = Char_m;
76
        tokenKind['k'] = OCLBacktrackingKWLexersym.Char_k;
75
        tokenKind['n'] = Char_n;
77
        tokenKind['l'] = OCLBacktrackingKWLexersym.Char_l;
76
        tokenKind['o'] = Char_o;
78
        tokenKind['m'] = OCLBacktrackingKWLexersym.Char_m;
77
        tokenKind['p'] = Char_p;
79
        tokenKind['n'] = OCLBacktrackingKWLexersym.Char_n;
78
        tokenKind['q'] = Char_q;
80
        tokenKind['o'] = OCLBacktrackingKWLexersym.Char_o;
79
        tokenKind['r'] = Char_r;
81
        tokenKind['p'] = OCLBacktrackingKWLexersym.Char_p;
80
        tokenKind['s'] = Char_s;
82
        tokenKind['q'] = OCLBacktrackingKWLexersym.Char_q;
81
        tokenKind['t'] = Char_t;
83
        tokenKind['r'] = OCLBacktrackingKWLexersym.Char_r;
82
        tokenKind['u'] = Char_u;
84
        tokenKind['s'] = OCLBacktrackingKWLexersym.Char_s;
83
        tokenKind['v'] = Char_v;
85
        tokenKind['t'] = OCLBacktrackingKWLexersym.Char_t;
84
        tokenKind['w'] = Char_w;
86
        tokenKind['u'] = OCLBacktrackingKWLexersym.Char_u;
85
        tokenKind['x'] = Char_x;
87
        tokenKind['v'] = OCLBacktrackingKWLexersym.Char_v;
86
        tokenKind['y'] = Char_y;
88
        tokenKind['w'] = OCLBacktrackingKWLexersym.Char_w;
87
        tokenKind['z'] = Char_z;
89
        tokenKind['x'] = OCLBacktrackingKWLexersym.Char_x;
88
90
        tokenKind['y'] = OCLBacktrackingKWLexersym.Char_y;
89
        tokenKind['A'] = Char_A;
91
        tokenKind['z'] = OCLBacktrackingKWLexersym.Char_z;
90
        tokenKind['B'] = Char_B;
92
91
        tokenKind['C'] = Char_C;
93
        tokenKind['A'] = OCLBacktrackingKWLexersym.Char_A;
92
        tokenKind['D'] = Char_D;
94
        tokenKind['B'] = OCLBacktrackingKWLexersym.Char_B;
93
        tokenKind['E'] = Char_E;
95
        tokenKind['C'] = OCLBacktrackingKWLexersym.Char_C;
94
        tokenKind['F'] = Char_F;
96
        tokenKind['D'] = OCLBacktrackingKWLexersym.Char_D;
95
        tokenKind['G'] = Char_G;
97
        tokenKind['E'] = OCLBacktrackingKWLexersym.Char_E;
96
        tokenKind['H'] = Char_H;
98
        tokenKind['F'] = OCLBacktrackingKWLexersym.Char_F;
97
        tokenKind['I'] = Char_I;
99
        tokenKind['G'] = OCLBacktrackingKWLexersym.Char_G;
98
        tokenKind['J'] = Char_J;
100
        tokenKind['H'] = OCLBacktrackingKWLexersym.Char_H;
99
        tokenKind['K'] = Char_K;
101
        tokenKind['I'] = OCLBacktrackingKWLexersym.Char_I;
100
        tokenKind['L'] = Char_L;
102
        tokenKind['J'] = OCLBacktrackingKWLexersym.Char_J;
101
        tokenKind['M'] = Char_M;
103
        tokenKind['K'] = OCLBacktrackingKWLexersym.Char_K;
102
        tokenKind['N'] = Char_N;
104
        tokenKind['L'] = OCLBacktrackingKWLexersym.Char_L;
103
        tokenKind['O'] = Char_O;
105
        tokenKind['M'] = OCLBacktrackingKWLexersym.Char_M;
104
        tokenKind['P'] = Char_P;
106
        tokenKind['N'] = OCLBacktrackingKWLexersym.Char_N;
105
        tokenKind['Q'] = Char_Q;
107
        tokenKind['O'] = OCLBacktrackingKWLexersym.Char_O;
106
        tokenKind['R'] = Char_R;
108
        tokenKind['P'] = OCLBacktrackingKWLexersym.Char_P;
107
        tokenKind['S'] = Char_S;
109
        tokenKind['Q'] = OCLBacktrackingKWLexersym.Char_Q;
108
        tokenKind['T'] = Char_T;
110
        tokenKind['R'] = OCLBacktrackingKWLexersym.Char_R;
109
        tokenKind['U'] = Char_U;
111
        tokenKind['S'] = OCLBacktrackingKWLexersym.Char_S;
110
        tokenKind['V'] = Char_V;
112
        tokenKind['T'] = OCLBacktrackingKWLexersym.Char_T;
111
        tokenKind['W'] = Char_W;
113
        tokenKind['U'] = OCLBacktrackingKWLexersym.Char_U;
112
        tokenKind['X'] = Char_X;
114
        tokenKind['V'] = OCLBacktrackingKWLexersym.Char_V;
113
        tokenKind['Y'] = Char_Y;
115
        tokenKind['W'] = OCLBacktrackingKWLexersym.Char_W;
114
        tokenKind['Z'] = Char_Z;
116
        tokenKind['X'] = OCLBacktrackingKWLexersym.Char_X;
117
        tokenKind['Y'] = OCLBacktrackingKWLexersym.Char_Y;
118
        tokenKind['Z'] = OCLBacktrackingKWLexersym.Char_Z;
115
    };
119
    };
116
120
117
    final int getKind(char c)
121
    final int getKind(int c)
118
    {
122
    {
119
        return (c < 128 ? tokenKind[c] : 0);
123
        return (((c & 0xFFFFFF80) == 0) /* 0 <= c < 128? */ ? tokenKind[c] : 0);
120
    }
124
    }
121
125
122
126
Lines 128-515 Link Here
128
        //
132
        //
129
        // Rule 1:  KeyWord ::= s e l f
133
        // Rule 1:  KeyWord ::= s e l f
130
        //
134
        //
131
		keywordKind[1] = (TK_self);
135
        
136
		keywordKind[1] = (OCLBacktrackingParsersym.TK_self);
132
	  
137
	  
133
	
138
	
134
        //
139
        //
135
        // Rule 2:  KeyWord ::= i n v
140
        // Rule 2:  KeyWord ::= i n v
136
        //
141
        //
137
		keywordKind[2] = (TK_inv);
142
        
143
		keywordKind[2] = (OCLBacktrackingParsersym.TK_inv);
138
	  
144
	  
139
	
145
	
140
        //
146
        //
141
        // Rule 3:  KeyWord ::= p r e
147
        // Rule 3:  KeyWord ::= p r e
142
        //
148
        //
143
		keywordKind[3] = (TK_pre);
149
        
150
		keywordKind[3] = (OCLBacktrackingParsersym.TK_pre);
144
	  
151
	  
145
	
152
	
146
        //
153
        //
147
        // Rule 4:  KeyWord ::= p o s t
154
        // Rule 4:  KeyWord ::= p o s t
148
        //
155
        //
149
		keywordKind[4] = (TK_post);
156
        
157
		keywordKind[4] = (OCLBacktrackingParsersym.TK_post);
150
	  
158
	  
151
	
159
	
152
        //
160
        //
153
        // Rule 5:  KeyWord ::= b o d y
161
        // Rule 5:  KeyWord ::= b o d y
154
        //
162
        //
155
		keywordKind[5] = (TK_body);
163
        
164
		keywordKind[5] = (OCLBacktrackingParsersym.TK_body);
156
	  
165
	  
157
	
166
	
158
        //
167
        //
159
        // Rule 6:  KeyWord ::= c o n t e x t
168
        // Rule 6:  KeyWord ::= c o n t e x t
160
        //
169
        //
161
		keywordKind[6] = (TK_context);
170
        
171
		keywordKind[6] = (OCLBacktrackingParsersym.TK_context);
162
	  
172
	  
163
	
173
	
164
        //
174
        //
165
        // Rule 7:  KeyWord ::= p a c k a g e
175
        // Rule 7:  KeyWord ::= p a c k a g e
166
        //
176
        //
167
		keywordKind[7] = (TK_package);
177
        
178
		keywordKind[7] = (OCLBacktrackingParsersym.TK_package);
168
	  
179
	  
169
	
180
	
170
        //
181
        //
171
        // Rule 8:  KeyWord ::= e n d p a c k a g e
182
        // Rule 8:  KeyWord ::= e n d p a c k a g e
172
        //
183
        //
173
		keywordKind[8] = (TK_endpackage);
184
        
185
		keywordKind[8] = (OCLBacktrackingParsersym.TK_endpackage);
174
	  
186
	  
175
	
187
	
176
        //
188
        //
177
        // Rule 9:  KeyWord ::= d e f
189
        // Rule 9:  KeyWord ::= d e f
178
        //
190
        //
179
		keywordKind[9] = (TK_def);
191
        
192
		keywordKind[9] = (OCLBacktrackingParsersym.TK_def);
180
	  
193
	  
181
	
194
	
182
        //
195
        //
183
        // Rule 10:  KeyWord ::= d e r i v e
196
        // Rule 10:  KeyWord ::= d e r i v e
184
        //
197
        //
185
		keywordKind[10] = (TK_derive);
198
        
199
		keywordKind[10] = (OCLBacktrackingParsersym.TK_derive);
186
	  
200
	  
187
	
201
	
188
        //
202
        //
189
        // Rule 11:  KeyWord ::= i n i t
203
        // Rule 11:  KeyWord ::= i n i t
190
        //
204
        //
191
		keywordKind[11] = (TK_init);
205
        
206
		keywordKind[11] = (OCLBacktrackingParsersym.TK_init);
192
	  
207
	  
193
	
208
	
194
        //
209
        //
195
        // Rule 12:  KeyWord ::= i f
210
        // Rule 12:  KeyWord ::= i f
196
        //
211
        //
197
		keywordKind[12] = (TK_if);
212
        
213
		keywordKind[12] = (OCLBacktrackingParsersym.TK_if);
198
	  
214
	  
199
	
215
	
200
        //
216
        //
201
        // Rule 13:  KeyWord ::= t h e n
217
        // Rule 13:  KeyWord ::= t h e n
202
        //
218
        //
203
		keywordKind[13] = (TK_then);
219
        
220
		keywordKind[13] = (OCLBacktrackingParsersym.TK_then);
204
	  
221
	  
205
	
222
	
206
        //
223
        //
207
        // Rule 14:  KeyWord ::= e l s e
224
        // Rule 14:  KeyWord ::= e l s e
208
        //
225
        //
209
		keywordKind[14] = (TK_else);
226
        
227
		keywordKind[14] = (OCLBacktrackingParsersym.TK_else);
210
	  
228
	  
211
	
229
	
212
        //
230
        //
213
        // Rule 15:  KeyWord ::= e n d i f
231
        // Rule 15:  KeyWord ::= e n d i f
214
        //
232
        //
215
		keywordKind[15] = (TK_endif);
233
        
234
		keywordKind[15] = (OCLBacktrackingParsersym.TK_endif);
216
	  
235
	  
217
	
236
	
218
        //
237
        //
219
        // Rule 16:  KeyWord ::= a n d
238
        // Rule 16:  KeyWord ::= a n d
220
        //
239
        //
221
		keywordKind[16] = (TK_and);
240
        
241
		keywordKind[16] = (OCLBacktrackingParsersym.TK_and);
222
	  
242
	  
223
	
243
	
224
        //
244
        //
225
        // Rule 17:  KeyWord ::= o r
245
        // Rule 17:  KeyWord ::= o r
226
        //
246
        //
227
		keywordKind[17] = (TK_or);
247
        
248
		keywordKind[17] = (OCLBacktrackingParsersym.TK_or);
228
	  
249
	  
229
	
250
	
230
        //
251
        //
231
        // Rule 18:  KeyWord ::= x o r
252
        // Rule 18:  KeyWord ::= x o r
232
        //
253
        //
233
		keywordKind[18] = (TK_xor);
254
        
255
		keywordKind[18] = (OCLBacktrackingParsersym.TK_xor);
234
	  
256
	  
235
	
257
	
236
        //
258
        //
237
        // Rule 19:  KeyWord ::= n o t
259
        // Rule 19:  KeyWord ::= n o t
238
        //
260
        //
239
		keywordKind[19] = (TK_not);
261
        
262
		keywordKind[19] = (OCLBacktrackingParsersym.TK_not);
240
	  
263
	  
241
	
264
	
242
        //
265
        //
243
        // Rule 20:  KeyWord ::= i m p l i e s
266
        // Rule 20:  KeyWord ::= i m p l i e s
244
        //
267
        //
245
		keywordKind[20] = (TK_implies);
268
        
269
		keywordKind[20] = (OCLBacktrackingParsersym.TK_implies);
246
	  
270
	  
247
	
271
	
248
        //
272
        //
249
        // Rule 21:  KeyWord ::= l e t
273
        // Rule 21:  KeyWord ::= l e t
250
        //
274
        //
251
		keywordKind[21] = (TK_let);
275
        
276
		keywordKind[21] = (OCLBacktrackingParsersym.TK_let);
252
	  
277
	  
253
	
278
	
254
        //
279
        //
255
        // Rule 22:  KeyWord ::= i n
280
        // Rule 22:  KeyWord ::= i n
256
        //
281
        //
257
		keywordKind[22] = (TK_in);
282
        
283
		keywordKind[22] = (OCLBacktrackingParsersym.TK_in);
258
	  
284
	  
259
	
285
	
260
        //
286
        //
261
        // Rule 23:  KeyWord ::= t r u e
287
        // Rule 23:  KeyWord ::= t r u e
262
        //
288
        //
263
		keywordKind[23] = (TK_true);
289
        
290
		keywordKind[23] = (OCLBacktrackingParsersym.TK_true);
264
	  
291
	  
265
	
292
	
266
        //
293
        //
267
        // Rule 24:  KeyWord ::= f a l s e
294
        // Rule 24:  KeyWord ::= f a l s e
268
        //
295
        //
269
		keywordKind[24] = (TK_false);
296
        
297
		keywordKind[24] = (OCLBacktrackingParsersym.TK_false);
270
	  
298
	  
271
	
299
	
272
        //
300
        //
273
        // Rule 25:  KeyWord ::= S e t
301
        // Rule 25:  KeyWord ::= S e t
274
        //
302
        //
275
		keywordKind[25] = (TK_Set);
303
        
304
		keywordKind[25] = (OCLBacktrackingParsersym.TK_Set);
276
	  
305
	  
277
	
306
	
278
        //
307
        //
279
        // Rule 26:  KeyWord ::= B a g
308
        // Rule 26:  KeyWord ::= B a g
280
        //
309
        //
281
		keywordKind[26] = (TK_Bag);
310
        
311
		keywordKind[26] = (OCLBacktrackingParsersym.TK_Bag);
282
	  
312
	  
283
	
313
	
284
        //
314
        //
285
        // Rule 27:  KeyWord ::= S e q u e n c e
315
        // Rule 27:  KeyWord ::= S e q u e n c e
286
        //
316
        //
287
		keywordKind[27] = (TK_Sequence);
317
        
318
		keywordKind[27] = (OCLBacktrackingParsersym.TK_Sequence);
288
	  
319
	  
289
	
320
	
290
        //
321
        //
291
        // Rule 28:  KeyWord ::= C o l l e c t i o n
322
        // Rule 28:  KeyWord ::= C o l l e c t i o n
292
        //
323
        //
293
		keywordKind[28] = (TK_Collection);
324
        
325
		keywordKind[28] = (OCLBacktrackingParsersym.TK_Collection);
294
	  
326
	  
295
	
327
	
296
        //
328
        //
297
        // Rule 29:  KeyWord ::= O r d e r e d S e t
329
        // Rule 29:  KeyWord ::= O r d e r e d S e t
298
        //
330
        //
299
		keywordKind[29] = (TK_OrderedSet);
331
        
332
		keywordKind[29] = (OCLBacktrackingParsersym.TK_OrderedSet);
300
	  
333
	  
301
	
334
	
302
        //
335
        //
303
        // Rule 30:  KeyWord ::= i t e r a t e
336
        // Rule 30:  KeyWord ::= i t e r a t e
304
        //
337
        //
305
		keywordKind[30] = (TK_iterate);
338
        
339
		keywordKind[30] = (OCLBacktrackingParsersym.TK_iterate);
306
	  
340
	  
307
	
341
	
308
        //
342
        //
309
        // Rule 31:  KeyWord ::= f o r A l l
343
        // Rule 31:  KeyWord ::= f o r A l l
310
        //
344
        //
311
		keywordKind[31] = (TK_forAll);
345
        
346
		keywordKind[31] = (OCLBacktrackingParsersym.TK_forAll);
312
	  
347
	  
313
	
348
	
314
        //
349
        //
315
        // Rule 32:  KeyWord ::= e x i s t s
350
        // Rule 32:  KeyWord ::= e x i s t s
316
        //
351
        //
317
		keywordKind[32] = (TK_exists);
352
        
353
		keywordKind[32] = (OCLBacktrackingParsersym.TK_exists);
318
	  
354
	  
319
	
355
	
320
        //
356
        //
321
        // Rule 33:  KeyWord ::= i s U n i q u e
357
        // Rule 33:  KeyWord ::= i s U n i q u e
322
        //
358
        //
323
		keywordKind[33] = (TK_isUnique);
359
        
360
		keywordKind[33] = (OCLBacktrackingParsersym.TK_isUnique);
324
	  
361
	  
325
	
362
	
326
        //
363
        //
327
        // Rule 34:  KeyWord ::= a n y
364
        // Rule 34:  KeyWord ::= a n y
328
        //
365
        //
329
		keywordKind[34] = (TK_any);
366
        
367
		keywordKind[34] = (OCLBacktrackingParsersym.TK_any);
330
	  
368
	  
331
	
369
	
332
        //
370
        //
333
        // Rule 35:  KeyWord ::= o n e
371
        // Rule 35:  KeyWord ::= o n e
334
        //
372
        //
335
		keywordKind[35] = (TK_one);
373
        
374
		keywordKind[35] = (OCLBacktrackingParsersym.TK_one);
336
	  
375
	  
337
	
376
	
338
        //
377
        //
339
        // Rule 36:  KeyWord ::= c o l l e c t
378
        // Rule 36:  KeyWord ::= c o l l e c t
340
        //
379
        //
341
		keywordKind[36] = (TK_collect);
380
        
381
		keywordKind[36] = (OCLBacktrackingParsersym.TK_collect);
342
	  
382
	  
343
	
383
	
344
        //
384
        //
345
        // Rule 37:  KeyWord ::= s e l e c t
385
        // Rule 37:  KeyWord ::= s e l e c t
346
        //
386
        //
347
		keywordKind[37] = (TK_select);
387
        
388
		keywordKind[37] = (OCLBacktrackingParsersym.TK_select);
348
	  
389
	  
349
	
390
	
350
        //
391
        //
351
        // Rule 38:  KeyWord ::= r e j e c t
392
        // Rule 38:  KeyWord ::= r e j e c t
352
        //
393
        //
353
		keywordKind[38] = (TK_reject);
394
        
395
		keywordKind[38] = (OCLBacktrackingParsersym.TK_reject);
354
	  
396
	  
355
	
397
	
356
        //
398
        //
357
        // Rule 39:  KeyWord ::= c o l l e c t N e s t e d
399
        // Rule 39:  KeyWord ::= c o l l e c t N e s t e d
358
        //
400
        //
359
		keywordKind[39] = (TK_collectNested);
401
        
402
		keywordKind[39] = (OCLBacktrackingParsersym.TK_collectNested);
360
	  
403
	  
361
	
404
	
362
        //
405
        //
363
        // Rule 40:  KeyWord ::= s o r t e d B y
406
        // Rule 40:  KeyWord ::= s o r t e d B y
364
        //
407
        //
365
		keywordKind[40] = (TK_sortedBy);
408
        
409
		keywordKind[40] = (OCLBacktrackingParsersym.TK_sortedBy);
366
	  
410
	  
367
	
411
	
368
        //
412
        //
369
        // Rule 41:  KeyWord ::= c l o s u r e
413
        // Rule 41:  KeyWord ::= c l o s u r e
370
        //
414
        //
371
		keywordKind[41] = (TK_closure);
415
        
416
		keywordKind[41] = (OCLBacktrackingParsersym.TK_closure);
372
	  
417
	  
373
	
418
	
374
        //
419
        //
375
        // Rule 42:  KeyWord ::= o c l I s K i n d O f
420
        // Rule 42:  KeyWord ::= o c l I s K i n d O f
376
        //
421
        //
377
		keywordKind[42] = (TK_oclIsKindOf);
422
        
423
		keywordKind[42] = (OCLBacktrackingParsersym.TK_oclIsKindOf);
378
	  
424
	  
379
	
425
	
380
        //
426
        //
381
        // Rule 43:  KeyWord ::= o c l I s T y p e O f
427
        // Rule 43:  KeyWord ::= o c l I s T y p e O f
382
        //
428
        //
383
		keywordKind[43] = (TK_oclIsTypeOf);
429
        
430
		keywordKind[43] = (OCLBacktrackingParsersym.TK_oclIsTypeOf);
384
	  
431
	  
385
	
432
	
386
        //
433
        //
387
        // Rule 44:  KeyWord ::= o c l A s T y p e
434
        // Rule 44:  KeyWord ::= o c l A s T y p e
388
        //
435
        //
389
		keywordKind[44] = (TK_oclAsType);
436
        
437
		keywordKind[44] = (OCLBacktrackingParsersym.TK_oclAsType);
390
	  
438
	  
391
	
439
	
392
        //
440
        //
393
        // Rule 45:  KeyWord ::= o c l I s N e w
441
        // Rule 45:  KeyWord ::= o c l I s N e w
394
        //
442
        //
395
		keywordKind[45] = (TK_oclIsNew);
443
        
444
		keywordKind[45] = (OCLBacktrackingParsersym.TK_oclIsNew);
396
	  
445
	  
397
	
446
	
398
        //
447
        //
399
        // Rule 46:  KeyWord ::= o c l I s U n d e f i n e d
448
        // Rule 46:  KeyWord ::= o c l I s U n d e f i n e d
400
        //
449
        //
401
		keywordKind[46] = (TK_oclIsUndefined);
450
        
451
		keywordKind[46] = (OCLBacktrackingParsersym.TK_oclIsUndefined);
402
	  
452
	  
403
	
453
	
404
        //
454
        //
405
        // Rule 47:  KeyWord ::= o c l I s I n v a l i d
455
        // Rule 47:  KeyWord ::= o c l I s I n v a l i d
406
        //
456
        //
407
		keywordKind[47] = (TK_oclIsInvalid);
457
        
458
		keywordKind[47] = (OCLBacktrackingParsersym.TK_oclIsInvalid);
408
	  
459
	  
409
	
460
	
410
        //
461
        //
411
        // Rule 48:  KeyWord ::= o c l I s I n S t a t e
462
        // Rule 48:  KeyWord ::= o c l I s I n S t a t e
412
        //
463
        //
413
		keywordKind[48] = (TK_oclIsInState);
464
        
465
		keywordKind[48] = (OCLBacktrackingParsersym.TK_oclIsInState);
414
	  
466
	  
415
	
467
	
416
        //
468
        //
417
        // Rule 49:  KeyWord ::= a l l I n s t a n c e s
469
        // Rule 49:  KeyWord ::= a l l I n s t a n c e s
418
        //
470
        //
419
		keywordKind[49] = (TK_allInstances);
471
        
472
		keywordKind[49] = (OCLBacktrackingParsersym.TK_allInstances);
420
	  
473
	  
421
	
474
	
422
        //
475
        //
423
        // Rule 50:  KeyWord ::= S t r i n g
476
        // Rule 50:  KeyWord ::= S t r i n g
424
        //
477
        //
425
		keywordKind[50] = (TK_String);
478
        
479
		keywordKind[50] = (OCLBacktrackingParsersym.TK_String);
426
	  
480
	  
427
	
481
	
428
        //
482
        //
429
        // Rule 51:  KeyWord ::= I n t e g e r
483
        // Rule 51:  KeyWord ::= I n t e g e r
430
        //
484
        //
431
		keywordKind[51] = (TK_Integer);
485
        
486
		keywordKind[51] = (OCLBacktrackingParsersym.TK_Integer);
432
	  
487
	  
433
	
488
	
434
        //
489
        //
435
        // Rule 52:  KeyWord ::= U n l i m i t e d N a t u r a l
490
        // Rule 52:  KeyWord ::= U n l i m i t e d N a t u r a l
436
        //
491
        //
437
		keywordKind[52] = (TK_UnlimitedNatural);
492
        
493
		keywordKind[52] = (OCLBacktrackingParsersym.TK_UnlimitedNatural);
438
	  
494
	  
439
	
495
	
440
        //
496
        //
441
        // Rule 53:  KeyWord ::= R e a l
497
        // Rule 53:  KeyWord ::= R e a l
442
        //
498
        //
443
		keywordKind[53] = (TK_Real);
499
        
500
		keywordKind[53] = (OCLBacktrackingParsersym.TK_Real);
444
	  
501
	  
445
	
502
	
446
        //
503
        //
447
        // Rule 54:  KeyWord ::= B o o l e a n
504
        // Rule 54:  KeyWord ::= B o o l e a n
448
        //
505
        //
449
		keywordKind[54] = (TK_Boolean);
506
        
507
		keywordKind[54] = (OCLBacktrackingParsersym.TK_Boolean);
450
	  
508
	  
451
	
509
	
452
        //
510
        //
453
        // Rule 55:  KeyWord ::= T u p l e
511
        // Rule 55:  KeyWord ::= T u p l e
454
        //
512
        //
455
		keywordKind[55] = (TK_Tuple);
513
        
514
		keywordKind[55] = (OCLBacktrackingParsersym.TK_Tuple);
456
	  
515
	  
457
	
516
	
458
        //
517
        //
459
        // Rule 56:  KeyWord ::= O c l A n y
518
        // Rule 56:  KeyWord ::= O c l A n y
460
        //
519
        //
461
		keywordKind[56] = (TK_OclAny);
520
        
521
		keywordKind[56] = (OCLBacktrackingParsersym.TK_OclAny);
462
	  
522
	  
463
	
523
	
464
        //
524
        //
465
        // Rule 57:  KeyWord ::= O c l V o i d
525
        // Rule 57:  KeyWord ::= O c l V o i d
466
        //
526
        //
467
		keywordKind[57] = (TK_OclVoid);
527
        
528
		keywordKind[57] = (OCLBacktrackingParsersym.TK_OclVoid);
468
	  
529
	  
469
	
530
	
470
        //
531
        //
471
        // Rule 58:  KeyWord ::= O c l I n v a l i d
532
        // Rule 58:  KeyWord ::= O c l I n v a l i d
472
        //
533
        //
473
		keywordKind[58] = (TK_OclInvalid);
534
        
535
		keywordKind[58] = (OCLBacktrackingParsersym.TK_OclInvalid);
474
	  
536
	  
475
	
537
	
476
        //
538
        //
477
        // Rule 59:  KeyWord ::= O c l M e s s a g e
539
        // Rule 59:  KeyWord ::= O c l M e s s a g e
478
        //
540
        //
479
		keywordKind[59] = (TK_OclMessage);
541
        
542
		keywordKind[59] = (OCLBacktrackingParsersym.TK_OclMessage);
480
	  
543
	  
481
	
544
	
482
        //
545
        //
483
        // Rule 60:  KeyWord ::= n u l l
546
        // Rule 60:  KeyWord ::= n u l l
484
        //
547
        //
485
		keywordKind[60] = (TK_null);
548
        
549
		keywordKind[60] = (OCLBacktrackingParsersym.TK_null);
486
	  
550
	  
487
	
551
	
488
        //
552
        //
489
        // Rule 61:  KeyWord ::= i n v a l i d
553
        // Rule 61:  KeyWord ::= i n v a l i d
490
        //
554
        //
491
		keywordKind[61] = (TK_invalid);
555
        
556
		keywordKind[61] = (OCLBacktrackingParsersym.TK_invalid);
492
	  
557
	  
493
	
558
	
494
        //
559
        //
495
        // Rule 62:  KeyWord ::= a t t r
560
        // Rule 62:  KeyWord ::= a t t r
496
        //
561
        //
497
		keywordKind[62] = (TK_attr);
562
        
563
		keywordKind[62] = (OCLBacktrackingParsersym.TK_attr);
498
	  
564
	  
499
	
565
	
500
        //
566
        //
501
        // Rule 63:  KeyWord ::= o p e r
567
        // Rule 63:  KeyWord ::= o p e r
502
        //
568
        //
503
		keywordKind[63] = (TK_oper);
569
        
570
		keywordKind[63] = (OCLBacktrackingParsersym.TK_oper);
504
	  
571
	  
505
	
572
	
506
        //
573
        //
507
        // Rule 64:  KeyWord ::= s t a t i c
574
        // Rule 64:  KeyWord ::= s t a t i c
508
        //
575
        //
509
		keywordKind[64] = (TK_static);
576
        
577
		keywordKind[64] = (OCLBacktrackingParsersym.TK_static);
510
	  
578
	  
511
	
579
	
512
513
        for (int i = 0; i < keywordKind.length; i++)
580
        for (int i = 0; i < keywordKind.length; i++)
514
        {
581
        {
515
            if (keywordKind[i] == 0)
582
            if (keywordKind[i] == 0)
(-)src/org/eclipse/ocl/parser/backtracking/OCLBacktrackingKWLexerprs.java (-46 / +95 lines)
Lines 1-7 Link Here
1
/**
1
/**
2
* <copyright>
2
* <copyright>
3
*
3
*
4
* Copyright (c) 2005, 2007 IBM Corporation and others.
4
* Copyright (c) 2005, 2009 IBM Corporation 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-24 Link Here
10
* Contributors:
10
* Contributors:
11
*   IBM - Initial API and implementation
11
*   IBM - Initial API and implementation
12
*   E.D.Willink - Lexer and Parser refactoring to support extensibility and flexible error handling
12
*   E.D.Willink - Lexer and Parser refactoring to support extensibility and flexible error handling
13
*   E.D.Willink - Bug 285633 static definitions
14
*   Adolfo Sanchez-Barbudo Herrera (Open Canarias) - LPG v 2.0.17 adoption (242153)
13
*
15
*
14
* </copyright>
16
* </copyright>
15
*
17
*
16
* $Id: OCLBacktrackingKWLexerprs.java,v 1.6 2009/09/04 13:40:44 ewillink Exp $
18
* 
17
*/
19
*/
18
20
19
package org.eclipse.ocl.parser.backtracking;
21
package org.eclipse.ocl.parser.backtracking;
20
22
21
public class OCLBacktrackingKWLexerprs implements lpg.lpgjavaruntime.ParseTable, OCLBacktrackingKWLexersym {
23
public class OCLBacktrackingKWLexerprs implements lpg.runtime.ParseTable, OCLBacktrackingKWLexersym {
24
    public final static int ERROR_SYMBOL = 0;
25
    public final int getErrorSymbol() { return ERROR_SYMBOL; }
26
27
    public final static int SCOPE_UBOUND = 0;
28
    public final int getScopeUbound() { return SCOPE_UBOUND; }
29
30
    public final static int SCOPE_SIZE = 0;
31
    public final int getScopeSize() { return SCOPE_SIZE; }
32
33
    public final static int MAX_NAME_LENGTH = 0;
34
    public final int getMaxNameLength() { return MAX_NAME_LENGTH; }
35
36
    public final static int NUM_STATES = 260;
37
    public final int getNumStates() { return NUM_STATES; }
38
39
    public final static int NT_OFFSET = 56;
40
    public final int getNtOffset() { return NT_OFFSET; }
41
42
    public final static int LA_STATE_OFFSET = 392;
43
    public final int getLaStateOffset() { return LA_STATE_OFFSET; }
44
45
    public final static int MAX_LA = 1;
46
    public final int getMaxLa() { return MAX_LA; }
47
48
    public final static int NUM_RULES = 64;
49
    public final int getNumRules() { return NUM_RULES; }
50
51
    public final static int NUM_NONTERMINALS = 2;
52
    public final int getNumNonterminals() { return NUM_NONTERMINALS; }
53
54
    public final static int NUM_SYMBOLS = 58;
55
    public final int getNumSymbols() { return NUM_SYMBOLS; }
56
57
    public final static int SEGMENT_SIZE = 8192;
58
    public final int getSegmentSize() { return SEGMENT_SIZE; }
59
60
    public final static int START_STATE = 65;
61
    public final int getStartState() { return START_STATE; }
62
63
    public final static int IDENTIFIER_SYMBOL = 0;
64
    public final int getIdentifier_SYMBOL() { return IDENTIFIER_SYMBOL; }
65
66
    public final static int EOFT_SYMBOL = 39;
67
    public final int getEoftSymbol() { return EOFT_SYMBOL; }
68
69
    public final static int EOLT_SYMBOL = 57;
70
    public final int getEoltSymbol() { return EOLT_SYMBOL; }
71
72
    public final static int ACCEPT_ACTION = 327;
73
    public final int getAcceptAction() { return ACCEPT_ACTION; }
74
75
    public final static int ERROR_ACTION = 328;
76
    public final int getErrorAction() { return ERROR_ACTION; }
77
78
    public final static boolean BACKTRACK = false;
79
    public final boolean getBacktrack() { return BACKTRACK; }
80
81
    public final int getStartSymbol() { return lhs(0); }
82
    public final boolean isValidForParser() { return OCLBacktrackingKWLexersym.isValidForParser; }
83
84
85
    public interface IsNullable {
86
        public final static byte isNullable[] = {0,
87
            0,0,0,0,0,0,0,0,0,0,
88
            0,0,0,0,0,0,0,0,0,0,
89
            0,0,0,0,0,0,0,0,0,0,
90
            0,0,0,0,0,0,0,0,0,0,
91
            0,0,0,0,0,0,0,0,0,0,
92
            0,0,0,0,0,0,0,0
93
        };
94
    };
95
    public final static byte isNullable[] = IsNullable.isNullable;
96
    public final boolean isNullable(int index) { return isNullable[index] != 0; }
97
98
    public interface ProsthesesIndex {
99
        public final static byte prosthesesIndex[] = {0,
100
            2,1
101
        };
102
    };
103
    public final static byte prosthesesIndex[] = ProsthesesIndex.prosthesesIndex;
104
    public final int prosthesesIndex(int index) { return prosthesesIndex[index]; }
22
105
23
    public interface IsKeyword {
106
    public interface IsKeyword {
24
        public final static byte isKeyword[] = {0,
107
        public final static byte isKeyword[] = {0,
Lines 27-33 Link Here
27
            0,0,0,0,0,0,0,0,0,0,
110
            0,0,0,0,0,0,0,0,0,0,
28
            0,0,0,0,0,0,0,0,0,0,
111
            0,0,0,0,0,0,0,0,0,0,
29
            0,0,0,0,0,0,0,0,0,0,
112
            0,0,0,0,0,0,0,0,0,0,
30
            0,0,0,0
113
            0,0,0,0,0,0
31
        };
114
        };
32
    };
115
    };
33
    public final static byte isKeyword[] = IsKeyword.isKeyword;
116
    public final static byte isKeyword[] = IsKeyword.isKeyword;
Lines 156-162 Link Here
156
            0,0,0,0,0,0,0,0,0,0,
239
            0,0,0,0,0,0,0,0,0,0,
157
            0,0,0,0,0,0,0,0,0,0,
240
            0,0,0,0,0,0,0,0,0,0,
158
            0,0,0,0,0,0,0,0,0,0,
241
            0,0,0,0,0,0,0,0,0,0,
159
            0,0,0,0,0,0,0,0,0,0
242
            0,0,0,0,0,0,0,0,0,0,
243
            0,0
160
        };
244
        };
161
    };
245
    };
162
    public final static byte termCheck[] = TermCheck.termCheck;
246
    public final static byte termCheck[] = TermCheck.termCheck;
Lines 242-297 Link Here
242
    public final int scopeState(int index) { return 0;}
326
    public final int scopeState(int index) { return 0;}
243
    public final int inSymb(int index) { return 0;}
327
    public final int inSymb(int index) { return 0;}
244
    public final String name(int index) { return null; }
328
    public final String name(int index) { return null; }
245
    public final int getErrorSymbol() { return 0; }
246
    public final int getScopeUbound() { return 0; }
247
    public final int getScopeSize() { return 0; }
248
    public final int getMaxNameLength() { return 0; }
249
250
    public final static int
251
           NUM_STATES        = 260,
252
           NT_OFFSET         = 54,
253
           LA_STATE_OFFSET   = 392,
254
           MAX_LA            = 1,
255
           NUM_RULES         = 64,
256
           NUM_NONTERMINALS  = 2,
257
           NUM_SYMBOLS       = 56,
258
           SEGMENT_SIZE      = 8192,
259
           START_STATE       = 65,
260
           IDENTIFIER_SYMBOL = 0,
261
           EOFT_SYMBOL       = 39,
262
           EOLT_SYMBOL       = 55,
263
           ACCEPT_ACTION     = 327,
264
           ERROR_ACTION      = 328;
265
266
    public final static boolean BACKTRACK = false;
267
268
    public final int getNumStates() { return NUM_STATES; }
269
    public final int getNtOffset() { return NT_OFFSET; }
270
    public final int getLaStateOffset() { return LA_STATE_OFFSET; }
271
    public final int getMaxLa() { return MAX_LA; }
272
    public final int getNumRules() { return NUM_RULES; }
273
    public final int getNumNonterminals() { return NUM_NONTERMINALS; }
274
    public final int getNumSymbols() { return NUM_SYMBOLS; }
275
    public final int getSegmentSize() { return SEGMENT_SIZE; }
276
    public final int getStartState() { return START_STATE; }
277
    public final int getStartSymbol() { return lhs[0]; }
278
    public final int getIdentifierSymbol() { return IDENTIFIER_SYMBOL; }
279
    public final int getEoftSymbol() { return EOFT_SYMBOL; }
280
    public final int getEoltSymbol() { return EOLT_SYMBOL; }
281
    public final int getAcceptAction() { return ACCEPT_ACTION; }
282
    public final int getErrorAction() { return ERROR_ACTION; }
283
    public final boolean isValidForParser() { return isValidForParser; }
284
    public final boolean getBacktrack() { return BACKTRACK; }
285
286
    public final int originalState(int state) { return 0; }
329
    public final int originalState(int state) { return 0; }
287
    public final int asi(int state) { return 0; }
330
    public final int asi(int state) { return 0; }
288
    public final int nasi(int state) { return 0; }
331
    public final int nasi(int state) { return 0; }
289
    public final int inSymbol(int state) { return 0; }
332
    public final int inSymbol(int state) { return 0; }
290
333
334
    /**
335
     * assert(! goto_default);
336
     */
291
    public final int ntAction(int state, int sym) {
337
    public final int ntAction(int state, int sym) {
292
        return baseAction[state + sym];
338
        return baseAction[state + sym];
293
    }
339
    }
294
340
341
    /**
342
     * assert(! shift_default);
343
     */
295
    public final int tAction(int state, int sym) {
344
    public final int tAction(int state, int sym) {
296
        int i = baseAction[state],
345
        int i = baseAction[state],
297
            k = i + sym;
346
            k = i + sym;
(-)src/org/eclipse/ocl/parser/backtracking/OCLBacktrackingParserprs.java (-68 / +137 lines)
Lines 12-22 Link Here
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
14
*   E.D.Willink - Bugs 225493, 243976, 259818, 282882, 287993
14
*   E.D.Willink - Bugs 225493, 243976, 259818, 282882, 287993
15
*   Zeligsoft - Bug 243976
15
*   Borland - Bug 242880
16
*   Borland - Bug 242880
17
*   Adolfo Sanchez-Barbudo Herrera (Open Canarias) - LPG v 2.0.17 adoption (242153)
16
*
18
*
17
* </copyright>
19
* </copyright>
18
*
20
*
19
* $Id: OCLBacktrackingParserprs.java,v 1.6 2009/09/04 13:40:44 ewillink Exp $
21
* $Id: EssentialOCL.g,v 1.7 2009/03/05 14:12:14 cdamus Exp $
20
*/
22
*/
21
23
22
package org.eclipse.ocl.parser.backtracking;
24
package org.eclipse.ocl.parser.backtracking;
Lines 29-35 Link Here
29
 * @since 1.3
31
 * @since 1.3
30
 */
32
 */
31
@SuppressWarnings("nls")
33
@SuppressWarnings("nls")
32
public class OCLBacktrackingParserprs implements lpg.lpgjavaruntime.ParseTable, OCLBacktrackingParsersym {
34
public class OCLBacktrackingParserprs implements lpg.runtime.ParseTable, OCLBacktrackingParsersym {
35
    public final static int ERROR_SYMBOL = 1;
36
    public final int getErrorSymbol() { return ERROR_SYMBOL; }
37
38
    public final static int SCOPE_UBOUND = 58;
39
    public final int getScopeUbound() { return SCOPE_UBOUND; }
40
41
    public final static int SCOPE_SIZE = 59;
42
    public final int getScopeSize() { return SCOPE_SIZE; }
43
44
    public final static int MAX_NAME_LENGTH = 26;
45
    public final int getMaxNameLength() { return MAX_NAME_LENGTH; }
46
47
    public final static int NUM_STATES = 241;
48
    public final int getNumStates() { return NUM_STATES; }
49
50
    public final static int NT_OFFSET = 102;
51
    public final int getNtOffset() { return NT_OFFSET; }
52
53
    public final static int LA_STATE_OFFSET = 3935;
54
    public final int getLaStateOffset() { return LA_STATE_OFFSET; }
55
56
    public final static int MAX_LA = 2;
57
    public final int getMaxLa() { return MAX_LA; }
58
59
    public final static int NUM_RULES = 331;
60
    public final int getNumRules() { return NUM_RULES; }
61
62
    public final static int NUM_NONTERMINALS = 111;
63
    public final int getNumNonterminals() { return NUM_NONTERMINALS; }
64
65
    public final static int NUM_SYMBOLS = 213;
66
    public final int getNumSymbols() { return NUM_SYMBOLS; }
67
68
    public final static int SEGMENT_SIZE = 8192;
69
    public final int getSegmentSize() { return SEGMENT_SIZE; }
70
71
    public final static int START_STATE = 3323;
72
    public final int getStartState() { return START_STATE; }
73
74
    public final static int IDENTIFIER_SYMBOL = 4;
75
    public final int getIdentifier_SYMBOL() { return IDENTIFIER_SYMBOL; }
76
77
    public final static int EOFT_SYMBOL = 79;
78
    public final int getEoftSymbol() { return EOFT_SYMBOL; }
79
80
    public final static int EOLT_SYMBOL = 79;
81
    public final int getEoltSymbol() { return EOLT_SYMBOL; }
82
83
    public final static int ACCEPT_ACTION = 3603;
84
    public final int getAcceptAction() { return ACCEPT_ACTION; }
85
86
    public final static int ERROR_ACTION = 3604;
87
    public final int getErrorAction() { return ERROR_ACTION; }
88
89
    public final static boolean BACKTRACK = true;
90
    public final boolean getBacktrack() { return BACKTRACK; }
91
92
    public final int getStartSymbol() { return lhs(0); }
93
    public final boolean isValidForParser() { return OCLBacktrackingParsersym.isValidForParser; }
94
95
96
    public interface IsNullable {
97
        public final static byte isNullable[] = {0,
98
            0,0,0,0,0,0,0,0,0,0,
99
            0,0,0,0,0,0,0,0,0,0,
100
            0,0,0,0,0,0,0,0,0,0,
101
            0,0,0,0,0,0,0,0,0,0,
102
            0,0,0,0,0,0,0,0,0,0,
103
            0,0,0,0,0,0,0,0,0,0,
104
            0,0,0,0,0,0,0,0,0,0,
105
            0,0,0,0,0,0,0,0,0,0,
106
            0,0,0,0,0,0,0,0,0,0,
107
            0,0,0,0,0,0,0,0,0,0,
108
            0,0,0,0,0,0,0,0,0,0,
109
            0,0,0,0,0,0,0,0,0,0,
110
            0,0,0,0,0,0,0,0,0,0,
111
            0,0,0,0,0,0,0,0,0,0,
112
            0,0,0,0,0,0,0,0,0,0,
113
            0,0,0,1,0,0,0,1,0,0,
114
            0,1,0,0,0,0,0,0,0,0,
115
            0,0,0,0,1,1,0,1,0,0,
116
            0,0,0,0,1,1,0,0,0,1,
117
            0,0,0,0,0,0,1,0,0,0,
118
            0,0,1,0,0,1,0,0,0,0,
119
            0,0,0
120
        };
121
    };
122
    public final static byte isNullable[] = IsNullable.isNullable;
123
    public final boolean isNullable(int index) { return isNullable[index] != 0; }
124
125
    public interface ProsthesesIndex {
126
        public final static byte prosthesesIndex[] = {0,
127
            55,54,9,21,110,63,5,6,7,10,
128
            3,8,15,50,51,11,40,42,44,48,
129
            49,57,58,59,60,61,62,68,69,70,
130
            71,72,41,43,38,39,34,35,36,37,
131
            32,33,30,31,28,29,25,26,27,78,
132
            23,52,53,107,111,47,79,81,82,24,
133
            109,98,99,100,101,104,89,92,93,94,
134
            4,12,19,20,22,56,66,67,74,80,
135
            84,85,86,87,88,95,97,2,13,14,
136
            17,18,45,46,64,65,73,75,76,77,
137
            83,90,91,96,102,103,105,106,108,1,
138
            16
139
        };
140
    };
141
    public final static byte prosthesesIndex[] = ProsthesesIndex.prosthesesIndex;
142
    public final int prosthesesIndex(int index) { return prosthesesIndex[index]; }
33
143
34
    public interface IsKeyword {
144
    public interface IsKeyword {
35
        public final static byte isKeyword[] = {0,
145
        public final static byte isKeyword[] = {0,
Lines 1583-1615 Link Here
1583
1693
1584
    public interface ScopeRhs {
1694
    public interface ScopeRhs {
1585
        public final static char scopeRhs[] = {0,
1695
        public final static char scopeRhs[] = {0,
1586
            155,95,118,0,103,0,155,95,105,0,
1696
            155,95,118,0,1,0,155,95,105,0,
1587
            149,2,0,149,69,0,149,91,149,69,
1697
            149,2,0,149,69,0,149,91,149,69,
1588
            0,43,119,103,0,149,92,149,91,149,
1698
            0,91,149,1,0,149,92,149,91,149,
1589
            69,0,44,119,103,0,43,119,44,119,
1699
            69,0,92,149,1,0,91,149,92,149,
1590
            103,0,158,2,163,114,0,12,0,158,
1700
            1,0,158,2,163,114,0,3,0,158,
1591
            2,163,112,0,158,2,163,174,0,158,
1701
            2,163,112,0,158,2,163,174,0,158,
1592
            2,157,84,106,0,159,2,108,0,186,
1702
            2,157,84,106,0,159,2,108,0,186,
1593
            2,105,90,0,186,2,105,89,0,45,
1703
            2,105,90,0,186,2,105,89,0,85,
1594
            0,44,119,45,0,43,119,44,119,45,
1704
            0,92,149,85,0,91,149,92,149,85,
1595
            0,183,68,0,52,119,0,16,0,0,
1705
            0,183,68,0,83,149,0,80,154,0,
1596
            158,2,154,112,0,158,2,154,114,0,
1706
            158,2,154,112,0,158,2,154,114,0,
1597
            158,2,154,174,0,203,2,52,0,159,
1707
            158,2,154,174,0,203,2,52,0,159,
1598
            32,4,0,7,119,0,149,70,153,81,
1708
            32,4,0,5,149,0,149,70,153,81,
1599
            153,2,191,0,153,81,153,2,191,0,
1709
            153,2,191,0,153,81,153,2,191,0,
1600
            18,119,12,0,153,2,191,0,22,118,
1710
            70,149,3,0,153,2,191,0,81,153,
1601
            18,119,12,0,149,70,153,2,191,0,
1711
            70,149,3,0,149,70,153,2,191,0,
1602
            149,70,153,31,153,2,192,0,153,31,
1712
            149,70,153,31,153,2,192,0,153,31,
1603
            153,2,192,0,153,2,192,0,19,118,
1713
            153,2,192,0,153,2,192,0,31,153,
1604
            18,119,12,0,149,70,153,2,192,0,
1714
            70,149,3,0,149,70,153,2,192,0,
1605
            149,2,192,0,199,94,52,0,14,0,
1715
            149,2,192,0,199,94,52,0,74,0,
1606
            197,94,108,0,158,2,105,84,106,0,
1716
            197,94,108,0,158,2,105,84,106,0,
1607
            158,2,61,0,137,0,4,133,0,3,
1717
            158,2,61,0,137,0,20,135,0,19,
1608
            133,0,141,0,2,131,0,1,131,0,
1718
            135,0,141,0,29,138,0,28,138,0,
1609
            143,0,9,128,0,8,128,0,6,128,
1719
            143,0,24,140,0,23,140,0,22,140,
1610
            0,5,128,0,145,0,10,126,0,7,
1720
            0,21,140,0,145,0,7,144,0,5,
1611
            126,0,147,0,48,124,0,47,124,0,
1721
            144,0,147,0,27,146,0,26,146,0,
1612
            46,124,0
1722
            25,146,0
1613
        };
1723
        };
1614
    };
1724
    };
1615
    public final static char scopeRhs[] = ScopeRhs.scopeRhs;
1725
    public final static char scopeRhs[] = ScopeRhs.scopeRhs;
Lines 1839-1891 Link Here
1839
    public final static String name[] = Name.name;
1949
    public final static String name[] = Name.name;
1840
    public final String name(int index) { return name[index]; }
1950
    public final String name(int index) { return name[index]; }
1841
1951
1842
    public final static int
1843
           ERROR_SYMBOL      = 1,
1844
           SCOPE_UBOUND      = 58,
1845
           SCOPE_SIZE        = 59,
1846
           MAX_NAME_LENGTH   = 26;
1847
1848
    public final int getErrorSymbol() { return ERROR_SYMBOL; }
1849
    public final int getScopeUbound() { return SCOPE_UBOUND; }
1850
    public final int getScopeSize() { return SCOPE_SIZE; }
1851
    public final int getMaxNameLength() { return MAX_NAME_LENGTH; }
1852
1853
    public final static int
1854
           NUM_STATES        = 241,
1855
           NT_OFFSET         = 102,
1856
           LA_STATE_OFFSET   = 3935,
1857
           MAX_LA            = 2,
1858
           NUM_RULES         = 331,
1859
           NUM_NONTERMINALS  = 111,
1860
           NUM_SYMBOLS       = 213,
1861
           SEGMENT_SIZE      = 8192,
1862
           START_STATE       = 3323,
1863
           IDENTIFIER_SYMBOL = 4,
1864
           EOFT_SYMBOL       = 79,
1865
           EOLT_SYMBOL       = 79,
1866
           ACCEPT_ACTION     = 3603,
1867
           ERROR_ACTION      = 3604;
1868
1869
    public final static boolean BACKTRACK = true;
1870
1871
    public final int getNumStates() { return NUM_STATES; }
1872
    public final int getNtOffset() { return NT_OFFSET; }
1873
    public final int getLaStateOffset() { return LA_STATE_OFFSET; }
1874
    public final int getMaxLa() { return MAX_LA; }
1875
    public final int getNumRules() { return NUM_RULES; }
1876
    public final int getNumNonterminals() { return NUM_NONTERMINALS; }
1877
    public final int getNumSymbols() { return NUM_SYMBOLS; }
1878
    public final int getSegmentSize() { return SEGMENT_SIZE; }
1879
    public final int getStartState() { return START_STATE; }
1880
    public final int getStartSymbol() { return lhs[0]; }
1881
    public final int getIdentifierSymbol() { return IDENTIFIER_SYMBOL; }
1882
    public final int getEoftSymbol() { return EOFT_SYMBOL; }
1883
    public final int getEoltSymbol() { return EOLT_SYMBOL; }
1884
    public final int getAcceptAction() { return ACCEPT_ACTION; }
1885
    public final int getErrorAction() { return ERROR_ACTION; }
1886
    public final boolean isValidForParser() { return isValidForParser; }
1887
    public final boolean getBacktrack() { return BACKTRACK; }
1888
1889
    public final int originalState(int state) {
1952
    public final int originalState(int state) {
1890
        return -baseCheck[state];
1953
        return -baseCheck[state];
1891
    }
1954
    }
Lines 1899-1908 Link Here
1899
        return inSymb[originalState(state)];
1962
        return inSymb[originalState(state)];
1900
    }
1963
    }
1901
1964
1965
    /**
1966
     * assert(! goto_default);
1967
     */
1902
    public final int ntAction(int state, int sym) {
1968
    public final int ntAction(int state, int sym) {
1903
        return baseAction[state + sym];
1969
        return baseAction[state + sym];
1904
    }
1970
    }
1905
1971
1972
    /**
1973
     * assert(! shift_default);
1974
     */
1906
    public final int tAction(int state, int sym) {
1975
    public final int tAction(int state, int sym) {
1907
        int i = baseAction[state],
1976
        int i = baseAction[state],
1908
            k = i + sym;
1977
            k = i + sym;
(-)src/org/eclipse/ocl/parser/backtracking/OCLBacktrackingParsersym.java (-2 / +5 lines)
Lines 12-22 Link Here
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
14
*   E.D.Willink - Bugs 225493, 243976, 259818, 282882, 287993
14
*   E.D.Willink - Bugs 225493, 243976, 259818, 282882, 287993
15
*   Zeligsoft - Bug 243976
15
*   Borland - Bug 242880
16
*   Borland - Bug 242880
17
*   Adolfo Sanchez-Barbudo Herrera (Open Canarias) - LPG v 2.0.17 adoption (242153)
16
*
18
*
17
* </copyright>
19
* </copyright>
18
*
20
*
19
* $Id: OCLBacktrackingParsersym.java,v 1.6 2009/09/04 13:40:43 ewillink Exp $
21
* $Id: EssentialOCL.g,v 1.7 2009/03/05 14:12:14 cdamus Exp $
20
*/
22
*/
21
23
22
package org.eclipse.ocl.parser.backtracking;
24
package org.eclipse.ocl.parser.backtracking;
Lines 135-141 Link Here
135
      TK_MULTI_LINE_COMMENT = 102,
137
      TK_MULTI_LINE_COMMENT = 102,
136
      TK_ERROR_TOKEN = 1;
138
      TK_ERROR_TOKEN = 1;
137
139
138
      public final static String orderedTerminalSymbols[] = {
140
    public final static String orderedTerminalSymbols[] = {
139
                 "",
141
                 "",
140
                 "ERROR_TOKEN",
142
                 "ERROR_TOKEN",
141
                 "LPAREN",
143
                 "LPAREN",
Lines 241-245 Link Here
241
                 "MULTI_LINE_COMMENT"
243
                 "MULTI_LINE_COMMENT"
242
             };
244
             };
243
245
246
    public final static int numTokenKinds = orderedTerminalSymbols.length;
244
    public final static boolean isValidForParser = true;
247
    public final static boolean isValidForParser = true;
245
}
248
}
(-)src/org/eclipse/ocl/parser/backtracking/OCLBacktrackingLexerprs.java (-44 / +105 lines)
Lines 1-7 Link Here
1
/**
1
/**
2
* <copyright>
2
* <copyright>
3
*
3
*
4
* Copyright (c) 2005, 2009 IBM Corporation, Borland Software Corp.,  and others.
4
* Copyright (c) 2005, 2009 IBM Corporation, Borland Software Corp. 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-25 Link Here
10
* Contributors:
10
* Contributors:
11
*   IBM - Initial API and implementation
11
*   IBM - Initial API and implementation
12
*   E.D.Willink - Lexer and Parser refactoring to support extensibility and flexible error handling
12
*   E.D.Willink - Lexer and Parser refactoring to support extensibility and flexible error handling
13
*               - Bug 259818
13
*   Borland - Bug 242880
14
*   Borland - Bug 242880
15
*   Adolfo Sanchez-Barbudo Herrera (Open Canarias) - LPG v 2.0.17 adoption (242153)
14
*
16
*
15
* </copyright>
17
* </copyright>
16
*
18
*
17
* $Id: OCLBacktrackingLexerprs.java,v 1.6 2009/09/04 13:40:44 ewillink Exp $
19
* $Id: OCLLexer.g,v 1.3 2009/08/28 20:43:11 ewillink Exp $
18
*/
20
*/
19
21
20
package org.eclipse.ocl.parser.backtracking;
22
package org.eclipse.ocl.parser.backtracking;
21
23
22
public class OCLBacktrackingLexerprs implements lpg.lpgjavaruntime.ParseTable, OCLBacktrackingLexersym {
24
public class OCLBacktrackingLexerprs implements lpg.runtime.ParseTable, OCLBacktrackingLexersym {
25
    public final static int ERROR_SYMBOL = 0;
26
    public final int getErrorSymbol() { return ERROR_SYMBOL; }
27
28
    public final static int SCOPE_UBOUND = 0;
29
    public final int getScopeUbound() { return SCOPE_UBOUND; }
30
31
    public final static int SCOPE_SIZE = 0;
32
    public final int getScopeSize() { return SCOPE_SIZE; }
33
34
    public final static int MAX_NAME_LENGTH = 0;
35
    public final int getMaxNameLength() { return MAX_NAME_LENGTH; }
36
37
    public final static int NUM_STATES = 50;
38
    public final int getNumStates() { return NUM_STATES; }
39
40
    public final static int NT_OFFSET = 103;
41
    public final int getNtOffset() { return NT_OFFSET; }
42
43
    public final static int LA_STATE_OFFSET = 824;
44
    public final int getLaStateOffset() { return LA_STATE_OFFSET; }
45
46
    public final static int MAX_LA = 1;
47
    public final int getMaxLa() { return MAX_LA; }
48
49
    public final static int NUM_RULES = 309;
50
    public final int getNumRules() { return NUM_RULES; }
51
52
    public final static int NUM_NONTERMINALS = 44;
53
    public final int getNumNonterminals() { return NUM_NONTERMINALS; }
54
55
    public final static int NUM_SYMBOLS = 147;
56
    public final int getNumSymbols() { return NUM_SYMBOLS; }
57
58
    public final static int SEGMENT_SIZE = 8192;
59
    public final int getSegmentSize() { return SEGMENT_SIZE; }
60
61
    public final static int START_STATE = 310;
62
    public final int getStartState() { return START_STATE; }
63
64
    public final static int IDENTIFIER_SYMBOL = 0;
65
    public final int getIdentifier_SYMBOL() { return IDENTIFIER_SYMBOL; }
66
67
    public final static int EOFT_SYMBOL = 99;
68
    public final int getEoftSymbol() { return EOFT_SYMBOL; }
69
70
    public final static int EOLT_SYMBOL = 104;
71
    public final int getEoltSymbol() { return EOLT_SYMBOL; }
72
73
    public final static int ACCEPT_ACTION = 514;
74
    public final int getAcceptAction() { return ACCEPT_ACTION; }
75
76
    public final static int ERROR_ACTION = 515;
77
    public final int getErrorAction() { return ERROR_ACTION; }
78
79
    public final static boolean BACKTRACK = false;
80
    public final boolean getBacktrack() { return BACKTRACK; }
81
82
    public final int getStartSymbol() { return lhs(0); }
83
    public final boolean isValidForParser() { return OCLBacktrackingLexersym.isValidForParser; }
84
85
86
    public interface IsNullable {
87
        public final static byte isNullable[] = {0,
88
            0,0,0,0,0,0,0,0,0,0,
89
            0,0,0,0,0,0,0,0,0,0,
90
            0,0,0,0,0,0,0,0,0,0,
91
            0,0,0,0,0,0,0,0,0,0,
92
            0,0,0,0,0,0,0,0,0,0,
93
            0,0,0,0,0,0,0,0,0,0,
94
            0,0,0,0,0,0,0,0,0,0,
95
            0,0,0,0,0,0,0,0,0,0,
96
            0,0,0,0,0,0,0,0,0,0,
97
            0,0,0,0,0,0,0,0,0,0,
98
            0,0,0,0,0,0,0,0,0,0,
99
            0,0,0,0,0,0,1,0,0,0,
100
            0,0,0,0,0,0,0,0,0,0,
101
            0,1,0,0,0,0,0,0,0,0,
102
            0,0,0,0,0,0,0
103
        };
104
    };
105
    public final static byte isNullable[] = IsNullable.isNullable;
106
    public final boolean isNullable(int index) { return isNullable[index] != 0; }
107
108
    public interface ProsthesesIndex {
109
        public final static byte prosthesesIndex[] = {0,
110
            20,25,26,27,35,4,15,37,40,43,
111
            24,5,3,6,17,18,23,32,34,36,
112
            41,42,2,7,8,9,10,11,12,13,
113
            14,16,19,33,38,39,44,1,21,22,
114
            28,29,30,31
115
        };
116
    };
117
    public final static byte prosthesesIndex[] = ProsthesesIndex.prosthesesIndex;
118
    public final int prosthesesIndex(int index) { return prosthesesIndex[index]; }
23
119
24
    public interface IsKeyword {
120
    public interface IsKeyword {
25
        public final static byte isKeyword[] = {0,
121
        public final static byte isKeyword[] = {0,
Lines 476-531 Link Here
476
    public final int scopeState(int index) { return 0;}
572
    public final int scopeState(int index) { return 0;}
477
    public final int inSymb(int index) { return 0;}
573
    public final int inSymb(int index) { return 0;}
478
    public final String name(int index) { return null; }
574
    public final String name(int index) { return null; }
479
    public final int getErrorSymbol() { return 0; }
480
    public final int getScopeUbound() { return 0; }
481
    public final int getScopeSize() { return 0; }
482
    public final int getMaxNameLength() { return 0; }
483
484
    public final static int
485
           NUM_STATES        = 50,
486
           NT_OFFSET         = 103,
487
           LA_STATE_OFFSET   = 824,
488
           MAX_LA            = 1,
489
           NUM_RULES         = 309,
490
           NUM_NONTERMINALS  = 44,
491
           NUM_SYMBOLS       = 147,
492
           SEGMENT_SIZE      = 8192,
493
           START_STATE       = 310,
494
           IDENTIFIER_SYMBOL = 0,
495
           EOFT_SYMBOL       = 99,
496
           EOLT_SYMBOL       = 104,
497
           ACCEPT_ACTION     = 514,
498
           ERROR_ACTION      = 515;
499
500
    public final static boolean BACKTRACK = false;
501
502
    public final int getNumStates() { return NUM_STATES; }
503
    public final int getNtOffset() { return NT_OFFSET; }
504
    public final int getLaStateOffset() { return LA_STATE_OFFSET; }
505
    public final int getMaxLa() { return MAX_LA; }
506
    public final int getNumRules() { return NUM_RULES; }
507
    public final int getNumNonterminals() { return NUM_NONTERMINALS; }
508
    public final int getNumSymbols() { return NUM_SYMBOLS; }
509
    public final int getSegmentSize() { return SEGMENT_SIZE; }
510
    public final int getStartState() { return START_STATE; }
511
    public final int getStartSymbol() { return lhs[0]; }
512
    public final int getIdentifierSymbol() { return IDENTIFIER_SYMBOL; }
513
    public final int getEoftSymbol() { return EOFT_SYMBOL; }
514
    public final int getEoltSymbol() { return EOLT_SYMBOL; }
515
    public final int getAcceptAction() { return ACCEPT_ACTION; }
516
    public final int getErrorAction() { return ERROR_ACTION; }
517
    public final boolean isValidForParser() { return isValidForParser; }
518
    public final boolean getBacktrack() { return BACKTRACK; }
519
520
    public final int originalState(int state) { return 0; }
575
    public final int originalState(int state) { return 0; }
521
    public final int asi(int state) { return 0; }
576
    public final int asi(int state) { return 0; }
522
    public final int nasi(int state) { return 0; }
577
    public final int nasi(int state) { return 0; }
523
    public final int inSymbol(int state) { return 0; }
578
    public final int inSymbol(int state) { return 0; }
524
579
580
    /**
581
     * assert(! goto_default);
582
     */
525
    public final int ntAction(int state, int sym) {
583
    public final int ntAction(int state, int sym) {
526
        return baseAction[state + sym];
584
        return baseAction[state + sym];
527
    }
585
    }
528
586
587
    /**
588
     * assert(! shift_default);
589
     */
529
    public final int tAction(int state, int sym) {
590
    public final int tAction(int state, int sym) {
530
        int i = baseAction[state],
591
        int i = baseAction[state],
531
            k = i + sym;
592
            k = i + sym;
(-)src/org/eclipse/ocl/cst/CSTNode.java (-5 / +5 lines)
Lines 17-23 Link Here
17
 */
17
 */
18
package org.eclipse.ocl.cst;
18
package org.eclipse.ocl.cst;
19
19
20
import lpg.lpgjavaruntime.IToken;
20
import lpg.runtime.IToken;
21
import org.eclipse.emf.ecore.EObject;
21
import org.eclipse.emf.ecore.EObject;
22
22
23
/**
23
/**
Lines 104-110 Link Here
104
	 * If the meaning of the '<em>Start Token</em>' attribute isn't clear,
104
	 * If the meaning of the '<em>Start Token</em>' attribute isn't clear,
105
	 * there really should be more of a description here...
105
	 * there really should be more of a description here...
106
	 * </p>
106
	 * </p>
107
	 * @since 1.3
107
	 * @since 3.0
108
	 * <!-- end-user-doc -->
108
	 * <!-- end-user-doc -->
109
	 * @return the value of the '<em>Start Token</em>' attribute.
109
	 * @return the value of the '<em>Start Token</em>' attribute.
110
	 * @see #setStartToken(IToken)
110
	 * @see #setStartToken(IToken)
Lines 117-123 Link Here
117
	/**
117
	/**
118
	 * Sets the value of the '{@link org.eclipse.ocl.cst.CSTNode#getStartToken <em>Start Token</em>}' attribute.
118
	 * Sets the value of the '{@link org.eclipse.ocl.cst.CSTNode#getStartToken <em>Start Token</em>}' attribute.
119
	 * <!-- begin-user-doc -->
119
	 * <!-- begin-user-doc -->
120
	 * @since 1.3
120
	 * @since 3.0
121
	 * <!-- end-user-doc -->
121
	 * <!-- end-user-doc -->
122
	 * @param value the new value of the '<em>Start Token</em>' attribute.
122
	 * @param value the new value of the '<em>Start Token</em>' attribute.
123
	 * @see #getStartToken()
123
	 * @see #getStartToken()
Lines 132-138 Link Here
132
	 * If the meaning of the '<em>End Token</em>' attribute isn't clear,
132
	 * If the meaning of the '<em>End Token</em>' attribute isn't clear,
133
	 * there really should be more of a description here...
133
	 * there really should be more of a description here...
134
	 * </p>
134
	 * </p>
135
	 * @since 1.3
135
	 * @since 3.0
136
	 * <!-- end-user-doc -->
136
	 * <!-- end-user-doc -->
137
	 * @return the value of the '<em>End Token</em>' attribute.
137
	 * @return the value of the '<em>End Token</em>' attribute.
138
	 * @see #setEndToken(IToken)
138
	 * @see #setEndToken(IToken)
Lines 145-151 Link Here
145
	/**
145
	/**
146
	 * Sets the value of the '{@link org.eclipse.ocl.cst.CSTNode#getEndToken <em>End Token</em>}' attribute.
146
	 * Sets the value of the '{@link org.eclipse.ocl.cst.CSTNode#getEndToken <em>End Token</em>}' attribute.
147
	 * <!-- begin-user-doc -->
147
	 * <!-- begin-user-doc -->
148
	 * @since 1.3
148
	 * @since 3.0
149
	 * <!-- end-user-doc -->
149
	 * <!-- end-user-doc -->
150
	 * @param value the new value of the '<em>End Token</em>' attribute.
150
	 * @param value the new value of the '<em>End Token</em>' attribute.
151
	 * @see #getEndToken()
151
	 * @see #getEndToken()
(-)src/org/eclipse/ocl/cst/CSTPackage.java (-5 / +5 lines)
Lines 4867-4873 Link Here
4867
	 * The meta object id for the '<em>IToken</em>' data type.
4867
	 * The meta object id for the '<em>IToken</em>' data type.
4868
	 * <!-- begin-user-doc -->
4868
	 * <!-- begin-user-doc -->
4869
	 * <!-- end-user-doc -->
4869
	 * <!-- end-user-doc -->
4870
	 * @see lpg.lpgjavaruntime.IToken
4870
	 * @see lpg.runtime.IToken
4871
	 * @see org.eclipse.ocl.cst.impl.CSTPackageImpl#getIToken()
4871
	 * @see org.eclipse.ocl.cst.impl.CSTPackageImpl#getIToken()
4872
	 * @generated
4872
	 * @generated
4873
	 * @noreference This field is not intended to be referenced by clients.
4873
	 * @noreference This field is not intended to be referenced by clients.
Lines 6326-6338 Link Here
6326
	EEnum getDotOrArrowEnum();
6326
	EEnum getDotOrArrowEnum();
6327
6327
6328
	/**
6328
	/**
6329
	 * Returns the meta object for data type '{@link lpg.lpgjavaruntime.IToken <em>IToken</em>}'.
6329
	 * Returns the meta object for data type '{@link lpg.runtime.IToken <em>IToken</em>}'.
6330
	 * <!-- begin-user-doc -->
6330
	 * <!-- begin-user-doc -->
6331
	 * @since 1.3
6331
	 * @since 1.3
6332
	 * <!-- end-user-doc -->
6332
	 * <!-- end-user-doc -->
6333
	 * @return the meta object for data type '<em>IToken</em>'.
6333
	 * @return the meta object for data type '<em>IToken</em>'.
6334
	 * @see lpg.lpgjavaruntime.IToken
6334
	 * @see lpg.runtime.IToken
6335
	 * @model instanceClass="lpg.lpgjavaruntime.IToken"
6335
	 * @model instanceClass="lpg.runtime.IToken"
6336
	 * @generated
6336
	 * @generated
6337
	 */
6337
	 */
6338
	EDataType getIToken();
6338
	EDataType getIToken();
Lines 7644-7650 Link Here
7644
		 * <!-- begin-user-doc -->
7644
		 * <!-- begin-user-doc -->
7645
		 * @since 1.3
7645
		 * @since 1.3
7646
		 * <!-- end-user-doc -->
7646
		 * <!-- end-user-doc -->
7647
		 * @see lpg.lpgjavaruntime.IToken
7647
		 * @see lpg.runtime.IToken
7648
		 * @see org.eclipse.ocl.cst.impl.CSTPackageImpl#getIToken()
7648
		 * @see org.eclipse.ocl.cst.impl.CSTPackageImpl#getIToken()
7649
		 * @generated
7649
		 * @generated
7650
		 */
7650
		 */
(-)src/org/eclipse/ocl/cst/impl/CSTPackageImpl.java (-1 / +1 lines)
Lines 18-24 Link Here
18
 */
18
 */
19
package org.eclipse.ocl.cst.impl;
19
package org.eclipse.ocl.cst.impl;
20
20
21
import lpg.lpgjavaruntime.IToken;
21
import lpg.runtime.IToken;
22
import org.eclipse.emf.ecore.EAttribute;
22
import org.eclipse.emf.ecore.EAttribute;
23
import org.eclipse.emf.ecore.EClass;
23
import org.eclipse.emf.ecore.EClass;
24
import org.eclipse.emf.ecore.EDataType;
24
import org.eclipse.emf.ecore.EDataType;
(-)src/org/eclipse/ocl/cst/impl/CSTFactoryImpl.java (-2 / +2 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 lpg.lpgjavaruntime.IToken;
20
import lpg.runtime.IToken;
21
import org.eclipse.emf.ecore.EClass;
21
import org.eclipse.emf.ecore.EClass;
22
import org.eclipse.emf.ecore.EDataType;
22
import org.eclipse.emf.ecore.EDataType;
23
import org.eclipse.emf.ecore.EObject;
23
import org.eclipse.emf.ecore.EObject;
Lines 823-829 Link Here
823
823
824
	/**
824
	/**
825
	 * <!-- begin-user-doc -->
825
	 * <!-- begin-user-doc -->
826
	 * @since 1.3
826
	 * @since 3.0
827
	 * <!-- end-user-doc -->
827
	 * <!-- end-user-doc -->
828
	 * @generated
828
	 * @generated
829
	 */
829
	 */
(-)src/org/eclipse/ocl/cst/impl/CSTNodeImpl.java (-5 / +5 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 lpg.lpgjavaruntime.IToken;
20
import lpg.runtime.IToken;
21
import org.eclipse.emf.common.notify.Notification;
21
import org.eclipse.emf.common.notify.Notification;
22
import org.eclipse.emf.ecore.EClass;
22
import org.eclipse.emf.ecore.EClass;
23
import org.eclipse.emf.ecore.impl.ENotificationImpl;
23
import org.eclipse.emf.ecore.impl.ENotificationImpl;
Lines 217-223 Link Here
217
217
218
	/**
218
	/**
219
	 * <!-- begin-user-doc -->
219
	 * <!-- begin-user-doc -->
220
	 * @since 1.3
220
	 * @since 3.0
221
	 * <!-- end-user-doc -->
221
	 * <!-- end-user-doc -->
222
	 * @generated
222
	 * @generated
223
	 */
223
	 */
Lines 227-233 Link Here
227
227
228
	/**
228
	/**
229
	 * <!-- begin-user-doc -->
229
	 * <!-- begin-user-doc -->
230
	 * @since 1.3
230
	 * @since 3.0
231
	 * <!-- end-user-doc -->
231
	 * <!-- end-user-doc -->
232
	 * @generated
232
	 * @generated
233
	 */
233
	 */
Lines 241-247 Link Here
241
241
242
	/**
242
	/**
243
	 * <!-- begin-user-doc -->
243
	 * <!-- begin-user-doc -->
244
	 * @since 1.3
244
	 * @since 3.0
245
	 * <!-- end-user-doc -->
245
	 * <!-- end-user-doc -->
246
	 * @generated
246
	 * @generated
247
	 */
247
	 */
Lines 251-257 Link Here
251
251
252
	/**
252
	/**
253
	 * <!-- begin-user-doc -->
253
	 * <!-- begin-user-doc -->
254
	 * @since 1.3
254
	 * @since 3.0
255
	 * <!-- end-user-doc -->
255
	 * <!-- end-user-doc -->
256
	 * @generated
256
	 * @generated
257
	 */
257
	 */
(-)model/OCLCST.ecore (-1 / +1 lines)
Lines 15-21 Link Here
15
          eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EJavaObject"
15
          eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EJavaObject"
16
          transient="true"/>
16
          transient="true"/>
17
    </eClassifiers>
17
    </eClassifiers>
18
    <eClassifiers xsi:type="ecore:EDataType" name="IToken" instanceClassName="lpg.lpgjavaruntime.IToken"/>
18
    <eClassifiers xsi:type="ecore:EDataType" name="IToken" instanceClassName="lpg.runtime.IToken"/>
19
    <eClassifiers xsi:type="ecore:EClass" name="PackageDeclarationCS" eSuperTypes="#//cst/CSTNode">
19
    <eClassifiers xsi:type="ecore:EClass" name="PackageDeclarationCS" eSuperTypes="#//cst/CSTNode">
20
      <eStructuralFeatures xsi:type="ecore:EReference" name="pathNameCS" eType="#//cst/PathNameCS"
20
      <eStructuralFeatures xsi:type="ecore:EReference" name="pathNameCS" eType="#//cst/PathNameCS"
21
          containment="true"/>
21
          containment="true"/>
(-)model/OCLCST.uml (-1 / +1 lines)
Lines 859-865 Link Here
859
  <Ecore:EClass xmi:id="_qf-8J_8fEduhWtVvKtiQ7w" base_Class="_qdx-Vf8fEduhWtVvKtiQ7w"/>
859
  <Ecore:EClass xmi:id="_qf-8J_8fEduhWtVvKtiQ7w" base_Class="_qdx-Vf8fEduhWtVvKtiQ7w"/>
860
  <Ecore:EClass xmi:id="_qf-8KP8fEduhWtVvKtiQ7w" base_Class="_qdx-V_8fEduhWtVvKtiQ7w"/>
860
  <Ecore:EClass xmi:id="_qf-8KP8fEduhWtVvKtiQ7w" base_Class="_qdx-V_8fEduhWtVvKtiQ7w"/>
861
  <Ecore:EAttribute xmi:id="_qf-8Kf8fEduhWtVvKtiQ7w"/>
861
  <Ecore:EAttribute xmi:id="_qf-8Kf8fEduhWtVvKtiQ7w"/>
862
  <Ecore:EDataType xmi:id="_wn-44I2FEd2mlKUM3HGxZg" instanceClassName="lpg.lpgjavaruntime.IToken" base_PrimitiveType="_tvVQwI2FEd2mlKUM3HGxZg"/>
862
  <Ecore:EDataType xmi:id="_wn-44I2FEd2mlKUM3HGxZg" instanceClassName="lpg.runtime.IToken" base_PrimitiveType="_tvVQwI2FEd2mlKUM3HGxZg"/>
863
  <Ecore:EAttribute xmi:id="_qkehgI2JEd2mlKUM3HGxZg" isTransient="true" base_Property="_PkTnII2GEd2mlKUM3HGxZg"/>
863
  <Ecore:EAttribute xmi:id="_qkehgI2JEd2mlKUM3HGxZg" isTransient="true" base_Property="_PkTnII2GEd2mlKUM3HGxZg"/>
864
  <Ecore:EAttribute xmi:id="_na5BwI2GEd2mlKUM3HGxZg" isTransient="true" base_Property="_kTt1cI2GEd2mlKUM3HGxZg"/>
864
  <Ecore:EAttribute xmi:id="_na5BwI2GEd2mlKUM3HGxZg" isTransient="true" base_Property="_kTt1cI2GEd2mlKUM3HGxZg"/>
865
  <Ecore:EAttribute xmi:id="_CoEkwI2HEd2mlKUM3HGxZg" isTransient="true" base_Property="_xJpmEI2GEd2mlKUM3HGxZg"/>
865
  <Ecore:EAttribute xmi:id="_CoEkwI2HEd2mlKUM3HGxZg" isTransient="true" base_Property="_xJpmEI2GEd2mlKUM3HGxZg"/>
(-)META-INF/MANIFEST.MF (-1 / +1 lines)
Lines 33-39 Link Here
33
Require-Bundle: org.eclipse.core.runtime;bundle-version="[3.2.0,4.0.0)",
33
Require-Bundle: org.eclipse.core.runtime;bundle-version="[3.2.0,4.0.0)",
34
 org.eclipse.emf.ecore;bundle-version="[2.4.0,3.0.0)";visibility:=reexport,
34
 org.eclipse.emf.ecore;bundle-version="[2.4.0,3.0.0)";visibility:=reexport,
35
 org.eclipse.emf.ecore.xmi;bundle-version="[2.4.0,3.0.0)";visibility:=reexport,
35
 org.eclipse.emf.ecore.xmi;bundle-version="[2.4.0,3.0.0)";visibility:=reexport,
36
 net.sourceforge.lpg.lpgjavaruntime;version="[1.0.0,1.2.0)";visibility:=reexport
36
 lpg.runtime;bundle-version="2.0.17";visibility:=reexport
37
Bundle-Activator: org.eclipse.ocl.internal.OCLPlugin$Implementation
37
Bundle-Activator: org.eclipse.ocl.internal.OCLPlugin$Implementation
38
Eclipse-LazyStart: true
38
Eclipse-LazyStart: true
39
Bundle-ActivationPolicy: lazy
39
Bundle-ActivationPolicy: lazy
(-)src/org/eclipse/ocl/internal/helper/OCLSyntaxHelper.java (-1 / +1 lines)
Lines 28-34 Link Here
28
import java.util.ListIterator;
28
import java.util.ListIterator;
29
import java.util.Set;
29
import java.util.Set;
30
30
31
import lpg.lpgjavaruntime.IToken;
31
import lpg.runtime.IToken;
32
32
33
import org.eclipse.emf.common.util.EList;
33
import org.eclipse.emf.common.util.EList;
34
import org.eclipse.emf.ecore.EObject;
34
import org.eclipse.emf.ecore.EObject;
(-)src/org/eclipse/ocl/parser/backtracking/OCLBacktrackingKWLexer.gi (+35 lines)
Added Link Here
1
--/**
2
-- * <copyright>
3
-- *
4
-- * Copyright (c) 2008, 2009 IBM Corporation and others.
5
-- * All rights reserved.   This program and the accompanying materials
6
-- * are made available under the terms of the Eclipse Public License v1.0
7
-- * which accompanies this distribution, and is available at
8
-- * http://www.eclipse.org/legal/epl-v10.html
9
-- *
10
-- * Contributors:
11
-- *   IBM - Initial API and implementation
12
-- *   E.D.Willink - Lexer and Parser refactoring to support extensibility and flexible error handling
13
-- *   Adolfo Sanchez-Barbudo Herrera (Open Canarias) - LPG v 2.0.17 adoption (242153)
14
-- *
15
-- * </copyright>
16
-- *
17
-- * $Id: OCLBacktrackingKWLexer.g,v 1.1 2009/01/13 20:31:30 cdamus Exp $
18
-- */
19
--
20
-- The OCL Backtracking KeyWord Lexer, which is nominally identical to the
21
-- normal KeyWord Lexer, however the extra ERROR_TOKEN symbol makes it difficult
22
-- to share reliably.
23
--
24
25
%options slr
26
%options fp=OCLBacktrackingKWLexer,prefix=Char_
27
%options noserialize
28
%options package=org.eclipse.ocl.parser.backtracking
29
%options template=../../lpg/KeywordTemplateD.gi
30
%options export_terminals=("OCLBacktrackingParsersym.java", "TK_")
31
%options include_directory="..;../../lpg"
32
33
%Import
34
	OCLKWLexer.gi
35
%End
(-)src/org/eclipse/ocl/parser/backtracking/OCLParserErrors.gi (+191 lines)
Added Link Here
1
--/**
2
-- * <copyright>
3
-- *
4
-- * Copyright (c) 2008 Eclipse.org and others.
5
-- * All rights reserved.   This program and the accompanying materials
6
-- * are made available under the terms of the Eclipse Public License v1.0
7
-- * which accompanies this distribution, and is available at
8
-- * http://www.eclipse.org/legal/epl-v10.html
9
-- *
10
-- * Contributors:
11
-- *   E.D. Willink - Initial API and implementation
12
-- *   Adolfo Sanchez-Barbudo Herrera (Open Canarias) - LPG v 2.0.17 adoption (242153)
13
-- *
14
-- * </copyright>
15
-- *
16
-- * $Id: OCLParserErrors.g,v 1.1 2009/01/13 20:31:30 cdamus Exp $
17
-- */
18
--
19
-- Additional ERROR_TOKEN rules for The OCL Parser
20
--
21
22
%Import
23
	OCLParser.g
24
%End
25
26
%Import
27
	EssentialOCLErrors.gi
28
%End
29
30
%Rules
31
32
	classifierContextDeclCS ::= context pathNameCS ERROR_TOKEN
33
		/.$BeginCode
34
					reportErrorTokenMessage($getToken(3), OCLParserErrors.MISSING_INV_OR_DEF);
35
					CSTNode result = createClassifierContextDeclCS(
36
							(PathNameCS)$getSym(2),
37
							new BasicEList<InvOrDefCS>()
38
						);
39
					setOffsets(result, getIToken($getToken(1)), getIToken($getToken(3)));
40
					$setResult(result);
41
		  $EndCode
42
		./
43
		
44
	defExpressionCS ::= typedVariableCS ERROR_TOKEN
45
		/.$BeginCode
46
					reportErrorTokenMessage($getToken(2), OCLParserErrors.MISSING_EQUALS);
47
					VariableCS variableCS = (VariableCS)$getSym(1);
48
					CSTNode result = createDefExpressionCS(
49
							variableCS,
50
							null,
51
							null
52
						);
53
					setOffsets(result, variableCS, getIToken($getToken(2)));
54
					$setResult(result);
55
		  $EndCode
56
		./
57
	defExpressionCS ::= IDENTIFIER ERROR_Colon
58
		/.$BeginCode
59
					VariableCS variableCS = createVariableCS(
60
								getTokenText($getToken(1)),
61
								null,
62
								null
63
							);
64
					setOffsets(variableCS, getIToken($getToken(1)), getIToken($getToken(2)));
65
					CSTNode result = createDefExpressionCS(
66
							variableCS,
67
							null,
68
							null
69
						);
70
					setOffsets(result, variableCS, getIToken($getToken(2)));
71
					$setResult(result);
72
		  $EndCode
73
		./
74
75
	initOrDerValueCS ::= init ERROR_Colon
76
		/.$BeginCode
77
					CSTNode result = createInitValueCS(null);
78
					setOffsets(result, getIToken($getToken(2)), getIToken($getToken(3)));
79
					$setResult(result);
80
		  $EndCode
81
		./
82
	initOrDerValueCS ::= derive ERROR_Colon
83
		/.$BeginCode
84
					CSTNode result = createDerValueCS(null);
85
					setOffsets(result, getIToken($getToken(2)), getIToken($getToken(3)));
86
					$setResult(result);
87
		  $EndCode
88
		./
89
		
90
	invOrDefCS ::= inv simpleNameCS ERROR_Colon
91
		/.$BeginCode
92
					CSTNode result = createInvCS(
93
							(SimpleNameCS)$getSym(2),
94
							null
95
						);
96
					setOffsets(result, getIToken($getToken(1)), getIToken($getToken(3)));
97
					$setResult(result);
98
		  $EndCode
99
		./	
100
	invOrDefCS ::= def simpleNameCS ERROR_Colon
101
		/.$BeginCode
102
					CSTNode result = createDefCS(
103
							(SimpleNameCS)$getSym(2),
104
							null
105
						);
106
					setOffsets(result, getIToken($getToken(1)), getIToken($getToken(3)));
107
					$setResult(result);
108
		  $EndCode
109
		./
110
111
	packageDeclarationCS ::= package pathNameCS contextDeclCSmopt ERROR_Empty endpackage
112
		/.$BeginCode
113
					CSTNode result = createPackageDeclarationCS(
114
							(PathNameCS)$getSym(2),
115
							(EList)$getSym(3)
116
						);
117
					setOffsets(result, getIToken($getToken(1)), getIToken($getToken(5)));
118
					$setResult(result);
119
		  $EndCode
120
		./
121
	packageDeclarationCS ::= package pathNameCS contextDeclCSmopt ERROR_TOKEN
122
		/.$BeginCode
123
					reportErrorTokenMessage($getToken(4), OCLParserErrors.MISSING_ENDPACKAGE);
124
					CSTNode result = createPackageDeclarationCS(
125
							(PathNameCS)$getSym(2),
126
							(EList)$getSym(3)
127
						);
128
					setOffsets(result, getIToken($getToken(1)), getIToken($getToken(4)));
129
					$setResult(result);
130
		  $EndCode
131
		./
132
	packageDeclarationCS ::= package ERROR_PathNameCS
133
		/.$BeginCode
134
					CSTNode result = createPackageDeclarationCS(
135
							(PathNameCS)$getSym(2),
136
							new BasicEList()
137
						);
138
					setOffsets(result, getIToken($getToken(1)), getIToken($getToken(2)));
139
					$setResult(result);
140
		  $EndCode
141
		./
142
		
143
	prePostOrBodyDeclCS ::= pre simpleNameCS ERROR_Colon
144
		/.$BeginCode
145
					CSTNode result = createPrePostOrBodyDeclCS(
146
							PrePostOrBodyEnum.PRE_LITERAL,
147
							(SimpleNameCS)$getSym(2),
148
							createInvalidLiteralExpCS(getTokenText($getToken(3)))
149
						);
150
					setOffsets(result, getIToken($getToken(1)), getIToken($getToken(3)));
151
					$setResult(result);
152
		  $EndCode
153
		./
154
	prePostOrBodyDeclCS ::= post simpleNameCS ERROR_Colon
155
		/.$BeginCode
156
					CSTNode result = createPrePostOrBodyDeclCS(
157
							PrePostOrBodyEnum.POST_LITERAL,
158
							(SimpleNameCS)$getSym(2),
159
							createInvalidLiteralExpCS(getTokenText($getToken(3)))
160
						);
161
					setOffsets(result, getIToken($getToken(1)), getIToken($getToken(3)));
162
					$setResult(result);
163
		  $EndCode
164
		./
165
	prePostOrBodyDeclCS ::= body simpleNameCS ERROR_Colon
166
		/.$BeginCode
167
					CSTNode result = createPrePostOrBodyDeclCS(
168
							PrePostOrBodyEnum.BODY_LITERAL,
169
							(SimpleNameCS)$getSym(2),
170
							createInvalidLiteralExpCS(getTokenText($getToken(3)))
171
						);
172
					setOffsets(result, getIToken($getToken(1)), getIToken($getToken(3)));
173
					$setResult(result);
174
		  $EndCode
175
		./
176
		
177
	propertyContextCS ::= context pathNameCS '::' ERROR_SimpleNameCS
178
		/.$BeginCode
179
					SimpleNameCS simpleNameCS = (SimpleNameCS)$getSym(4);
180
					CSTNode result = createPropertyContextCS(
181
							(PathNameCS)$getSym(2),
182
							simpleNameCS,
183
							null,
184
							null
185
						);
186
					setOffsets(result, getIToken($getToken(1)), simpleNameCS);
187
					$setResult(result);
188
		  $EndCode
189
		./
190
		
191
%End
(-)src/org/eclipse/ocl/parser/OCLKWLexer.gi (+562 lines)
Added Link Here
1
--/**
2
-- * <copyright>
3
-- *
4
-- * Copyright (c) 2005, 2009 IBM Corporation and others.
5
-- * All rights reserved.   This program and the accompanying materials
6
-- * are made available under the terms of the Eclipse Public License v1.0
7
-- * which accompanies this distribution, and is available at
8
-- * http://www.eclipse.org/legal/epl-v10.html
9
-- *
10
-- * Contributors:
11
-- *   See (or edit) Notice Declaration below
12
-- *
13
-- * </copyright>
14
-- *
15
-- * $Id: OCLKWLexer.g,v 1.1 2007/10/11 23:05:00 cdamus Exp $
16
-- */
17
--
18
-- The OCL KeyWord Lexer
19
--
20
21
%options slr
22
%options fp=OCLKWLexer,prefix=Char_
23
%options noserialize
24
%options package=org.eclipse.ocl.parser
25
%options template=../lpg/KeywordTemplateD.gi
26
%options export_terminals=("OCLParsersym.java", "TK_")
27
%options include_directory="../lpg"
28
29
%Define
30
31
	--
32
	-- Definition of macros used in the template
33
	--
34
	$action_class /.$file_prefix./
35
	$eof_char /.Char_EOF./
36
	$copyright_contributions /.*./
37
	
38
%End
39
40
%Notice
41
	/./**
42
 * <copyright>
43
 *
44
 * Copyright (c) 2005, 2009 IBM Corporation and others.
45
 * All rights reserved.   This program and the accompanying materials
46
 * are made available under the terms of the Eclipse Public License v1.0
47
 * which accompanies this distribution, and is available at
48
 * http://www.eclipse.org/legal/epl-v10.html
49
 *
50
 * Contributors:
51
 *   IBM - Initial API and implementation
52
 *   E.D.Willink - Lexer and Parser refactoring to support extensibility and flexible error handling
53
 *   E.D.Willink - Bug 285633 static definitions
54
 *   Adolfo Sanchez-Barbudo Herrera (Open Canarias) - LPG v 2.0.17 adoption (242153)
55
$copyright_contributions
56
 * </copyright>
57
 *
58
 * 
59
 */
60
	./
61
%End
62
63
%Globals
64
	/../
65
%End
66
67
%Import
68
	KWLexerMap.gi
69
%End
70
71
%Export
72
	self
73
	inv
74
	pre
75
	post
76
	context
77
	package
78
	endpackage
79
	def
80
	if
81
	then
82
	else
83
	endif
84
	and
85
	or
86
	xor
87
	not
88
	implies
89
	let
90
	in
91
	true
92
	false
93
94
	--
95
	-- the following appear to have been omitted from the list of
96
	-- OCL reserved words in Section 7.4.9.  They will be treated 
97
	-- as unreserved for compliance. They are reserved as from
98
	-- OCL 2.1 RTF 09-05-02
99
	--
100
	body
101
	derive
102
	init
103
	null
104
	invalid
105
--  return  -- don't need a keyword for LPG purposes
106
	
107
	--
108
	-- the following are not used in the OCL concrete syntax, but
109
	-- are defined as reserved words in the OCL 2.0 Spec 7.4.9
110
	-- and were removed in the OCL 2.1 RTF 09-05-02. 
111
	--
112
	attr
113
	oper
114
115
	--
116
	-- the following were introduced in the OCL 2.1 RTF 09-05-02. 
117
	--
118
	static
119
120
	--
121
	-- the remainder of the LPG keywords are defined as such for the
122
	-- purpose of constructing the CST grammar.  They are not OCL
123
	-- reserved words
124
	--		
125
	Set
126
	Bag
127
	Sequence
128
	Collection
129
	OrderedSet
130
131
	iterate
132
	forAll
133
	exists
134
	isUnique
135
	any
136
	one
137
138
	collect
139
	select
140
	reject
141
	collectNested
142
	sortedBy
143
144
	--
145
	-- the following is an MDT-OCL extension prototyping OMG Issue 13944. 
146
	--
147
	closure
148
149
	oclIsKindOf
150
	oclIsTypeOf
151
	oclAsType
152
	oclIsNew
153
	oclIsUndefined
154
	oclIsInvalid
155
	oclIsInState
156
	allInstances
157
158
	String
159
	Integer
160
	UnlimitedNatural
161
	Real
162
	Boolean
163
	Tuple
164
	OclAny
165
	OclVoid
166
	OclInvalid
167
	OclMessage
168
%End
169
170
%Start
171
	KeyWord
172
%End
173
174
%Rules
175
176
-- The Goal for the parser is a single Keyword
177
178
	KeyWord ::=
179
		s e l f
180
		/.$BeginAction
181
			$setResult($_self);
182
		  $EndAction
183
		./
184
185
		| i n v
186
		/.$BeginAction
187
			$setResult($_inv);
188
		  $EndAction
189
		./
190
191
		| p r e
192
		/.$BeginAction
193
			$setResult($_pre);
194
		  $EndAction
195
		./
196
197
		| p o s t
198
		/.$BeginAction
199
			$setResult($_post);
200
		  $EndAction
201
		./
202
		
203
		| b o d y
204
		/.$BeginAction
205
			$setResult($_body);
206
		  $EndAction
207
		./
208
		
209
		| c o n t e x t
210
		/.$BeginAction
211
			$setResult($_context);
212
		  $EndAction
213
		./
214
		
215
		| p a c k a g e
216
		/.$BeginAction
217
			$setResult($_package);
218
		  $EndAction
219
		./
220
		
221
		| e n d p a c k a g e
222
		/.$BeginAction
223
			$setResult($_endpackage);
224
		  $EndAction
225
		./
226
		
227
		| d e f
228
		/.$BeginAction
229
			$setResult($_def);
230
		  $EndAction
231
		./
232
		
233
		| d e r i v e
234
		/.$BeginAction
235
			$setResult($_derive);
236
		  $EndAction
237
		./
238
		
239
		| i n i t
240
		/.$BeginAction
241
			$setResult($_init);
242
		  $EndAction
243
		./
244
		
245
		| i f
246
		/.$BeginAction
247
			$setResult($_if);
248
		  $EndAction
249
		./
250
		
251
		| t h e n
252
		/.$BeginAction
253
			$setResult($_then);
254
		  $EndAction
255
		./
256
		
257
		| e l s e
258
		/.$BeginAction
259
			$setResult($_else);
260
		  $EndAction
261
		./
262
		
263
		| e n d i f
264
		/.$BeginAction
265
			$setResult($_endif);
266
		  $EndAction
267
		./
268
		
269
		| a n d
270
		/.$BeginAction
271
			$setResult($_and);
272
		  $EndAction
273
		./
274
		
275
		| o r
276
		/.$BeginAction
277
			$setResult($_or);
278
		  $EndAction
279
		./
280
		
281
		| x o r
282
		/.$BeginAction
283
			$setResult($_xor);
284
		  $EndAction
285
		./
286
		
287
		| n o t
288
		/.$BeginAction
289
			$setResult($_not);
290
		  $EndAction
291
		./
292
		
293
		| i m p l i e s
294
		/.$BeginAction
295
			$setResult($_implies);
296
		  $EndAction
297
		./
298
		
299
		| l e t
300
		/.$BeginAction
301
			$setResult($_let);
302
		  $EndAction
303
		./
304
		
305
		| i n
306
		/.$BeginAction
307
			$setResult($_in);
308
		  $EndAction
309
		./
310
		
311
		| t r u e
312
		/.$BeginAction
313
			$setResult($_true);
314
		  $EndAction
315
		./
316
		
317
		| f a l s e
318
		/.$BeginAction
319
			$setResult($_false);
320
		  $EndAction
321
		./
322
		
323
		| S e t
324
		/.$BeginAction
325
			$setResult($_Set);
326
		  $EndAction
327
		./
328
		
329
		| B a g
330
		/.$BeginAction
331
			$setResult($_Bag);
332
		  $EndAction
333
		./
334
		
335
		| S e q u e n c e
336
		/.$BeginAction
337
			$setResult($_Sequence);
338
		  $EndAction
339
		./
340
		
341
		| C o l l e c t i o n
342
		/.$BeginAction
343
			$setResult($_Collection);
344
		  $EndAction
345
		./
346
347
		| O r d e r e d S e t
348
		/.$BeginAction
349
			$setResult($_OrderedSet);
350
		  $EndAction
351
		./
352
353
		| i t e r a t e
354
		/.$BeginAction
355
			$setResult($_iterate);
356
		  $EndAction
357
		./
358
		
359
		| f o r A l l
360
		/.$BeginAction
361
			$setResult($_forAll);
362
		  $EndAction
363
		./
364
		
365
		| e x i s t s
366
		/.$BeginAction
367
			$setResult($_exists);
368
		  $EndAction
369
		./
370
		
371
		| i s U n i q u e
372
		/.$BeginAction
373
			$setResult($_isUnique);
374
		  $EndAction
375
		./
376
		
377
		| a n y
378
		/.$BeginAction
379
			$setResult($_any);
380
		  $EndAction
381
		./
382
		
383
		| o n e
384
		/.$BeginAction
385
			$setResult($_one);
386
		  $EndAction
387
		./
388
389
		| c o l l e c t
390
		/.$BeginAction
391
			$setResult($_collect);
392
		  $EndAction
393
		./
394
		
395
		| s e l e c t
396
		/.$BeginAction
397
			$setResult($_select);
398
		  $EndAction
399
		./
400
		
401
		| r e j e c t
402
		/.$BeginAction
403
			$setResult($_reject);
404
		  $EndAction
405
		./
406
		
407
		| c o l l e c t N e s t e d
408
		/.$BeginAction
409
			$setResult($_collectNested);
410
		  $EndAction
411
		./
412
		
413
		| s o r t e d B y
414
		/.$BeginAction
415
			$setResult($_sortedBy);
416
		  $EndAction
417
		./
418
419
		| c l o s u r e
420
		/.$BeginAction
421
			$setResult($_closure);
422
		  $EndAction
423
		./
424
		
425
		| o c l I s K i n d O f
426
		/.$BeginAction
427
			$setResult($_oclIsKindOf);
428
		  $EndAction
429
		./
430
431
		| o c l I s T y p e O f
432
		/.$BeginAction
433
			$setResult($_oclIsTypeOf);
434
		  $EndAction
435
		./
436
		
437
		| o c l A s T y p e
438
		/.$BeginAction
439
			$setResult($_oclAsType);
440
		  $EndAction
441
		./
442
		
443
		| o c l I s N e w
444
		/.$BeginAction
445
			$setResult($_oclIsNew);
446
		  $EndAction
447
		./
448
		
449
		| o c l I s U n d e f i n e d
450
		/.$BeginAction
451
			$setResult($_oclIsUndefined);
452
		  $EndAction
453
		./
454
		
455
		| o c l I s I n v a l i d
456
		/.$BeginAction
457
			$setResult($_oclIsInvalid);
458
		  $EndAction
459
		./
460
		
461
		| o c l I s I n S t a t e
462
		/.$BeginAction
463
			$setResult($_oclIsInState);
464
		  $EndAction
465
		./
466
		
467
		| a l l I n s t a n c e s
468
		/.$BeginAction
469
			$setResult($_allInstances);
470
		  $EndAction
471
		./
472
473
		| S t r i n g
474
		/.$BeginAction
475
			$setResult($_String);
476
		  $EndAction
477
		./
478
479
		| I n t e g e r
480
		/.$BeginAction
481
			$setResult($_Integer);
482
		  $EndAction
483
		./
484
		
485
		| U n l i m i t e d N a t u r a l
486
		/.$BeginAction
487
			$setResult($_UnlimitedNatural);
488
		  $EndAction
489
		./
490
		
491
		| R e a l
492
		/.$BeginAction
493
			$setResult($_Real);
494
		  $EndAction
495
		./
496
		
497
		| B o o l e a n
498
		/.$BeginAction
499
			$setResult($_Boolean);
500
		  $EndAction
501
		./
502
503
		| T u p l e
504
		/.$BeginAction
505
			$setResult($_Tuple);
506
		  $EndAction
507
		./
508
509
		| O c l A n y
510
		/.$BeginAction
511
			$setResult($_OclAny);
512
		  $EndAction
513
		./
514
515
		| O c l V o i d
516
		/.$BeginAction
517
			$setResult($_OclVoid);
518
		  $EndAction
519
		./
520
521
		| O c l I n v a l i d
522
		/.$BeginAction
523
			$setResult($_OclInvalid);
524
		  $EndAction
525
		./
526
527
		| O c l M e s s a g e
528
		/.$BeginAction
529
			$setResult($_OclMessage);
530
		  $EndAction
531
		./
532
533
		| n u l l
534
		/.$BeginAction
535
			$setResult($_null);
536
		  $EndAction
537
		./
538
539
		| i n v a l i d
540
		/.$BeginAction
541
			$setResult($_invalid);
542
		  $EndAction
543
		./
544
545
		| a t t r
546
		/.$BeginAction
547
			$setResult($_attr);
548
		  $EndAction
549
		./
550
551
		| o p e r
552
		/.$BeginAction
553
			$setResult($_oper);
554
		  $EndAction
555
		./
556
557
		| s t a t i c
558
		/.$BeginAction
559
			$setResult($_static);
560
		  $EndAction
561
		./
562
%End
(-)src/org/eclipse/ocl/lpg/LexerTemplateD.gi (+236 lines)
Added Link Here
1
--
2
-- An instance of this template must have a $Export section and the export_terminals option
3
--
4
-- Macros that may be redefined in an instance of this template
5
--
6
--     $eof_token
7
--     $additional_interfaces
8
--     $super_stream_class -- subclass com.ibm.lpg.LpgLexStream for getKind
9
--     $prs_stream_class -- use /.PrsStream./ if not subclassing
10
--
11
-- B E G I N N I N G   O F   T E M P L A T E   LexerTemplateD
12
--
13
%options programming_language=java,margin=4
14
%options table
15
%options action=("*.java", "/.", "./")
16
%options ParseTable=lpg.runtime.ParseTable
17
%options prefix=Char_
18
19
--
20
-- This template requires that the name of the EOF token be set
21
-- to EOF and that the prefix be "Char_" to be consistent with
22
-- KeywordTemplateD.
23
--
24
%Eof
25
    EOF
26
%End
27
28
--
29
-- This template also requires that the name of the parser EOF
30
-- Token to be exported be set to EOF_TOKEN
31
--
32
%Export
33
    EOF_TOKEN
34
%End
35
36
%Define
37
    --
38
    -- Macros that are be needed in an instance of this template
39
    --
40
    $eof_token /.$_EOF_TOKEN./
41
    
42
    $additional_interfaces /../
43
    $super_stream_class /.AbstractLexer./
44
    $prs_stream_class /.AbstractParser./
45
    $environment_class /.BasicEnvironment./
46
    $adapt_environment /.environment./
47
    
48
49
    $prs_stream /. // macro prs_stream is deprecated. Use function getPrsStream
50
                  getPrsStream()./
51
    $setSym1 /. // macro setSym1 is deprecated. Use function setResult
52
               lexParser.setSym1./
53
    $setResult /. // macro setResult is deprecated. Use function setResult
54
                 lexParser.setSym1./
55
    $getSym /. // macro getSym is deprecated. Use function getLastToken
56
              lexParser.getSym./
57
    $getToken /. // macro getToken is deprecated. Use function getToken
58
                lexParser.getToken./
59
    $getLeftSpan /. // macro getLeftSpan is deprecated. Use function getLeftSpan
60
                   lexParser.getFirstToken./
61
    $getRightSpan /. // macro getRightSpan is deprecated. Use function getRightSpan
62
                    lexParser.getLastToken./
63
64
    --
65
    -- Macros useful for specifying actions
66
    --
67
    $Header
68
    /.
69
                //
70
                // Rule $rule_number:  $rule_text
71
                //./
72
73
    $DefaultAction
74
    /. $Header
75
                case $rule_number: { ./
76
77
    $BeginAction /.$DefaultAction./
78
79
    $EndAction
80
    /.          break;
81
                }./
82
83
    $BeginJava
84
    /.$BeginAction
85
                $symbol_declarations./
86
87
    $EndJava /.$EndAction./
88
89
    $NoAction
90
    /. $Header
91
                case $rule_number:
92
                    break; ./
93
94
    $BeginActions
95
    /.
96
        public void ruleAction( int ruleNumber)
97
        {
98
            switch(ruleNumber)
99
            {./
100
101
    $SplitActions
102
    /.
103
	            default:
104
	                ruleAction$rule_number(ruleNumber);
105
	                break;
106
	        }
107
	        return;
108
	    }
109
	
110
	    public void ruleAction$rule_number(int ruleNumber)
111
	    {
112
	        switch (ruleNumber)
113
	        {./
114
115
    $EndActions
116
    /.
117
                default:
118
                    break;
119
            }
120
            return;
121
        }./
122
%End
123
124
%Globals
125
    /.import lpg.runtime.*;
126
    import org.eclipse.ocl.lpg.AbstractLexer;
127
    import org.eclipse.ocl.lpg.AbstractParser;
128
    ./
129
%End
130
131
%Headers
132
    /.
133
    @SuppressWarnings("nls")
134
    public class $action_type extends $super_stream_class implements $exp_type, $sym_type, RuleAction$additional_interfaces
135
    {
136
        private static ParseTable prs = new $prs_type();
137
        //
138
        // The Lexer contains an array of characters as the input stream to be parsed.
139
        // There are methods to retrieve and classify characters.
140
        // The lexparser "token" is implemented simply as the index of the next character in the array.
141
        // The Lexer extends the abstract class LpgLexStream with an implementation of the abstract
142
        // method getKind.  The template defines the Lexer class and the lexer() method.
143
        // A driver creates the action class, "Lexer", passing an Option object to the constructor.
144
        //
145
        protected $kw_lexer_class kwLexer;
146
        protected boolean printTokens;
147
        private $prs_stream_class parser;
148
        private LexParser lexParser = new LexParser(this, prs, this);
149
        
150
        private final $environment_class oclEnvironment;
151
152
        public $action_type($environment_class environment) {
153
            super($adapt_environment);
154
            oclEnvironment = environment;
155
        }
156
        
157
		public $action_class($environment_class environment, char[] chars) {
158
			this(environment, chars, "OCL", ECLIPSE_TAB_VALUE);
159
			kwLexer = new $kw_lexer_class(getInputChars(), $_IDENTIFIER);
160
		}
161
162
        public $action_type($environment_class environment, char[] input_chars, String filename, int tab)  {
163
            super($adapt_environment, input_chars, filename, tab);
164
            oclEnvironment = environment;
165
        }
166
        
167
		public $environment_class getOCLEnvironment() {
168
        	return oclEnvironment;
169
        }
170
171
        @Override
172
        public int [] getKeywordKinds() { return kwLexer.getKeywordKinds(); }
173
174
        public int getLeftSpan() { return lexParser.getFirstToken(); }
175
        public $prs_stream_class getParser() { return parser; }
176
        public int getRhsFirstTokenIndex(int i) { return lexParser.getFirstToken(i); }
177
        public int getRhsLastTokenIndex(int i) { return lexParser.getLastToken(i); }
178
        public int getRightSpan() { return lexParser.getLastToken(); }
179
180
        @Override
181
        public int getToken(int i) { return lexParser.getToken(i); }
182
183
        @Override
184
        public void initialize(char [] content, String filename)
185
        {
186
            super.initialize(content, filename);
187
            if (kwLexer == null)
188
                 kwLexer = new $kw_lexer_class(getInputChars(), $_IDENTIFIER);
189
            else
190
                 kwLexer.setInputChars(getInputChars());
191
        }
192
193
        @Override
194
        public String[] orderedExportedSymbols() { return $exp_type.orderedTerminalSymbols; }
195
        
196
	    @Override
197
	    public void setInputChars(char[] inputChars) {
198
			super.setInputChars(inputChars);
199
			kwLexer = new $kw_lexer_class(getInputChars(), $_IDENTIFIER);
200
		}
201
        
202
        @Override
203
        public void lexToTokens(Monitor monitor, $prs_stream_class parser)
204
        {
205
            if (getInputChars() == null)
206
                throw new NullPointerException("LexStream was not initialized");
207
208
            this.parser = parser;
209
210
            parser.makeToken(0, 0, 0); // Token list must start with a bad token
211
                
212
            lexParser.parseCharacters(monitor);  // Lex the input characters
213
                
214
            int i = getStreamIndex();
215
            parser.makeToken(i, i, $eof_token); // and end with the end of file token
216
            parser.setStreamLength(parser.getSize());
217
                
218
            return;
219
        }
220
    ./
221
%End
222
223
%Rules
224
    /.$BeginActions./
225
%End
226
227
%Trailers
228
    /.
229
        $EndActions
230
    }
231
    ./
232
%End
233
234
--
235
-- E N D   O F   T E M P L A T E
236
--
(-)src/org/eclipse/ocl/lpg/LexerBasicMap.gi (+196 lines)
Added Link Here
1
%Headers
2
    --
3
    -- Additional methods for the action class not provided in the template
4
    --
5
    
6
	-- [cwd] Template provided by LPG defines a constructor that uses an Option
7
	--       class that does not exist in LPG Runtime.  Deleted this constructor
8
	
9
    /.        
10
        final void makeToken(int kind)
11
        {
12
            int startOffset = getLeftSpan(),
13
                endOffset = getRightSpan();
14
            makeToken(startOffset, endOffset, kind);
15
            if (printTokens) printValue(startOffset, endOffset);
16
        }
17
18
        final void makeComment(int kind)
19
        {
20
            int startOffset = getLeftSpan(),
21
                endOffset = getRightSpan();
22
            super.getIPrsStream().makeAdjunct(startOffset, endOffset, kind);
23
        }
24
25
        final void skipToken()
26
        {
27
            if (printTokens) printValue(getLeftSpan(), getRightSpan());
28
        }
29
        
30
        final void checkForKeyWord()
31
        {
32
            int startOffset = getLeftSpan(),
33
                endOffset = getRightSpan(),
34
            kwKind = kwLexer.lexer(startOffset, endOffset);
35
            makeToken(startOffset, endOffset, kwKind);
36
            if (printTokens) printValue(startOffset, endOffset);
37
        }
38
        
39
        final void printValue(int startOffset, int endOffset)
40
        {
41
            String s = new String(getInputChars(), startOffset, endOffset - startOffset + 1);
42
            System.out.print(s);
43
        }
44
45
        //
46
        //
47
        //
48
        public final static int tokenKind[] =
49
        {
50
            Char_CtlCharNotWS,    // 000    0x00
51
            Char_CtlCharNotWS,    // 001    0x01
52
            Char_CtlCharNotWS,    // 002    0x02
53
            Char_CtlCharNotWS,    // 003    0x03
54
            Char_CtlCharNotWS,    // 004    0x04
55
            Char_CtlCharNotWS,    // 005    0x05
56
            Char_CtlCharNotWS,    // 006    0x06
57
            Char_CtlCharNotWS,    // 007    0x07
58
            Char_CtlCharNotWS,    // 008    0x08
59
            Char_HT,              // 009    0x09
60
            Char_LF,              // 010    0x0A
61
            Char_CtlCharNotWS,    // 011    0x0B
62
            Char_FF,              // 012    0x0C
63
            Char_CR,              // 013    0x0D
64
            Char_CtlCharNotWS,    // 014    0x0E
65
            Char_CtlCharNotWS,    // 015    0x0F
66
            Char_CtlCharNotWS,    // 016    0x10
67
            Char_CtlCharNotWS,    // 017    0x11
68
            Char_CtlCharNotWS,    // 018    0x12
69
            Char_CtlCharNotWS,    // 019    0x13
70
            Char_CtlCharNotWS,    // 020    0x14
71
            Char_CtlCharNotWS,    // 021    0x15
72
            Char_CtlCharNotWS,    // 022    0x16
73
            Char_CtlCharNotWS,    // 023    0x17
74
            Char_CtlCharNotWS,    // 024    0x18
75
            Char_CtlCharNotWS,    // 025    0x19
76
            Char_CtlCharNotWS,    // 026    0x1A
77
            Char_CtlCharNotWS,    // 027    0x1B
78
            Char_CtlCharNotWS,    // 028    0x1C
79
            Char_CtlCharNotWS,    // 029    0x1D
80
            Char_CtlCharNotWS,    // 030    0x1E
81
            Char_CtlCharNotWS,    // 031    0x1F
82
            Char_Space,           // 032    0x20
83
            Char_Exclamation,     // 033    0x21
84
            Char_DoubleQuote,     // 034    0x22
85
            Char_Sharp,           // 035    0x23
86
            Char_DollarSign,      // 036    0x24
87
            Char_Percent,         // 037    0x25
88
            Char_Ampersand,       // 038    0x26
89
            Char_SingleQuote,     // 039    0x27
90
            Char_LeftParen,       // 040    0x28
91
            Char_RightParen,      // 041    0x29
92
            Char_Star,            // 042    0x2A
93
            Char_Plus,            // 043    0x2B
94
            Char_Comma,           // 044    0x2C
95
            Char_Minus,           // 045    0x2D
96
            Char_Dot,             // 046    0x2E
97
            Char_Slash,           // 047    0x2F
98
            Char_0,               // 048    0x30
99
            Char_1,               // 049    0x31
100
            Char_2,               // 050    0x32
101
            Char_3,               // 051    0x33
102
            Char_4,               // 052    0x34
103
            Char_5,               // 053    0x35
104
            Char_6,               // 054    0x36
105
            Char_7,               // 055    0x37
106
            Char_8,               // 056    0x38
107
            Char_9,               // 057    0x39
108
            Char_Colon,           // 058    0x3A
109
            Char_SemiColon,       // 059    0x3B
110
            Char_LessThan,        // 060    0x3C
111
            Char_Equal,           // 061    0x3D
112
            Char_GreaterThan,     // 062    0x3E
113
            Char_QuestionMark,    // 063    0x3F
114
            Char_AtSign,          // 064    0x40
115
            Char_A,               // 065    0x41
116
            Char_B,               // 066    0x42
117
            Char_C,               // 067    0x43
118
            Char_D,               // 068    0x44
119
            Char_E,               // 069    0x45
120
            Char_F,               // 070    0x46
121
            Char_G,               // 071    0x47
122
            Char_H,               // 072    0x48
123
            Char_I,               // 073    0x49
124
            Char_J,               // 074    0x4A
125
            Char_K,               // 075    0x4B
126
            Char_L,               // 076    0x4C
127
            Char_M,               // 077    0x4D
128
            Char_N,               // 078    0x4E
129
            Char_O,               // 079    0x4F
130
            Char_P,               // 080    0x50
131
            Char_Q,               // 081    0x51
132
            Char_R,               // 082    0x52
133
            Char_S,               // 083    0x53
134
            Char_T,               // 084    0x54
135
            Char_U,               // 085    0x55
136
            Char_V,               // 086    0x56
137
            Char_W,               // 087    0x57
138
            Char_X,               // 088    0x58
139
            Char_Y,               // 089    0x59
140
            Char_Z,               // 090    0x5A
141
            Char_LeftBracket,     // 091    0x5B
142
            Char_BackSlash,       // 092    0x5C
143
            Char_RightBracket,    // 093    0x5D
144
            Char_Caret,           // 094    0x5E
145
            Char__,               // 095    0x5F
146
            Char_BackQuote,       // 096    0x60
147
            Char_a,               // 097    0x61
148
            Char_b,               // 098    0x62
149
            Char_c,               // 099    0x63
150
            Char_d,               // 100    0x64
151
            Char_e,               // 101    0x65
152
            Char_f,               // 102    0x66
153
            Char_g,               // 103    0x67
154
            Char_h,               // 104    0x68
155
            Char_i,               // 105    0x69
156
            Char_j,               // 106    0x6A
157
            Char_k,               // 107    0x6B
158
            Char_l,               // 108    0x6C
159
            Char_m,               // 109    0x6D
160
            Char_n,               // 110    0x6E
161
            Char_o,               // 111    0x6F
162
            Char_p,               // 112    0x70
163
            Char_q,               // 113    0x71
164
            Char_r,               // 114    0x72
165
            Char_s,               // 115    0x73
166
            Char_t,               // 116    0x74
167
            Char_u,               // 117    0x75
168
            Char_v,               // 118    0x76
169
            Char_w,               // 119    0x77
170
            Char_x,               // 120    0x78
171
            Char_y,               // 121    0x79
172
            Char_z,               // 122    0x7A
173
            Char_LeftBrace,       // 123    0x7B
174
            Char_VerticalBar,     // 124    0x7C
175
            Char_RightBrace,      // 125    0x7D
176
            Char_Tilde,           // 126    0x7E
177
            Char_CtlCharNotWS,    // 127    0x7F
178
179
            Char_Acute,           // for the acute accent 0xb4
180
            Char_AfterASCIINotAcute,  // for all chars in range 0x80..0xfffe excluding the acute accent
181
            Char_EOF              // for '\uffff' or 65535 
182
        };
183
                
184
        @Override public final int getKind(int i)  // Classify character at ith location
185
        {
186
            char c = (i >= getStreamLength() ? '\uffff' : getCharValue(i));
187
            return (c < 128)? // ASCII Character
188
                      tokenKind[c] :
189
                      (c == '\uffff')?
190
                           Char_EOF :
191
                           (c == '\u00b4')?
192
                           Char_Acute :
193
                               Char_AfterASCIINotAcute;
194
        }
195
    ./
196
%End
(-)src/org/eclipse/ocl/parser/EssentialOCL.gi (+1726 lines)
Added Link Here
1
--/**
2
-- * <copyright>
3
-- *
4
-- * Copyright (c) 2005, 2009 IBM Corporation, Borland Software Corp., and others.
5
-- * All rights reserved.   This program and the accompanying materials
6
-- * are made available under the terms of the Eclipse Public License v1.0
7
-- * which accompanies this distribution, and is available at
8
-- * http://www.eclipse.org/legal/epl-v10.html
9
-- *
10
-- * Contributors:
11
-- *   See (or edit) Notice Declaration below
12
-- *
13
-- * </copyright>
14
-- *
15
-- * $Id: EssentialOCL.gi,v 1.7 2009/03/05 14:12:14 cdamus Exp $
16
-- */
17
--
18
-- The EssentialOCL Parser
19
--
20
21
22
%Define
23
24
	-- Definition of macros used in the parser template
25
	--
26
	$prs_stream_class /.AbstractOCLParser./
27
	$prs_parser_class /.DeterministicParser./
28
	$prs_parser_exception /.NotDeterministicParseTableException./
29
	$prs_parser_throw /.throw new RuntimeException("****Error: Regenerate $prs_type.java with -NOBACKTRACK option")./
30
	$prs_parse_args /../
31
	$lex_stream_class /.AbstractLexer./
32
	$action_class /.$file_prefix./
33
	$copyright_contributions /.*./
34
35
	-- package namespace of the LPG Runtime API
36
	$lpg_ns /.lpg.runtime./
37
38
	$NewCase
39
	/. $Header
40
				case $rule_number:./
41
42
	-- From bt/dtParserTemplateD.g
43
	------------------------------------------------------
44
	$Header
45
	/.
46
				//
47
				// Rule $rule_number:  $rule_text
48
				//./
49
50
	$BeginAction
51
	/. $Header
52
				case $rule_number: {./
53
54
	$EndAction
55
	/.		  break;
56
				}./
57
58
    $BeginJava
59
    /../
60
    
61
    $EndJava
62
    /../
63
64
	$BeginCode
65
	/.$BeginAction
66
					$symbol_declarations./
67
68
	$EndCode /.$EndAction./
69
70
	$NoAction
71
	/. $Header
72
				case $rule_number:
73
					break;./
74
75
	$NullAction
76
	/. $Header
77
				case $rule_number:
78
					$setResult(null);
79
					break;./
80
81
	$EmptyListAction
82
	/. $Header
83
				case $rule_number:
84
					$setResult(new BasicEList());
85
					break;./
86
	
87
	$BeginActions
88
	/.
89
		@SuppressWarnings("unchecked")
90
		public void ruleAction(int ruleNumber)
91
		{
92
			switch (ruleNumber) {
93
			./
94
95
	$EndActions
96
	/.
97
				default:
98
					break;
99
			}
100
			return;
101
		}./
102
103
	$additional_interfaces /../
104
	$action_class /.$file_prefix./
105
	$setSym1 /.dtParser.setSym1./
106
	$setResult /.dtParser.setSym1./
107
	$getSym /.dtParser.getSym./
108
	$getToken /.dtParser.getToken./
109
	$getIToken /.getIToken./
110
	$getLeftSpan /.dtParser.getFirstToken./
111
	$getRightSpan /.dtParser.getLastToken./
112
	$prs_stream /.prsStream./
113
	
114
	-- modified to include throwing exceptions
115
	$parserCore
116
	/.
117
	public class $action_class extends $prs_stream_class implements RuleAction$additional_interfaces
118
	{
119
		protected static ParseTable prs = new $prs_type();
120
		private $prs_parser_class dtParser;
121
122
		public $action_class($lex_stream_class lexer) {
123
			super(lexer);
124
		}
125
126
		public int getEOFTokenKind() { return $prs_type.EOFT_SYMBOL; }
127
	
128
		public $environment_class getOCLEnvironment() {
129
			return getLexer().getOCLEnvironment();
130
		}
131
		
132
		@Override 
133
		public $lex_stream_class getLexer() {
134
			return ($lex_stream_class)super.getLexer();
135
		}
136
137
		public String getTokenKindName(int kind) { return $sym_type.orderedTerminalSymbols[kind]; }			
138
139
		@Override
140
		public String[] orderedTerminalSymbols() { return $sym_type.orderedTerminalSymbols; }
141
			
142
		@SuppressWarnings("nls")
143
		@Override
144
		public $ast_type parseTokensToCST(Monitor monitor, int error_repair_count) {
145
			ParseTable prsTable = new $prs_type();
146
147
			try {
148
				dtParser = new $prs_parser_class(monitor, this, prsTable, this);
149
			}
150
			catch ($prs_parser_exception e) {
151
                $prs_parser_throw;
152
			}
153
			catch (BadParseSymFileException e) {
154
				throw new RuntimeException("****Error: Bad Parser Symbol File -- $sym_type.java. Regenerate $prs_type.java");
155
			}
156
157
			try {
158
				return ($ast_type) dtParser.parse($prs_parse_args);
159
			}
160
			catch (BadParseException e) {
161
				reset(e.error_token); // point to error token
162
163
				DiagnoseParser diagnoseParser = new DiagnoseParser(this, prsTable);
164
				diagnoseParser.diagnose(e.error_token);
165
			}
166
167
			return null;
168
		}
169
	
170
        /**
171
         * Initializes a concrete-syntax node's start and end offsets from the
172
         * current token in the parser stream.
173
         * 
174
         * @param cstNode a concrete-syntax node
175
         * 
176
         * @since 1.2
177
         */
178
		protected void setOffsets(CSTNode cstNode) {
179
			IToken firstToken = getIToken($getToken(1));
180
			cstNode.setStartToken(firstToken);
181
			cstNode.setEndToken(firstToken);
182
			cstNode.setStartOffset(firstToken.getStartOffset());
183
			cstNode.setEndOffset(firstToken.getEndOffset()-1);
184
		}
185
	./
186
%End
187
188
%Notice
189
	/./**
190
 * <copyright>
191
 *
192
 * Copyright (c) 2005, 2009 IBM Corporation, Borland Software Corp., and others.
193
 * All rights reserved.   This program and the accompanying materials
194
 * are made available under the terms of the Eclipse Public License v1.0
195
 * which accompanies this distribution, and is available at
196
 * http://www.eclipse.org/legal/epl-v10.html
197
 *
198
 * Contributors:
199
 *   IBM - Initial API and implementation
200
 *   E.D.Willink - Elimination of some shift-reduce conflicts
201
 *   E.D.Willink - Remove unnecessary warning suppression
202
 *   E.D.Willink - Bugs 225493, 243976, 259818, 282882, 287993
203
 *   Zeligsoft - Bug 243976
204
 *   Borland - Bug 242880
205
 *   Adolfo Sanchez-Barbudo Herrera (Open Canarias) - LPG v 2.0.17 adoption (242153)
206
$copyright_contributions
207
 * </copyright>
208
 *
209
 * $Id: EssentialOCL.g,v 1.7 2009/03/05 14:12:14 cdamus Exp $
210
 */
211
	./
212
%End
213
214
%Globals
215
	/.import org.eclipse.emf.common.util.BasicEList;
216
	import org.eclipse.emf.common.util.EList;
217
	import org.eclipse.ocl.cst.CSTNode;
218
	import org.eclipse.ocl.cst.CallExpCS;
219
	import org.eclipse.ocl.cst.CollectionTypeIdentifierEnum;
220
	import org.eclipse.ocl.cst.DotOrArrowEnum;
221
	import org.eclipse.ocl.cst.IntegerLiteralExpCS;
222
	import org.eclipse.ocl.cst.IsMarkedPreCS;
223
	import org.eclipse.ocl.cst.MessageExpCS;
224
	import org.eclipse.ocl.cst.OCLExpressionCS;
225
	import org.eclipse.ocl.cst.OCLMessageArgCS;
226
	import org.eclipse.ocl.cst.OperationCallExpCS;
227
	import org.eclipse.ocl.cst.PathNameCS;
228
	import org.eclipse.ocl.cst.SimpleNameCS;
229
	import org.eclipse.ocl.cst.SimpleTypeEnum;
230
	import org.eclipse.ocl.cst.StateExpCS;
231
	import org.eclipse.ocl.cst.StringLiteralExpCS;
232
	import org.eclipse.ocl.cst.TypeCS;
233
	import org.eclipse.ocl.cst.VariableCS;
234
	import org.eclipse.ocl.util.OCLStandardLibraryUtil;
235
	import org.eclipse.ocl.utilities.PredefinedType;
236
	
237
	import $lpg_ns.BadParseException;
238
	import $lpg_ns.BadParseSymFileException;
239
	import $lpg_ns.$prs_parser_class;
240
	import $lpg_ns.DiagnoseParser;
241
	import $lpg_ns.IToken;
242
	import $lpg_ns.Monitor;
243
	import $lpg_ns.$prs_parser_exception;
244
	import $lpg_ns.ParseTable;
245
	import $lpg_ns.RuleAction;
246
	./
247
%End
248
249
%KeyWords
250
	self
251
	inv
252
	pre
253
	post
254
	endpackage
255
	def
256
	if
257
	then
258
	else
259
	endif
260
	and
261
	or
262
	xor
263
	not
264
	implies
265
	let
266
	in
267
	true
268
	false
269
270
	--
271
	-- the following appear to have been omitted from the list of
272
	-- OCL reserved words in Section 7.4.9.  They will be treated 
273
	-- as unreserved for compliance
274
	--
275
	body
276
	derive
277
	init
278
	null
279
	invalid
280
--  return  -- don't need a keyword for LPG purposes
281
282
	--
283
	-- the remainder of the LPG keywords are defined as such for the
284
	-- purpose of constructing the CST grammar.  They are not OCL
285
	-- reserved words
286
	--		
287
	Set
288
	Bag
289
	Sequence
290
	Collection
291
	OrderedSet
292
293
	iterate
294
	forAll
295
	exists
296
	isUnique
297
	any
298
	one
299
300
	collect
301
	select
302
	reject
303
	collectNested
304
	sortedBy
305
306
	closure
307
308
	oclIsKindOf
309
	oclIsTypeOf
310
	oclAsType
311
	oclIsNew
312
	oclIsUndefined
313
	oclIsInvalid
314
	oclIsInState
315
	allInstances
316
317
	String
318
	Integer
319
	UnlimitedNatural
320
	Real
321
	Boolean
322
	Tuple
323
	OclAny
324
	OclVoid
325
	OclInvalid
326
	OclMessage
327
%End
328
329
%Identifier
330
	IDENTIFIER
331
%End
332
333
%Terminals
334
	
335
	NUMERIC_OPERATION
336
337
	STRING_LITERAL
338
	INTEGER_LITERAL
339
	REAL_LITERAL
340
	
341
	PLUS     ::= '+'
342
	MINUS    ::= '-'
343
	MULTIPLY ::= '*'
344
	DIVIDE   ::= '/'
345
346
	GREATER       ::= '>'
347
	LESS          ::= '<'
348
	EQUAL         ::= '='
349
	GREATER_EQUAL ::= '>='
350
	LESS_EQUAL    ::= '<='
351
	NOT_EQUAL     ::= '<>'
352
353
	LPAREN   ::= '('
354
	RPAREN   ::= ')'
355
	LBRACE   ::= '{'
356
	RBRACE   ::= '}'
357
	LBRACKET ::= '['
358
	RBRACKET ::= ']'
359
360
	ARROW      ::= '->'
361
	BAR        ::= '|'
362
	COMMA      ::= ','
363
	COLON      ::= ':'
364
	COLONCOLON ::= '::'
365
	SEMICOLON  ::= ';'
366
	DOT        ::= '.'
367
	DOTDOT     ::= '..'
368
	ATPRE      ::= '@pre'
369
370
	CARET        ::= '^'
371
	CARETCARET   ::= '^^'
372
	QUESTIONMARK ::= '?'
373
374
%End
375
376
%EOF
377
    EOF_TOKEN
378
%End
379
380
%ERROR
381
    ERROR_TOKEN
382
%End
383
384
--$EOL
385
--	SEMICOLON
386
--$End
387
388
--$Start
389
--    goal
390
--$End
391
392
%Headers
393
	/.$parserCore
394
395
	./
396
%End
397
398
%Rules
399
	/.$BeginActions./
400
401
	-- opt = optional
402
	-- m = multiple
403
404
	--
405
	-- Define a group of names that we define as keywords for the purpose
406
	-- of constructing an LPG grammar, but that are not reserved by OCL
407
	-- and are commonly used in models such as the UML metamodel, itself
408
	--
409
	
410
	binaryIdentifier -> oclIsUndefined
411
	binaryIdentifier -> oclIsInvalid
412
	binaryIdentifier -> oclIsNew
413
	binaryIdentifier -> oclAsType
414
	binaryIdentifier -> oclIsKindOf
415
	binaryIdentifier -> oclIsTypeOf
416
	binaryIdentifier -> EQUAL
417
	binaryIdentifier -> NOT_EQUAL
418
	binaryIdentifier -> PLUS
419
	binaryIdentifier -> MULTIPLY
420
	binaryIdentifier -> DIVIDE
421
	binaryIdentifier -> GREATER
422
	binaryIdentifier -> LESS
423
	binaryIdentifier -> GREATER_EQUAL
424
	binaryIdentifier -> LESS_EQUAL
425
	binaryIdentifier -> and
426
	binaryIdentifier -> or
427
	binaryIdentifier -> xor
428
429
	unaryIdentifier -> MINUS
430
	unaryIdentifier -> not
431
432
	iteratorIdentifier -> forAll
433
	iteratorIdentifier -> exists
434
	iteratorIdentifier -> isUnique
435
	iteratorIdentifier -> any
436
	iteratorIdentifier -> one
437
	iteratorIdentifier -> collect
438
	iteratorIdentifier -> select
439
	iteratorIdentifier -> reject
440
	iteratorIdentifier -> collectNested
441
	iteratorIdentifier -> sortedBy
442
	iteratorIdentifier -> closure
443
444
	keywordAsIdentifier1 -> iterate
445
	keywordAsIdentifier1 -> iteratorIdentifier
446
	keywordAsIdentifier1 -> allInstances
447
	keywordAsIdentifier1 -> body
448
	keywordAsIdentifier1 -> derive
449
	keywordAsIdentifier1 -> init
450
	keywordAsIdentifier1 -> Set
451
	keywordAsIdentifier1 -> Bag
452
	keywordAsIdentifier1 -> Sequence
453
	keywordAsIdentifier1 -> Collection
454
	keywordAsIdentifier1 -> OrderedSet
455
	--------
456
	keywordAsIdentifier -> keywordAsIdentifier1
457
	keywordAsIdentifier -> null
458
459
	binaryName -> simpleNameCS
460
	binaryName ::= binaryIdentifier
461
		/.$NewCase./
462
	keywordAsName ::= keywordAsIdentifier
463
		/.$NewCase./
464
	keywordAsName1 ::= keywordAsIdentifier1
465
		/.$NewCase./
466
	unaryName ::= unaryIdentifier
467
		/.$BeginCode
468
					SimpleNameCS result = createSimpleNameCS(
469
								SimpleTypeEnum.IDENTIFIER_LITERAL,
470
								getTokenText($getToken(1))
471
							);
472
					setOffsets(result, getIToken($getToken(1)));
473
					$setResult(result);
474
		  $EndCode
475
		./
476
		
477
	iterateName ::= iterate
478
		/.$NewCase./
479
	iteratorName ::= iteratorIdentifier
480
		/.$NewCase./
481
	oclIsInStateName ::= oclIsInState
482
		/.$BeginCode
483
					SimpleNameCS result = createSimpleNameCS(
484
								SimpleTypeEnum.KEYWORD_LITERAL,
485
								getTokenText($getToken(1))
486
							);
487
					setOffsets(result, getIToken($getToken(1)));
488
					$setResult(result);
489
		  $EndCode
490
		./
491
492
	--
493
	-- the 'operationCS' non-terminal is not referenced in this grammar
494
	--
495
	operationCS -> operationCS1
496
	operationCS -> operationCS2
497
	operationCS1 ::= IDENTIFIER '(' parametersCSopt ')' ':' typeCSopt
498
		/.$BeginCode
499
					CSTNode result = createOperationCS(
500
							getTokenText($getToken(1)),
501
							(EList)$getSym(3),
502
							(TypeCS)$getSym(6)
503
						);
504
					if ($getSym(6) != null) {
505
						setOffsets(result, getIToken($getToken(1)), (CSTNode)$getSym(6));
506
					} else {
507
						setOffsets(result, getIToken($getToken(1)), getIToken($getToken(5)));
508
					}
509
					$setResult(result);
510
		  $EndCode
511
		./
512
	operationCS2 ::= pathNameCS '::' simpleNameCS '(' parametersCSopt ')' ':' typeCSopt
513
		/.$BeginCode
514
					CSTNode result = createOperationCS(
515
							(PathNameCS)$getSym(1),
516
							(SimpleNameCS)$getSym(3),
517
							(EList)$getSym(5),
518
							(TypeCS)$getSym(8)
519
						);
520
					if ($getSym(8) != null) {
521
						setOffsets(result, (CSTNode)$getSym(1), (CSTNode)$getSym(8));
522
					} else {
523
						setOffsets(result, (CSTNode)$getSym(1), getIToken($getToken(7)));
524
					}
525
					$setResult(result);
526
		  $EndCode
527
		./
528
529
530
	parametersCSopt ::= %empty
531
		/.$EmptyListAction./
532
	parametersCSopt -> parametersCS
533
	parametersCS ::= variableCS
534
		/.$BeginCode
535
					EList result = new BasicEList();
536
					result.add($getSym(1));
537
					$setResult(result);
538
		  $EndCode
539
		./
540
	parametersCS ::= parametersCS ',' variableCS
541
		/.$BeginCode
542
					EList result = (EList)$getSym(1);
543
					result.add($getSym(3));
544
					$setResult(result);
545
		  $EndCode
546
		./
547
548
	simpleNameCSopt ::= %empty
549
		/.$NullAction./
550
	simpleNameCSopt -> simpleNameCS	
551
552
	oclExpressionCS -> impliesExpCS
553
	oclExpressionCS -> impliesWithLet
554
	
555
	impliesExpCS -> andOrXorExpCS
556
	impliesWithLet -> andOrXorWithLet
557
	impliesExpCS ::= impliesExpCS implies andOrXorExpCS
558
		/.$NewCase./
559
	impliesWithLet ::= impliesExpCS implies andOrXorWithLet
560
		/.$NewCase./
561
562
	andOrXorExpCS -> equalityExpCS
563
	andOrXorWithLet -> equalityWithLet
564
	andOrXorExpCS ::= andOrXorExpCS and equalityExpCS
565
		/.$NewCase./
566
	andOrXorExpCS ::= andOrXorExpCS or equalityExpCS
567
		/.$NewCase./
568
	andOrXorExpCS ::= andOrXorExpCS xor equalityExpCS
569
		/.$NewCase./
570
	andOrXorWithLet ::= andOrXorExpCS and equalityWithLet
571
		/.$NewCase./
572
	andOrXorWithLet ::= andOrXorExpCS or equalityWithLet
573
		/.$NewCase./
574
	andOrXorWithLet ::= andOrXorExpCS xor equalityWithLet
575
		/.$BeginCode
576
					SimpleNameCS simpleNameCS = createSimpleNameCS(
577
								SimpleTypeEnum.STRING_LITERAL,
578
								getTokenText($getToken(2))
579
							);
580
					setOffsets(simpleNameCS, getIToken($getToken(2)));
581
					EList args = new BasicEList();
582
					args.add($getSym(3));
583
					CSTNode result = createOperationCallExpCS(
584
							(OCLExpressionCS)$getSym(1),
585
							simpleNameCS,
586
							args
587
						);
588
					setOffsets(result, (CSTNode)$getSym(1), (CSTNode)$getSym(3));
589
					$setResult(result);
590
		  $EndCode
591
		./
592
593
	equalityExpCS -> relationalExpCS
594
	equalityWithLet -> relationalWithLet
595
	equalityExpCS ::= equalityExpCS '=' relationalExpCS
596
		/.$NewCase./
597
	equalityWithLet ::= equalityExpCS '=' relationalWithLet
598
		/.$BeginCode
599
					SimpleNameCS simpleNameCS = createSimpleNameCS(
600
								SimpleTypeEnum.STRING_LITERAL,
601
								OCLStandardLibraryUtil.getOperationName(PredefinedType.EQUAL)
602
							);
603
					setOffsets(simpleNameCS, getIToken($getToken(2)));
604
					EList args = new BasicEList();
605
					args.add($getSym(3));
606
					CSTNode result = createOperationCallExpCS(
607
							(OCLExpressionCS)$getSym(1),
608
							simpleNameCS,
609
							args
610
						);
611
					setOffsets(result, (CSTNode)$getSym(1), (CSTNode)$getSym(3));
612
					$setResult(result);
613
		  $EndCode
614
		./
615
	equalityExpCS ::= equalityExpCS '<>' relationalExpCS
616
		/.$NewCase./
617
	equalityWithLet ::= equalityExpCS '<>' relationalWithLet
618
		/.$BeginCode
619
					SimpleNameCS simpleNameCS = createSimpleNameCS(
620
								SimpleTypeEnum.STRING_LITERAL,
621
								OCLStandardLibraryUtil.getOperationName(PredefinedType.NOT_EQUAL)
622
							);
623
					setOffsets(simpleNameCS, getIToken($getToken(2)));
624
					EList args = new BasicEList();
625
					args.add($getSym(3));
626
					CSTNode result = createOperationCallExpCS(
627
							(OCLExpressionCS)$getSym(1),
628
							simpleNameCS,
629
							args
630
						);
631
					setOffsets(result, (CSTNode)$getSym(1), (CSTNode)$getSym(3));
632
					$setResult(result);
633
		  $EndCode
634
		./
635
	
636
	relationalExpCS -> ifExpCSPrec
637
	-- Note that ifExp already embeds let, so we needn't deal with it here
638
	relationalWithLet -> additiveWithLet
639
	relationalExpCS ::= relationalExpCS '>' ifExpCSPrec
640
		/.$NewCase./
641
	relationalWithLet ::= relationalExpCS '>' additiveWithLet
642
		/.$BeginCode
643
					SimpleNameCS simpleNameCS = createSimpleNameCS(
644
								SimpleTypeEnum.STRING_LITERAL,
645
								OCLStandardLibraryUtil.getOperationName(PredefinedType.GREATER_THAN)
646
							);
647
					setOffsets(simpleNameCS, getIToken($getToken(2)));
648
					EList args = new BasicEList();
649
					args.add($getSym(3));
650
					CSTNode result = createOperationCallExpCS(
651
							(OCLExpressionCS)$getSym(1),
652
							simpleNameCS,
653
							args
654
						);
655
					setOffsets(result, (CSTNode)$getSym(1), (CSTNode)$getSym(3));
656
					$setResult(result);
657
		  $EndCode
658
		./
659
	relationalExpCS ::= relationalExpCS '<' ifExpCSPrec
660
		/.$NewCase./
661
	relationalWithLet ::= relationalExpCS '<' additiveWithLet
662
		/.$BeginCode
663
					SimpleNameCS simpleNameCS = createSimpleNameCS(
664
								SimpleTypeEnum.STRING_LITERAL,
665
								OCLStandardLibraryUtil.getOperationName(PredefinedType.LESS_THAN)
666
							);
667
					setOffsets(simpleNameCS, getIToken($getToken(2)));
668
					EList args = new BasicEList();
669
					args.add($getSym(3));
670
					CSTNode result = createOperationCallExpCS(
671
							(OCLExpressionCS)$getSym(1),
672
							simpleNameCS,
673
							args
674
						);
675
					setOffsets(result, (CSTNode)$getSym(1), (CSTNode)$getSym(3));
676
					$setResult(result);
677
		  $EndCode
678
		./
679
	relationalExpCS ::= relationalExpCS '>=' ifExpCSPrec
680
		/.$NewCase./
681
	relationalWithLet ::= relationalExpCS '>=' additiveWithLet
682
		/.$BeginCode
683
					SimpleNameCS simpleNameCS = createSimpleNameCS(
684
								SimpleTypeEnum.STRING_LITERAL,
685
								OCLStandardLibraryUtil.getOperationName(PredefinedType.GREATER_THAN_EQUAL)
686
							);
687
					setOffsets(simpleNameCS, getIToken($getToken(2)));
688
					EList args = new BasicEList();
689
					args.add($getSym(3));
690
					CSTNode result = createOperationCallExpCS(
691
							(OCLExpressionCS)$getSym(1),
692
							simpleNameCS,
693
							args
694
						);
695
					setOffsets(result, (CSTNode)$getSym(1), (CSTNode)$getSym(3));
696
					$setResult(result);
697
		  $EndCode
698
		./
699
	relationalExpCS ::= relationalExpCS '<=' ifExpCSPrec
700
		/.$NewCase./
701
	relationalWithLet ::= relationalExpCS '<=' additiveWithLet
702
		/.$BeginCode
703
					SimpleNameCS simpleNameCS = createSimpleNameCS(
704
								SimpleTypeEnum.STRING_LITERAL,
705
								OCLStandardLibraryUtil.getOperationName(PredefinedType.LESS_THAN_EQUAL)
706
							);
707
					setOffsets(simpleNameCS, getIToken($getToken(2)));
708
					EList args = new BasicEList();
709
					args.add($getSym(3));
710
					CSTNode result = createOperationCallExpCS(
711
							(OCLExpressionCS)$getSym(1),
712
							simpleNameCS,
713
							args
714
						);
715
					setOffsets(result, (CSTNode)$getSym(1), (CSTNode)$getSym(3));
716
					$setResult(result);
717
		  $EndCode
718
		./
719
	
720
	ifExpCSPrec -> additiveExpCS
721
	ifExpCSPrec -> ifExpCS
722
723
	additiveExpCS -> multiplicativeExpCS
724
	additiveWithLet -> multiplicativeWithLet
725
	additiveExpCS ::= additiveExpCS '+' multiplicativeExpCS
726
		/.$NewCase./
727
	additiveWithLet ::= additiveExpCS '+' multiplicativeWithLet
728
		/.$BeginCode
729
					SimpleNameCS simpleNameCS = createSimpleNameCS(
730
								SimpleTypeEnum.STRING_LITERAL,
731
								OCLStandardLibraryUtil.getOperationName(PredefinedType.PLUS)
732
							);
733
					setOffsets(simpleNameCS, getIToken($getToken(2)));
734
					EList args = new BasicEList();
735
					args.add($getSym(3));
736
					CSTNode result = createOperationCallExpCS(
737
							(OCLExpressionCS)$getSym(1),
738
							simpleNameCS,
739
							args
740
						);
741
					setOffsets(result, (CSTNode)$getSym(1), (CSTNode)$getSym(3));
742
					$setResult(result);
743
		  $EndCode
744
		./
745
	additiveExpCS ::= additiveExpCS '-' multiplicativeExpCS
746
		/.$NewCase./
747
	additiveWithLet ::= additiveExpCS '-' multiplicativeWithLet
748
		/.$BeginCode
749
					SimpleNameCS simpleNameCS = createSimpleNameCS(
750
								SimpleTypeEnum.STRING_LITERAL,
751
								OCLStandardLibraryUtil.getOperationName(PredefinedType.MINUS)
752
							);
753
					setOffsets(simpleNameCS, getIToken($getToken(2)));
754
					EList args = new BasicEList();
755
					args.add($getSym(3));
756
					CSTNode result = createOperationCallExpCS(
757
							(OCLExpressionCS)$getSym(1),
758
							simpleNameCS,
759
							args
760
						);
761
					setOffsets(result, (CSTNode)$getSym(1), (CSTNode)$getSym(3));
762
					$setResult(result);
763
		  $EndCode
764
		./
765
	
766
	multiplicativeExpCS -> unaryExpCS
767
	multiplicativeWithLet -> unaryWithLet
768
	multiplicativeExpCS ::= multiplicativeExpCS '*' unaryExpCS
769
		/.$NewCase./
770
	multiplicativeWithLet ::= multiplicativeExpCS '*' unaryWithLet
771
		/.$BeginCode
772
					SimpleNameCS simpleNameCS = createSimpleNameCS(
773
								SimpleTypeEnum.STRING_LITERAL,
774
								OCLStandardLibraryUtil.getOperationName(PredefinedType.TIMES)
775
							);
776
					setOffsets(simpleNameCS, getIToken($getToken(2)));
777
					EList args = new BasicEList();
778
					args.add($getSym(3));
779
					CSTNode result = createOperationCallExpCS(
780
							(OCLExpressionCS)$getSym(1),
781
							simpleNameCS,
782
							args
783
						);
784
					setOffsets(result, (CSTNode)$getSym(1), (CSTNode)$getSym(3));
785
					$setResult(result);
786
		  $EndCode
787
		./
788
	multiplicativeExpCS ::= multiplicativeExpCS '/' unaryExpCS
789
		/.$NewCase./
790
	multiplicativeWithLet ::= multiplicativeExpCS '/' unaryWithLet
791
		/.$BeginCode
792
					SimpleNameCS simpleNameCS = createSimpleNameCS(
793
								SimpleTypeEnum.STRING_LITERAL,
794
								OCLStandardLibraryUtil.getOperationName(PredefinedType.DIVIDE)
795
							);
796
					setOffsets(simpleNameCS, getIToken($getToken(2)));
797
					EList args = new BasicEList();
798
					args.add($getSym(3));
799
					CSTNode result = createOperationCallExpCS(
800
							(OCLExpressionCS)$getSym(1),
801
							simpleNameCS,
802
							args
803
						);
804
					setOffsets(result, (CSTNode)$getSym(1), (CSTNode)$getSym(3));
805
					$setResult(result);
806
		  $EndCode
807
		./
808
	
809
	unaryExpCS -> dotArrowExpCS
810
	unaryWithLet -> letExpCS
811
	unaryExpCS ::= '-' unaryExpCS
812
		/.$BeginCode
813
					SimpleNameCS simpleNameCS = createSimpleNameCS(
814
								SimpleTypeEnum.STRING_LITERAL,
815
								OCLStandardLibraryUtil.getOperationName(PredefinedType.MINUS)
816
							);
817
					setOffsets(simpleNameCS, getIToken($getToken(1)));
818
					CSTNode result = createOperationCallExpCS(
819
							(OCLExpressionCS)$getSym(2),
820
							simpleNameCS,
821
							new BasicEList()
822
						);
823
					setOffsets(result, getIToken($getToken(1)), (CSTNode)$getSym(2));
824
					$setResult(result);
825
		  $EndCode
826
		./
827
	unaryExpCS ::= not unaryExpCS
828
		/.$BeginCode
829
					SimpleNameCS simpleNameCS = createSimpleNameCS(
830
								SimpleTypeEnum.STRING_LITERAL,
831
								getTokenText($getToken(1))
832
							);
833
					setOffsets(simpleNameCS, getIToken($getToken(1)));
834
					CSTNode result = createOperationCallExpCS(
835
							(OCLExpressionCS)$getSym(2),
836
							simpleNameCS,
837
							new BasicEList()
838
						);
839
					setOffsets(result, getIToken($getToken(1)), (CSTNode)$getSym(2));
840
					$setResult(result);
841
		  $EndCode
842
		./
843
844
	dotArrowExpCS -> oclExpCS
845
	dotArrowExpCS ::= dotArrowExpCS callExpCS
846
		/.$BeginCode
847
					CallExpCS result = (CallExpCS)$getSym(2);
848
					result.setSource((OCLExpressionCS)$getSym(1));
849
					setOffsets(result, (CSTNode)$getSym(1), result);
850
					$setResult(result);
851
		  $EndCode
852
		./
853
	dotArrowExpCS ::= dotArrowExpCS messageExpCS
854
		/.$BeginCode
855
					MessageExpCS result = (MessageExpCS)$getSym(2);
856
					result.setTarget((OCLExpressionCS)$getSym(1));
857
					setOffsets(result, (CSTNode)$getSym(1), (CSTNode)$getSym(2));
858
					$setResult(result);
859
		  $EndCode
860
		./
861
	dotArrowExpCS ::= NUMERIC_OPERATION '(' argumentsCSopt ')'
862
		/.$BeginCode
863
					// NUMERIC_OPERATION -> Integer '.' Identifier
864
					String text = getTokenText(dtParser.getToken(1));
865
					int index = text.indexOf('.');
866
					String integer = text.substring(0, index);
867
					String simpleName = text.substring(index + 1);
868
869
					// create the IntegerLiteralExpCS
870
					IToken numericToken = getIToken($getToken(1));
871
					int startOffset = numericToken.getStartOffset();
872
					int endOffset = startOffset + integer.length() - 1; // inclusive
873
874
					IntegerLiteralExpCS integerLiteralExpCS = createIntegerLiteralExpCS(integer);
875
					integerLiteralExpCS.setStartOffset(startOffset);
876
					integerLiteralExpCS.setEndOffset(endOffset);
877
					integerLiteralExpCS.setStartToken(numericToken);
878
					integerLiteralExpCS.setEndToken(numericToken);
879
880
					startOffset = endOffset + 2; // end of integerLiteral + 1('.') + 1(start of simpleName)
881
					endOffset = getIToken($getToken(1)).getEndOffset();
882
883
					// create the SimpleNameCS
884
					SimpleNameCS simpleNameCS = createSimpleNameCS(
885
								SimpleTypeEnum.IDENTIFIER_LITERAL,
886
								simpleName
887
							);
888
					simpleNameCS.setStartOffset(startOffset);
889
					simpleNameCS.setEndOffset(endOffset);
890
					simpleNameCS.setStartToken(numericToken);
891
					simpleNameCS.setEndToken(numericToken);
892
893
					// create the OperationCallExpCS
894
					CSTNode result = createOperationCallExpCS(
895
							integerLiteralExpCS,
896
							simpleNameCS,
897
							(EList)$getSym(3)
898
						);
899
					setOffsets(result, getIToken($getToken(1)), getIToken($getToken(4)));
900
					$setResult(result);
901
		  $EndCode
902
		./
903
904
    -- static operation call (@pre is not permitted in this context)
905
	dotArrowExpCS ::=  pathNameCS '::' simpleNameCS '(' argumentsCSopt ')'
906
		/.$BeginCode
907
					OperationCallExpCS result = createOperationCallExpCS(
908
							(PathNameCS)$getSym(1),
909
							(SimpleNameCS)$getSym(3),
910
							(EList)$getSym(5)
911
						);
912
					setOffsets(result, (CSTNode)$getSym(1), getIToken($getToken(6)));
913
					result.setAccessor(DotOrArrowEnum.DOT_LITERAL);
914
					$setResult(result);
915
		  $EndCode
916
		./
917
918
919
	oclExpCS -> variableExpCS
920
	oclExpCS -> literalExpCS
921
	oclExpCS -> operationCallExpCS
922
	oclExpCS -> keywordOperationCallExpCS
923
924
	oclExpCS ::= '(' oclExpressionCS ')'
925
		/.$BeginCode
926
					CSTNode result = (CSTNode)$getSym(2);
927
					setOffsets(result, getIToken($getToken(1)), getIToken($getToken(3)));
928
					$setResult(result);
929
		  $EndCode
930
		./
931
932
	variableExpCS ::= simpleNameCS isMarkedPreCS
933
		/.$NewCase./
934
	variableExpCS ::= keywordAsName1 isMarkedPreCS
935
		/.$BeginCode
936
					IsMarkedPreCS isMarkedPreCS = (IsMarkedPreCS)$getSym(2);
937
					CSTNode result = createVariableExpCS(
938
							(SimpleNameCS)$getSym(1),
939
							new BasicEList(),
940
							isMarkedPreCS
941
						);
942
					if (isMarkedPreCS != null) {
943
						setOffsets(result, (CSTNode)$getSym(1), (CSTNode)$getSym(2));
944
					} else {
945
						setOffsets(result, (CSTNode)$getSym(1));
946
					}
947
					$setResult(result);
948
		  $EndCode
949
		./
950
	variableExpCS ::= simpleNameCS '[' argumentsCS ']' isMarkedPreCS
951
		/.$NewCase./
952
	variableExpCS ::= keywordAsName1 '[' argumentsCS ']' isMarkedPreCS
953
		/.$BeginCode
954
					IsMarkedPreCS isMarkedPreCS = (IsMarkedPreCS)$getSym(5);
955
					CSTNode result = createVariableExpCS(
956
							(SimpleNameCS)$getSym(1),
957
							(EList)$getSym(3),
958
							isMarkedPreCS
959
						);
960
					if (isMarkedPreCS != null) {
961
						setOffsets(result, (CSTNode)$getSym(1), (CSTNode)$getSym(5));
962
					} else {
963
						setOffsets(result, (CSTNode)$getSym(1), getIToken($getToken(4)));
964
					}
965
					$setResult(result);
966
		  $EndCode
967
		./
968
969
970
	simpleNameCS -> primitiveTypeCS
971
	simpleNameCS ::= self
972
		/.$BeginCode
973
					CSTNode result = createSimpleNameCS(
974
							SimpleTypeEnum.SELF_LITERAL,
975
							getTokenText($getToken(1))
976
						);
977
					setOffsets(result, getIToken($getToken(1)));
978
					$setResult(result);
979
		  $EndCode
980
		./
981
	simpleNameCS -> simpleIdentifierCS
982
	simpleIdentifierCS ::= IDENTIFIER
983
		/.$BeginCode
984
					CSTNode result = createSimpleNameCS(
985
							SimpleTypeEnum.IDENTIFIER_LITERAL,
986
							getTokenText($getToken(1))
987
						);
988
					setOffsets(result, getIToken($getToken(1)));
989
					$setResult(result);
990
		  $EndCode
991
		./
992
993
	primitiveTypeCS ::= Integer
994
		/.$BeginCode
995
					CSTNode result = createPrimitiveTypeCS(
996
							SimpleTypeEnum.INTEGER_LITERAL,
997
							getTokenText($getToken(1))
998
						);
999
					setOffsets(result, getIToken($getToken(1)));
1000
					$setResult(result);
1001
		  $EndCode
1002
		./
1003
	primitiveTypeCS ::= UnlimitedNatural
1004
		/.$BeginCode
1005
					CSTNode result = createPrimitiveTypeCS(
1006
							SimpleTypeEnum.UNLIMITED_NATURAL_LITERAL,
1007
							getTokenText($getToken(1))
1008
						);
1009
					setOffsets(result, getIToken($getToken(1)));
1010
					$setResult(result);
1011
		  $EndCode
1012
		./
1013
	primitiveTypeCS ::= String
1014
		/.$BeginCode
1015
					CSTNode result = createPrimitiveTypeCS(
1016
							SimpleTypeEnum.STRING_LITERAL,
1017
							getTokenText($getToken(1))
1018
						);
1019
					setOffsets(result, getIToken($getToken(1)));
1020
					$setResult(result);
1021
		  $EndCode
1022
		./
1023
	primitiveTypeCS ::= Real
1024
		/.$BeginCode
1025
					CSTNode result = createPrimitiveTypeCS(
1026
							SimpleTypeEnum.REAL_LITERAL,
1027
							getTokenText($getToken(1))
1028
						);
1029
					setOffsets(result, getIToken($getToken(1)));
1030
					$setResult(result);
1031
		  $EndCode
1032
		./
1033
	primitiveTypeCS ::= Boolean
1034
		/.$BeginCode
1035
					CSTNode result = createPrimitiveTypeCS(
1036
							SimpleTypeEnum.BOOLEAN_LITERAL,
1037
							getTokenText($getToken(1))
1038
						);
1039
					setOffsets(result, getIToken($getToken(1)));
1040
					$setResult(result);
1041
		  $EndCode
1042
		./
1043
	primitiveTypeCS ::= OclAny
1044
		/.$BeginCode
1045
					CSTNode result = createPrimitiveTypeCS(
1046
							SimpleTypeEnum.OCL_ANY_LITERAL,
1047
							getTokenText($getToken(1))
1048
						);
1049
					setOffsets(result, getIToken($getToken(1)));
1050
					$setResult(result);
1051
		  $EndCode
1052
		./
1053
	primitiveTypeCS ::= OclVoid
1054
		/.$BeginCode
1055
					CSTNode result = createPrimitiveTypeCS(
1056
							SimpleTypeEnum.OCL_VOID_LITERAL,
1057
							getTokenText($getToken(1))
1058
						);
1059
					setOffsets(result, getIToken($getToken(1)));
1060
					$setResult(result);
1061
		  $EndCode
1062
		./
1063
	primitiveTypeCS ::= OclInvalid
1064
		/.$BeginCode
1065
					CSTNode result = createPrimitiveTypeCS(
1066
							SimpleTypeEnum.OCL_INVALID_LITERAL,
1067
							getTokenText($getToken(1))
1068
						);
1069
					setOffsets(result, getIToken($getToken(1)));
1070
					$setResult(result);
1071
		  $EndCode
1072
		./
1073
	primitiveTypeCS ::= OclMessage
1074
		/.$BeginCode
1075
					CSTNode result = createPrimitiveTypeCS(
1076
							SimpleTypeEnum.OCL_MESSAGE_LITERAL,
1077
							getTokenText($getToken(1))
1078
						);
1079
					setOffsets(result, getIToken($getToken(1)));
1080
					$setResult(result);
1081
		  $EndCode
1082
		./
1083
1084
	pathNameCS ::= simpleIdentifierCS
1085
		/.$BeginCode
1086
					SimpleNameCS simpleName = (SimpleNameCS)$getSym(1);
1087
					PathNameCS result = createPathNameCS(simpleName);
1088
					setOffsets(result, simpleName);
1089
					$setResult(result);
1090
		  $EndCode
1091
		./
1092
	pathNameCS ::= pathNameCS '::' simpleNameCS
1093
		/.$BeginCode
1094
					PathNameCS result = (PathNameCS)$getSym(1);
1095
					SimpleNameCS simpleName = (SimpleNameCS)$getSym(3);
1096
					result = extendPathNameCS(result, simpleName);
1097
					setOffsets(result, result, simpleName);
1098
					$setResult(result);
1099
		  $EndCode
1100
		./
1101
1102
	pathNameCSOpt ::= %empty
1103
		/.$BeginCode
1104
					CSTNode result = createPathNameCS();
1105
					$setResult(result);
1106
		  $EndCode
1107
		./
1108
	pathNameCSOpt -> pathNameCS
1109
1110
	literalExpCS -> enumLiteralExpCS
1111
	literalExpCS -> collectionLiteralExpCS
1112
	literalExpCS -> tupleLiteralExpCS
1113
	literalExpCS -> primitiveLiteralExpCS
1114
	literalExpCS -> nullLiteralExpCS
1115
	literalExpCS -> invalidLiteralExpCS
1116
1117
    -- also covers the case of static attribute call, in which
1118
    --    case @pre is not allowed anyway
1119
	enumLiteralExpCS ::= pathNameCS '::' keywordAsName
1120
		/.$NewCase./
1121
	enumLiteralExpCS ::= pathNameCS '::' simpleNameCS
1122
		/.$BeginCode
1123
					CSTNode result = createEnumLiteralExpCS(
1124
							(PathNameCS)$getSym(1),
1125
							(SimpleNameCS)$getSym(3)
1126
						);
1127
					setOffsets(result, (CSTNode)$getSym(1), (CSTNode)$getSym(3));
1128
					$setResult(result);
1129
		  $EndCode
1130
		./
1131
1132
	collectionLiteralExpCS ::= collectionTypeIdentifierCS '{' collectionLiteralPartsCSopt '}'
1133
		/.$BeginCode
1134
					Object[] objs = (Object[])$getSym(1);
1135
					CSTNode result = createCollectionLiteralExpCS(
1136
							(CollectionTypeIdentifierEnum)objs[1],
1137
							(EList)$getSym(3)
1138
						);
1139
					setOffsets(result, (IToken)objs[0], getIToken($getToken(4)));
1140
					$setResult(result);
1141
		  $EndCode
1142
		./
1143
1144
	collectionTypeIdentifierCS ::= Set
1145
		/.$BeginCode
1146
					$setResult(new Object[]{getIToken($getToken(1)), CollectionTypeIdentifierEnum.SET_LITERAL});
1147
		  $EndCode
1148
		./
1149
	collectionTypeIdentifierCS ::= Bag
1150
		/.$BeginCode
1151
					$setResult(new Object[]{getIToken($getToken(1)), CollectionTypeIdentifierEnum.BAG_LITERAL});
1152
		  $EndCode
1153
		./
1154
	collectionTypeIdentifierCS ::= Sequence
1155
		/.$BeginCode
1156
					$setResult(new Object[]{getIToken($getToken(1)), CollectionTypeIdentifierEnum.SEQUENCE_LITERAL});
1157
		  $EndCode
1158
		./
1159
	collectionTypeIdentifierCS ::= Collection
1160
		/.$BeginCode
1161
					$setResult(new Object[]{getIToken($getToken(1)), CollectionTypeIdentifierEnum.COLLECTION_LITERAL});
1162
		  $EndCode
1163
		./
1164
	collectionTypeIdentifierCS ::= OrderedSet
1165
		/.$BeginCode
1166
					$setResult(new Object[]{getIToken($getToken(1)), CollectionTypeIdentifierEnum.ORDERED_SET_LITERAL});
1167
		  $EndCode
1168
		./
1169
1170
	collectionLiteralPartsCSopt ::= %empty
1171
		/.$EmptyListAction./
1172
	collectionLiteralPartsCSopt -> collectionLiteralPartsCS
1173
1174
	collectionLiteralPartsCS ::= collectionLiteralPartCS
1175
		/.$BeginCode
1176
					EList result = new BasicEList();
1177
					result.add($getSym(1));
1178
					$setResult(result);
1179
		  $EndCode
1180
		./
1181
	collectionLiteralPartsCS ::= collectionLiteralPartsCS ',' collectionLiteralPartCS
1182
		/.$BeginCode
1183
					EList result = (EList)$getSym(1);
1184
					result.add($getSym(3));
1185
					$setResult(result);
1186
		  $EndCode
1187
		./
1188
1189
	collectionLiteralPartCS -> collectionRangeCS
1190
	collectionLiteralPartCS ::= oclExpressionCS
1191
		/.$BeginCode
1192
					CSTNode result = createCollectionLiteralPartCS(
1193
							(OCLExpressionCS)$getSym(1)
1194
						);
1195
					setOffsets(result, (CSTNode)$getSym(1));
1196
					$setResult(result);
1197
		  $EndCode
1198
		./
1199
1200
	collectionRangeCS ::= '-' INTEGER_RANGE_START oclExpressionCS
1201
		/.$BeginCode
1202
					OCLExpressionCS rangeStart = createRangeStart(
1203
							getTokenText($getToken(2)), true);
1204
					CSTNode result = createCollectionRangeCS(
1205
							rangeStart,
1206
							(OCLExpressionCS)$getSym(3)
1207
						);
1208
					setOffsets(result, rangeStart, (CSTNode)$getSym(3));
1209
					$setResult(result);
1210
		  $EndCode
1211
		./
1212
	collectionRangeCS ::= INTEGER_RANGE_START oclExpressionCS
1213
		/.$BeginCode
1214
					OCLExpressionCS rangeStart = createRangeStart(
1215
							getTokenText($getToken(1)), false);
1216
					CSTNode result = createCollectionRangeCS(
1217
							rangeStart,
1218
							(OCLExpressionCS)$getSym(2)
1219
						);
1220
					setOffsets(result, rangeStart, (CSTNode)$getSym(2));
1221
					$setResult(result);
1222
		  $EndCode
1223
		./
1224
	collectionRangeCS ::= oclExpressionCS '..' oclExpressionCS
1225
		/.$BeginCode
1226
					CSTNode result = createCollectionRangeCS(
1227
							(OCLExpressionCS)$getSym(1),
1228
							(OCLExpressionCS)$getSym(3)
1229
						);
1230
					setOffsets(result, (CSTNode)$getSym(1), (CSTNode)$getSym(3));
1231
					$setResult(result);
1232
		  $EndCode
1233
		./
1234
1235
	primitiveLiteralExpCS -> integerLiteralExpCS
1236
	primitiveLiteralExpCS -> unlimitedNaturalLiteralExpCS
1237
	primitiveLiteralExpCS -> realLiteralExpCS
1238
	primitiveLiteralExpCS -> stringLiteralExpCS
1239
	primitiveLiteralExpCS -> booleanLiteralExpCS
1240
1241
	tupleLiteralExpCS ::= Tuple '{' variableListCS2 '}'
1242
		/.$BeginCode
1243
					CSTNode result = createTupleLiteralExpCS((EList)$getSym(3));
1244
					setOffsets(result, getIToken($getToken(1)), getIToken($getToken(4)));
1245
					$setResult(result);
1246
		  $EndCode
1247
		./
1248
	integerLiteralExpCS ::= INTEGER_LITERAL
1249
		/.$BeginCode
1250
					CSTNode result = createIntegerLiteralExpCS(getTokenText($getToken(1)));
1251
					setOffsets(result, getIToken($getToken(1)));
1252
					$setResult(result);
1253
		  $EndCode
1254
		./
1255
	unlimitedNaturalLiteralExpCS ::= '*'
1256
		/.$BeginCode
1257
					CSTNode result = createUnlimitedNaturalLiteralExpCS(getTokenText($getToken(1)));
1258
					setOffsets(result, getIToken($getToken(1)));
1259
					$setResult(result);
1260
		  $EndCode
1261
		./
1262
	realLiteralExpCS ::= REAL_LITERAL
1263
		/.$BeginCode
1264
					CSTNode result = createRealLiteralExpCS(getTokenText($getToken(1)));
1265
					setOffsets(result, getIToken($getToken(1)));
1266
					$setResult(result);
1267
		  $EndCode
1268
		./
1269
	stringLiteralExpCS ::= STRING_LITERAL
1270
		/.$BeginCode
1271
					IToken literalToken = getIToken($getToken(1));
1272
					StringLiteralExpCS result = createStringLiteralExpCS(literalToken.toString());
1273
					result.setUnescapedStringSymbol(unescape(literalToken));
1274
					setOffsets(result, literalToken);
1275
					$setResult(result);
1276
		  $EndCode
1277
		./
1278
	booleanLiteralExpCS ::= true
1279
		/.$BeginCode
1280
					CSTNode result = createBooleanLiteralExpCS(getTokenText($getToken(1)));
1281
					setOffsets(result, getIToken($getToken(1)));
1282
					$setResult(result);
1283
		  $EndCode
1284
		./
1285
	booleanLiteralExpCS ::= false
1286
		/.$BeginCode
1287
					CSTNode result = createBooleanLiteralExpCS(getTokenText($getToken(1)));
1288
					setOffsets(result, getIToken($getToken(1)));
1289
					$setResult(result);
1290
		  $EndCode
1291
		./
1292
1293
	nullLiteralExpCS ::= null
1294
		/.$BeginCode
1295
					CSTNode result = createNullLiteralExpCS(getTokenText($getToken(1)));
1296
					setOffsets(result, getIToken($getToken(1)));
1297
					$setResult(result);
1298
		  $EndCode
1299
		./
1300
1301
	invalidLiteralExpCS ::= invalid
1302
		/.$BeginCode
1303
					CSTNode result = createInvalidLiteralExpCS(getTokenText($getToken(1)));
1304
					setOffsets(result, getIToken($getToken(1)));
1305
					$setResult(result);
1306
		  $EndCode
1307
		./
1308
1309
1310
	callExpCS ::= '->' featureCallExpCS
1311
		/.$NewCase./
1312
	callExpCS ::= '->' loopExpCS
1313
		/.$BeginCode
1314
					CallExpCS result = (CallExpCS)$getSym(2);
1315
					result.setAccessor(DotOrArrowEnum.ARROW_LITERAL);
1316
					$setResult(result);
1317
		  $EndCode
1318
		./
1319
	callExpCS ::= '.' keywordOperationCallExpCS
1320
		/.$NewCase./
1321
	callExpCS ::= '.' featureCallExpCS
1322
		/.$BeginCode
1323
					CallExpCS result = (CallExpCS)$getSym(2);
1324
					result.setAccessor(DotOrArrowEnum.DOT_LITERAL);
1325
					$setResult(result);
1326
		  $EndCode
1327
		./
1328
1329
	loopExpCS -> iteratorExpCS
1330
	loopExpCS -> iterateExpCS
1331
1332
	iteratorExpCS ::= iteratorName '(' oclExpressionCS ')'
1333
		/.$BeginCode
1334
					SimpleNameCS simpleNameCS = (SimpleNameCS)$getSym(1);
1335
					CSTNode result = createIteratorExpCS(
1336
							simpleNameCS,
1337
							null,
1338
							null,
1339
							(OCLExpressionCS)$getSym(3)
1340
						);
1341
					setOffsets(result, simpleNameCS, getIToken($getToken(4)));
1342
					$setResult(result);
1343
		  $EndCode
1344
		./
1345
	iteratorExpCS ::= iteratorName '(' variableCS '|' oclExpressionCS ')'
1346
		/.$BeginCode
1347
					SimpleNameCS simpleNameCS = (SimpleNameCS)$getSym(1);
1348
					CSTNode result = createIteratorExpCS(
1349
							simpleNameCS,
1350
							(VariableCS)$getSym(3),
1351
							null,
1352
							(OCLExpressionCS)$getSym(5)
1353
						);
1354
					setOffsets(result, simpleNameCS, getIToken($getToken(6)));
1355
					$setResult(result);
1356
		  $EndCode
1357
		./
1358
	iteratorExpCS ::= iteratorName '(' variableCS ',' variableCS '|' oclExpressionCS ')'
1359
		/.$BeginCode
1360
					SimpleNameCS simpleNameCS = (SimpleNameCS)$getSym(1);
1361
					CSTNode result = createIteratorExpCS(
1362
							simpleNameCS,
1363
							(VariableCS)$getSym(3),
1364
							(VariableCS)$getSym(5),
1365
							(OCLExpressionCS)$getSym(7)
1366
						);
1367
					setOffsets(result, simpleNameCS, getIToken($getToken(8)));
1368
					$setResult(result);
1369
		  $EndCode
1370
		./
1371
1372
	iterateExpCS ::= iterateName '(' variableCS '|' oclExpressionCS ')'
1373
		/.$BeginCode
1374
					SimpleNameCS simpleNameCS = (SimpleNameCS)$getSym(1);
1375
					CSTNode result = createIterateExpCS(
1376
							simpleNameCS,
1377
							(VariableCS)$getSym(3),
1378
							null,
1379
							(OCLExpressionCS)$getSym(5)
1380
						);
1381
					setOffsets(result, simpleNameCS, getIToken($getToken(6)));
1382
					$setResult(result);
1383
		  $EndCode
1384
		./
1385
	iterateExpCS ::= iterateName '(' variableCS ';' variableCS '|' oclExpressionCS ')'
1386
		/.$BeginCode
1387
					SimpleNameCS simpleNameCS = (SimpleNameCS)$getSym(1);
1388
					CSTNode result = createIterateExpCS(
1389
							simpleNameCS,
1390
							(VariableCS)$getSym(3),
1391
							(VariableCS)$getSym(5),
1392
							(OCLExpressionCS)$getSym(7)
1393
						);
1394
					setOffsets(result, simpleNameCS, getIToken($getToken(8)));
1395
					$setResult(result);
1396
		  $EndCode
1397
		./
1398
1399
	variableCS ::= IDENTIFIER
1400
		/.$BeginCode
1401
					CSTNode result = createVariableCS(
1402
							getTokenText($getToken(1)),
1403
							null,
1404
							null
1405
						);
1406
					setOffsets(result, getIToken($getToken(1)));
1407
					$setResult(result);
1408
		  $EndCode
1409
		./
1410
	typedVariableCS ::= IDENTIFIER ':' typeCS
1411
		/.$BeginCode
1412
					CSTNode result = createVariableCS(
1413
							getTokenText($getToken(1)),
1414
							(TypeCS)$getSym(3),
1415
							null
1416
						);
1417
					setOffsets(result, getIToken($getToken(1)), (CSTNode)$getSym(3));
1418
					$setResult(result);
1419
		  $EndCode
1420
		./
1421
	variableCS -> typedVariableCS
1422
	variableCS ::= IDENTIFIER ':' typeCS '=' oclExpressionCS
1423
		/.$BeginCode
1424
					CSTNode result = createVariableCS(
1425
							getTokenText($getToken(1)),
1426
							(TypeCS)$getSym(3),
1427
							(OCLExpressionCS)$getSym(5)
1428
						);
1429
					setOffsets(result, getIToken($getToken(1)), (CSTNode)$getSym(5));
1430
					$setResult(result);
1431
		  $EndCode
1432
		./
1433
1434
	-- this form of variable declaration is only used in tuple literals
1435
	variableCS2 ::= IDENTIFIER '=' oclExpressionCS
1436
		/.$BeginCode
1437
					CSTNode result = createVariableCS(
1438
							getTokenText($getToken(1)),
1439
							null,
1440
							(OCLExpressionCS)$getSym(3)
1441
						);
1442
					setOffsets(result, getIToken($getToken(1)), (CSTNode)$getSym(3));
1443
					$setResult(result);
1444
		  $EndCode
1445
		./
1446
1447
	typeCSopt ::= %empty
1448
		/.$NullAction./
1449
	typeCSopt -> typeCS
1450
1451
	-- the order of these rules is important!  Try to match primitives
1452
	--   first, then tuples (more complex), and finally collections.
1453
	--   Looking for type names in the Ecore model is a last resort
1454
	typeCS -> primitiveTypeCS
1455
	typeCS -> tupleTypeCS
1456
	typeCS -> collectionTypeCS
1457
	typeCS -> pathNameCS
1458
1459
	collectionTypeCS ::= collectionTypeIdentifierCS '(' typeCS ')'
1460
		/.$BeginCode
1461
					Object[] objs = (Object[])$getSym(1);
1462
					CSTNode result = createCollectionTypeCS(
1463
							(CollectionTypeIdentifierEnum)objs[1],
1464
							(TypeCS)$getSym(3)
1465
						);
1466
					setOffsets(result, (IToken)objs[0], getIToken($getToken(4)));
1467
					$setResult(result);
1468
		  $EndCode
1469
		./
1470
1471
	tupleTypeCS ::= Tuple '(' variableListCSopt ')'
1472
		/.$BeginCode
1473
					CSTNode result = createTupleTypeCS((EList)$getSym(3));
1474
					setOffsets(result, getIToken($getToken(1)), getIToken($getToken(4)));
1475
					$setResult(result);
1476
		  $EndCode
1477
		./
1478
1479
	
1480
	variableListCSopt ::= %empty
1481
		/.$EmptyListAction./
1482
	variableListCSopt -> variableListCS
1483
	variableListCS ::= variableCS 
1484
		/.$BeginCode
1485
					EList result = new BasicEList();
1486
					result.add($getSym(1));
1487
					$setResult(result);
1488
		  $EndCode
1489
		./
1490
	variableListCS ::= variableListCS ',' variableCS
1491
		/.$BeginCode
1492
					EList result = (EList)$getSym(1);
1493
					result.add($getSym(3));
1494
					$setResult(result);
1495
		  $EndCode
1496
		./
1497
	
1498
	-- this form of variable declaration list is only used in tuple literals
1499
	variableListCS2 ::= variableCS2
1500
		/.$NewCase./
1501
	variableListCS2 ::= variableCS
1502
		/.$BeginCode
1503
					EList result = new BasicEList();
1504
					result.add($getSym(1));
1505
					$setResult(result);
1506
		  $EndCode
1507
		./
1508
	variableListCS2 ::= variableListCS2 ',' variableCS2
1509
		/.$NewCase./
1510
	variableListCS2 ::= variableListCS2 ',' variableCS
1511
		/.$BeginCode
1512
					EList result = (EList)$getSym(1);
1513
					result.add($getSym(3));
1514
					$setResult(result);
1515
		  $EndCode
1516
		./
1517
	
1518
	-- covers attributeCallExpCS and navigationCallExpCS
1519
	featureCallExpCS -> attrOrNavCallExpCS
1520
1521
	featureCallExpCS -> operationCallExpCS
1522
	featureCallExpCS ::= unaryName isMarkedPreCS '(' argumentsCSopt ')'
1523
		/.$NewCase./
1524
	-- even though these operations do not use @pre or do not accept multiple arguments
1525
	-- in order to get better error reporting, the rule signature must comply with
1526
	-- the full rule of an operationCallExpCS
1527
	-- the alternative would be to remove these as keywords, but then the parser
1528
	-- would accept variable declarations where the var can be named "oclIsNew" for example
1529
	operationCallExpCS ::= binaryName isMarkedPreCS '(' argumentsCSopt ')'
1530
		/.$NewCase./
1531
	keywordOperationCallExpCS ::= keywordAsName isMarkedPreCS '(' argumentsCSopt ')'
1532
		/.$BeginCode
1533
					CSTNode result = createOperationCallExpCS(
1534
							(SimpleNameCS)$getSym(1),
1535
							(IsMarkedPreCS)$getSym(2),
1536
							(EList)$getSym(4)
1537
						);
1538
					setOffsets(result, getIToken($getToken(1)), getIToken($getToken(5)));
1539
					$setResult(result);
1540
		  $EndCode
1541
		./
1542
1543
	stateExpCS ::= pathNameCSOpt
1544
		/.$BeginCode
1545
					PathNameCS pathNameCS = (PathNameCS)$getSym(1);
1546
					StateExpCS result = createStateExpCS(pathNameCS);
1547
					setOffsets(result, pathNameCS);
1548
					$setResult(result);
1549
		  $EndCode
1550
		./
1551
	-- FIXME StateExpCS creates a needless irregularity; unwrap its content as an argument list
1552
	operationCallExpCS ::= oclIsInStateName isMarkedPreCS '(' stateExpCS ')'
1553
		/.$BeginCode
1554
					SimpleNameCS simpleNameCS = (SimpleNameCS)$getSym(1);
1555
					CSTNode result = createOperationCallExpCS(
1556
							simpleNameCS,
1557
							(IsMarkedPreCS)$getSym(2),
1558
							(StateExpCS)$getSym(4)
1559
						);
1560
					setOffsets(result, simpleNameCS, getIToken($getToken(5)));
1561
					$setResult(result);
1562
		  $EndCode
1563
		./
1564
1565
	attrOrNavCallExpCS ::= simpleNameCS isMarkedPreCS
1566
		/.$NewCase./
1567
	attrOrNavCallExpCS ::= keywordAsName isMarkedPreCS
1568
		/.$BeginCode
1569
					IsMarkedPreCS isMarkedPreCS = (IsMarkedPreCS)$getSym(2);
1570
					CSTNode result = createFeatureCallExpCS(
1571
							(SimpleNameCS)$getSym(1),
1572
							new BasicEList(),
1573
							isMarkedPreCS
1574
						);
1575
					if (isMarkedPreCS != null) {
1576
						setOffsets(result, (CSTNode)$getSym(1), (CSTNode)$getSym(2));
1577
					} else {
1578
						setOffsets(result, (CSTNode)$getSym(1));
1579
					}
1580
					$setResult(result);
1581
		  $EndCode
1582
		./
1583
	attrOrNavCallExpCS ::= simpleNameCS '[' argumentsCS ']' isMarkedPreCS
1584
		/.$BeginCode
1585
					IsMarkedPreCS isMarkedPreCS = (IsMarkedPreCS)$getSym(5);
1586
					CSTNode result = createFeatureCallExpCS(
1587
							(SimpleNameCS)$getSym(1),
1588
							(EList)$getSym(3),
1589
							isMarkedPreCS
1590
						);
1591
					if (isMarkedPreCS != null) {
1592
						setOffsets(result, (CSTNode)$getSym(1), (CSTNode)$getSym(5));
1593
					} else {
1594
						setOffsets(result, (CSTNode)$getSym(1), getIToken($getToken(4)));
1595
					}
1596
					$setResult(result);
1597
		  $EndCode
1598
		./
1599
1600
	isMarkedPreCS ::= %empty
1601
		/.$BeginCode
1602
					$setResult(null);
1603
		  $EndCode
1604
		./
1605
	isMarkedPreCS ::= '@pre'
1606
		/.$BeginCode
1607
					CSTNode result = createIsMarkedPreCS();
1608
					setOffsets(result, getIToken($getToken(1)));
1609
					$setResult(result);
1610
		  $EndCode
1611
		./
1612
1613
	argumentsCSopt ::= %empty
1614
		/.$EmptyListAction./
1615
	argumentsCSopt -> argumentsCS
1616
1617
	argumentsCS ::= oclExpressionCS
1618
		/.$BeginCode
1619
					EList result = new BasicEList();
1620
					result.add($getSym(1));
1621
					$setResult(result);
1622
		  $EndCode
1623
		./
1624
	argumentsCS ::= argumentsCS ',' oclExpressionCS
1625
		/.$BeginCode
1626
					EList result = (EList)$getSym(1);
1627
					result.add($getSym(3));
1628
					$setResult(result);
1629
		  $EndCode
1630
		./
1631
1632
	letExpCS ::= let variableListCS in oclExpressionCS
1633
		/.$BeginCode
1634
					CSTNode result = createLetExpCS(
1635
							(EList)$getSym(2),
1636
							(OCLExpressionCS)$getSym(4)
1637
						);
1638
					setOffsets(result, getIToken($getToken(1)), (CSTNode)$getSym(4));
1639
					$setResult(result);
1640
		  $EndCode
1641
		./
1642
1643
	ifExpCS ::= if oclExpressionCS then oclExpressionCS else oclExpressionCS endif
1644
		/.$BeginCode
1645
					CSTNode result = createIfExpCS(
1646
							(OCLExpressionCS)$getSym(2),
1647
							(OCLExpressionCS)$getSym(4),
1648
							(OCLExpressionCS)$getSym(6)
1649
						);
1650
					setOffsets(result, getIToken($getToken(1)), getIToken($getToken(7)));
1651
					$setResult(result);
1652
		  $EndCode
1653
		./
1654
1655
	messageExpCS ::= '^' simpleNameCS '(' oclMessageArgumentsCSopt ')'
1656
		/.$NewCase./
1657
	messageExpCS ::= '^^' simpleNameCS '(' oclMessageArgumentsCSopt ')'
1658
		/.$BeginCode
1659
					CSTNode result = createMessageExpCS(
1660
							getIToken($getToken(1)).getKind() == $sym_type.TK_CARET,
1661
							(SimpleNameCS)$getSym(2),
1662
							(EList<OCLMessageArgCS>)$getSym(4)
1663
						);
1664
					setOffsets(result, getIToken($getToken(1)), getIToken($getToken(5)));
1665
					$setResult(result);
1666
		  $EndCode
1667
		./
1668
1669
	oclMessageArgumentsCSopt ::= %empty
1670
		/.$EmptyListAction./
1671
	oclMessageArgumentsCSopt -> oclMessageArgumentsCS
1672
1673
	oclMessageArgumentsCS ::= oclMessageArgCS
1674
		/.$BeginCode
1675
					EList result = new BasicEList();
1676
					result.add($getSym(1));
1677
					$setResult(result);
1678
		  $EndCode
1679
		./
1680
	oclMessageArgumentsCS ::= oclMessageArgumentsCS ',' oclMessageArgCS
1681
		/.$BeginCode
1682
					EList result = (EList)$getSym(1);
1683
					result.add($getSym(3));
1684
					$setResult(result);
1685
		  $EndCode
1686
		./
1687
1688
	oclMessageArgCS ::= oclExpressionCS
1689
		/.$BeginCode
1690
					CSTNode result = createOCLMessageArgCS(
1691
							null,
1692
							(OCLExpressionCS)$getSym(1)
1693
						);
1694
					setOffsets(result, (CSTNode)$getSym(1));
1695
					$setResult(result);
1696
		  $EndCode
1697
		./
1698
	oclMessageArgCS ::= '?'
1699
		/.$BeginCode
1700
					CSTNode result = createOCLMessageArgCS(
1701
							null,
1702
							null
1703
						);
1704
					setOffsets(result, getIToken($getToken(1)));
1705
					$setResult(result);
1706
		  $EndCode
1707
		./
1708
	oclMessageArgCS ::= '?' ':' typeCS
1709
		/.$BeginCode
1710
					CSTNode result = createOCLMessageArgCS(
1711
							(TypeCS)$getSym(3),
1712
							null
1713
						);
1714
					setOffsets(result, getIToken($getToken(1)), (CSTNode)$getSym(3));
1715
					$setResult(result);
1716
		  $EndCode
1717
		./
1718
1719
%End
1720
1721
%Trailers
1722
	/.
1723
		$EndActions
1724
	}
1725
	./
1726
%End
(-)src/org/eclipse/ocl/parser/backtracking/OCLBacktrackingLexer.gi (+42 lines)
Added Link Here
1
--/**
2
-- * <copyright>
3
-- *
4
-- * Copyright (c) 2008, 2009 Eclipse.org, Open Canarias S.L., and others.
5
-- * All rights reserved.   This program and the accompanying materials
6
-- * are made available under the terms of the Eclipse Public License v1.0
7
-- * which accompanies this distribution, and is available at
8
-- * http://www.eclipse.org/legal/epl-v10.html
9
-- *
10
-- * Contributors:
11
-- *   IBM - Initial API and implementation
12
-- *   E.D.Willink - Lexer and Parser refactoring to support extensibility and flexible error handling
13
-- *   Adolfo Sanchez-Barbudo Herrera (Open Canarias) - LPG v 2.0.17 adoption (242153)
14
-- *
15
-- * </copyright>
16
-- *
17
-- * $Id: OCLBacktrackingLexer.g,v 1.1 2009/01/13 20:31:30 cdamus Exp $
18
-- */
19
--
20
-- The OCL Backtracking Lexer, which is nominally identical to the
21
-- normal Lexer, however the extra ERROR_TOKEN symbol makes it difficult
22
-- to share reliably.
23
--
24
25
%options escape=$
26
%options la=2
27
%options fp=OCLBacktrackingLexer,prefix=Char_
28
%options single-productions
29
%options noserialize
30
%options package=org.eclipse.ocl.parser.backtracking
31
%options template=../../lpg/LexerTemplateD.gi
32
%options filter=OCLBacktrackingKWLexer.gi
33
%options export_terminals=("OCLBacktrackingParsersym.java", "TK_")
34
%options include_directory="..;../../lpg"
35
36
%Import
37
	OCLLexer.gi
38
%End
39
40
%Define
41
	$kw_lexer_class /.OCLBacktrackingKWLexer./
42
%End
(-)src/org/eclipse/ocl/parser/backtracking/EssentialOCLErrors.gi (+417 lines)
Added Link Here
1
--/**
2
-- * <copyright>
3
-- *
4
-- * Copyright (c) 2008, 2009 Eclipse.org and others.
5
-- * All rights reserved.   This program and the accompanying materials
6
-- * are made available under the terms of the Eclipse Public License v1.0
7
-- * which accompanies this distribution, and is available at
8
-- * http://www.eclipse.org/legal/epl-v10.html
9
-- *
10
-- * Contributors:
11
-- *   E.D.Willink - Initial API and implementation
12
-- *   Adolfo Sanchez-Barbudo Herrera (Open Canarias) - LPG v 2.0.17 adoption (242153)
13
-- *
14
-- * </copyright>
15
-- *
16
-- * $Id: EssentialOCLErrors.g,v 1.1 2009/01/13 20:31:30 cdamus Exp $
17
-- */
18
--
19
-- Additional ERROR_TOKEN rules for The EssentialOCL Backtracking Parser
20
--
21
22
%Rules
23
	ERROR_Colon ::= ERROR_TOKEN
24
		/.$BeginCode
25
					reportErrorTokenMessage($getToken(1), OCLParserErrors.MISSING_COLON);
26
		  $EndCode
27
		./
28
	ERROR_Empty ::= ERROR_TOKEN
29
		/.$BeginCode
30
					reportErrorTokenMessage($getToken(1), OCLParserErrors.EXTRA_TOKENS);
31
		  $EndCode
32
		./
33
	ERROR_IsMarkedPreCS ::= ERROR_TOKEN
34
		/.$BeginCode
35
					reportErrorTokenMessage($getToken(1), OCLParserErrors.MISSING_AT_PRE);
36
					$setResult(null);
37
		  $EndCode
38
		./
39
40
	ERROR_PathNameCS ::= ERROR_TOKEN
41
		/.$BeginCode
42
					reportErrorTokenMessage($getToken(1), OCLParserErrors.MISSING_PATH_NAME);
43
					CSTNode result = createPathNameCS(createSimpleNameCS(SimpleTypeEnum.IDENTIFIER_LITERAL, getTokenText($getToken(1))));
44
					setOffsets(result, getIToken($getToken(1)));
45
					$setResult(result);
46
		  $EndCode
47
		./
48
		
49
	ERROR_SimpleNameCS ::= ERROR_TOKEN
50
		/.$BeginCode
51
					reportErrorTokenMessage($getToken(1), OCLParserErrors.MISSING_SIMPLE_NAME);
52
					SimpleNameCS result = createSimpleNameCS(
53
							SimpleTypeEnum.IDENTIFIER_LITERAL,
54
							getTokenText($getToken(1))
55
						);
56
					setOffsets(result, getIToken($getToken(1)));
57
					$setResult(result);
58
		  $EndCode
59
		./
60
61
	attrOrNavCallExpCS ::= simpleNameCS '[' argumentsCS ERROR_TOKEN
62
		/.$BeginCode
63
					reportErrorTokenMessage($getToken(4), OCLParserErrors.MISSING_RBRACK);
64
					CSTNode result = createFeatureCallExpCS(
65
							(SimpleNameCS)$getSym(1),
66
							(EList)$getSym(3),
67
							null
68
						);
69
					setOffsets(result, (CSTNode)$getSym(1), getIToken($getToken(4)));
70
					$setResult(result);
71
		  $EndCode
72
		./
73
		
74
	collectionTypeCS ::= collectionTypeIdentifierCS '(' typeCS ERROR_TOKEN
75
		/.$BeginCode
76
					reportErrorTokenMessage($getToken(4), OCLParserErrors.MISSING_RPAREN);
77
					Object[] objs = (Object[])$getSym(1);
78
					CSTNode result = createCollectionTypeCS(
79
							(CollectionTypeIdentifierEnum)objs[1],
80
							(TypeCS)$getSym(3)
81
						);
82
					setOffsets(result, (IToken)objs[0], getIToken($getToken(4)));
83
					$setResult(result);
84
		  $EndCode
85
		./
86
	collectionTypeCS ::= collectionTypeIdentifierCS ERROR_TOKEN
87
		/.$BeginCode
88
					reportErrorTokenMessage($getToken(2), OCLParserErrors.MISSING_LPAREN);
89
					Object[] objs = (Object[])$getSym(1);
90
					CSTNode result = createCollectionTypeCS(
91
							(CollectionTypeIdentifierEnum)objs[1],
92
							null
93
						);
94
					setOffsets(result, (IToken)objs[0], getIToken($getToken(2)));
95
					$setResult(result);
96
		  $EndCode
97
		./
98
99
	dotArrowExpCS ::=  pathNameCS '::' ERROR_SimpleNameCS '(' argumentsCSopt ')'
100
		/.$BeginCode
101
					OperationCallExpCS result = createOperationCallExpCS(
102
							(PathNameCS)$getSym(1),
103
							(SimpleNameCS)$getSym(3),
104
							(EList)$getSym(5)
105
						);
106
					setOffsets(result, (CSTNode)$getSym(1), getIToken($getToken(6)));
107
					result.setAccessor(DotOrArrowEnum.DOT_LITERAL);
108
					$setResult(result);
109
		  $EndCode
110
		./
111
-- FIXME	dotArrowExpCS ::= NUMERIC_OPERATION ERROR_SimpleNameCS
112
113
	enumLiteralExpCS ::= pathNameCS '::' ERROR_SimpleNameCS
114
		/.$BeginCode
115
					PathNameCS pathNameCS = (PathNameCS)$getSym(1);
116
					SimpleNameCS simpleNameCS = (SimpleNameCS)$getSym(3);
117
					CSTNode result = createEnumLiteralExpCS(
118
							pathNameCS,
119
							simpleNameCS
120
						);
121
					setOffsets(result, pathNameCS, simpleNameCS);
122
					$setResult(result);
123
		  $EndCode
124
		./
125
		
126
	featureCallExpCS ::= unaryName ERROR_IsMarkedPreCS '(' argumentsCSopt ')'
127
		/.$NewCase./
128
	keywordOperationCallExpCS ::= keywordAsName ERROR_IsMarkedPreCS '(' argumentsCSopt ')'
129
		/.$NewCase./
130
	operationCallExpCS ::= binaryName ERROR_IsMarkedPreCS '(' argumentsCSopt ')'
131
		/.$BeginCode
132
					SimpleNameCS simpleNameCS = (SimpleNameCS)$getSym(1);
133
					CSTNode result = createOperationCallExpCS(
134
							simpleNameCS,
135
							(IsMarkedPreCS)$getSym(2),
136
							(EList)$getSym(4)
137
						);
138
					setOffsets(result, simpleNameCS, getIToken($getToken(5)));
139
					$setResult(result);
140
		  $EndCode
141
		./
142
	operationCallExpCS ::= oclIsInStateName ERROR_IsMarkedPreCS '(' stateExpCS ')'
143
		/.$BeginCode
144
					SimpleNameCS simpleNameCS = (SimpleNameCS)$getSym(1);
145
					CSTNode result = createOperationCallExpCS(
146
							simpleNameCS,
147
							(IsMarkedPreCS)$getSym(2),
148
							(StateExpCS)$getSym(4)
149
						);
150
					setOffsets(result, simpleNameCS, getIToken($getToken(5)));
151
					$setResult(result);
152
		  $EndCode
153
		./
154
155
	ifExpCS ::= if oclExpressionCS then oclExpressionCS else oclExpressionCS ERROR_TOKEN
156
		/.$BeginCode
157
					reportErrorTokenMessage($getToken(7), OCLParserErrors.MISSING_ENDIF);
158
					CSTNode result = createIfExpCS(
159
							(OCLExpressionCS)$getSym(2),
160
							(OCLExpressionCS)$getSym(4),
161
							(OCLExpressionCS)$getSym(6)
162
						);
163
					setOffsets(result, getIToken($getToken(1)), getIToken($getToken(7)));
164
					$setResult(result);
165
		  $EndCode
166
		./
167
	ifExpCS ::= if oclExpressionCS then oclExpressionCS ERROR_TOKEN
168
		/.$BeginCode
169
					reportErrorTokenMessage($getToken(5), OCLParserErrors.MISSING_ELSE_ENDIF);
170
					CSTNode result = createIfExpCS(
171
							(OCLExpressionCS)$getSym(2),
172
							(OCLExpressionCS)$getSym(4),
173
							createInvalidLiteralExpCS(getTokenText($getToken(5)))
174
						);
175
					setOffsets(result, getIToken($getToken(1)), getIToken($getToken(5)));
176
					$setResult(result);
177
		  $EndCode
178
		./
179
	ifExpCS ::= if oclExpressionCS ERROR_TOKEN
180
		/.$BeginCode
181
					reportErrorTokenMessage($getToken(3), OCLParserErrors.MISSING_THEN_ELSE_ENDIF);
182
					CSTNode result = createIfExpCS(
183
							(OCLExpressionCS)$getSym(2),
184
							createInvalidLiteralExpCS(getTokenText($getToken(3))),
185
							createInvalidLiteralExpCS(getTokenText($getToken(3)))
186
						);
187
					setOffsets(result, getIToken($getToken(1)), getIToken($getToken(3)));
188
					$setResult(result);
189
		  $EndCode
190
		./
191
	ifExpCS ::= if ERROR_TOKEN endif
192
		/.$BeginCode
193
					reportErrorTokenMessage($getToken(3), OCLParserErrors.MISSING_THEN_ELSE);
194
					CSTNode result = createIfExpCS(
195
							createInvalidLiteralExpCS(getTokenText($getToken(2))),
196
							createInvalidLiteralExpCS(getTokenText($getToken(2))),
197
							createInvalidLiteralExpCS(getTokenText($getToken(2)))
198
						);
199
					setOffsets(result, getIToken($getToken(1)), getIToken($getToken(3)));
200
					$setResult(result);
201
		  $EndCode
202
		./
203
		
204
	messageExpCS ::= '^' simpleNameCS ERROR_TOKEN
205
		/.$NewCase./
206
	messageExpCS ::= '^^' simpleNameCS ERROR_TOKEN
207
		/.$BeginCode
208
					reportErrorTokenMessage($getToken(1), OCLParserErrors.MISSING_MESSAGE_ARGUMENTS);
209
					CSTNode result = createMessageExpCS(
210
							getIToken($getToken(1)).getKind() == $sym_type.TK_CARET,
211
							(SimpleNameCS)$getSym(2),
212
							new BasicEList<OCLMessageArgCS>()
213
						);
214
					setOffsets(result, getIToken($getToken(1)), getIToken($getToken(3)));
215
					$setResult(result);
216
		  $EndCode
217
		./
218
	messageExpCS ::= '^' ERROR_SimpleNameCS
219
		/.$NewCase./
220
	messageExpCS ::= '^^' ERROR_SimpleNameCS
221
		/.$BeginCode
222
					SimpleNameCS simpleNameCS = (SimpleNameCS)$getSym(2);
223
					CSTNode result = createMessageExpCS(
224
							getIToken($getToken(1)).getKind() == $sym_type.TK_CARET,
225
							simpleNameCS,
226
							new BasicEList<OCLMessageArgCS>()
227
						);
228
					setOffsets(result, getIToken($getToken(1)), simpleNameCS);
229
					$setResult(result);
230
		  $EndCode
231
		./
232
233
	oclExpCS ::= ERROR_TOKEN
234
		/.$BeginCode
235
					reportErrorTokenMessage($getToken(1), OCLParserErrors.MISSING_EXPR);
236
					CSTNode result = createInvalidLiteralExpCS(getTokenText($getToken(1)));
237
					setOffsets(result, getIToken($getToken(1)));
238
					$setResult(result);
239
		  $EndCode
240
		./
241
	oclExpCS ::= '(' oclExpressionCS ERROR_TOKEN
242
		/.$BeginCode
243
					reportErrorTokenMessage($getToken(3), OCLParserErrors.MISSING_RPAREN);
244
					CSTNode result = (CSTNode)$getSym(2);
245
					setOffsets(result, getIToken($getToken(1)), getIToken($getToken(3)));
246
					$setResult(result);
247
		  $EndCode
248
		./
249
250
	operationCS1 ::= IDENTIFIER '(' parametersCSopt ')' ERROR_Colon
251
		/.$BeginCode
252
					CSTNode result = createOperationCS(
253
							getTokenText($getToken(1)),
254
							(EList)$getSym(3),
255
							null
256
						);
257
					setOffsets(result, getIToken($getToken(1)), getIToken($getToken(5)));
258
					$setResult(result);
259
		  $EndCode
260
		./
261
	operationCS1 ::= IDENTIFIER '(' parametersCSopt ERROR_TOKEN
262
		/.$BeginCode
263
					reportErrorTokenMessage($getToken(4), OCLParserErrors.MISSING_RPAREN);
264
					CSTNode result = createOperationCS(
265
							getTokenText($getToken(1)),
266
							(EList)$getSym(3),
267
							null
268
						);
269
					setOffsets(result, getIToken($getToken(1)), getIToken($getToken(4)));
270
					$setResult(result);
271
		  $EndCode
272
		./
273
	operationCS1 ::= IDENTIFIER ERROR_TOKEN
274
		/.$BeginCode
275
					reportErrorTokenMessage($getToken(2), OCLParserErrors.MISSING_LPAREN);
276
					CSTNode result = createOperationCS(
277
							getTokenText($getToken(1)),
278
							new BasicEList(),
279
							null
280
						);
281
					setOffsets(result, getIToken($getToken(1)), getIToken($getToken(2)));
282
					$setResult(result);
283
		  $EndCode
284
		./
285
	operationCS1 ::= ERROR_TOKEN
286
		/.$BeginCode
287
					reportErrorTokenMessage($getToken(1), OCLParserErrors.MISSING_IDENTIFIER);
288
					CSTNode result = createOperationCS(
289
							getTokenText($getToken(1)),
290
							new BasicEList(),
291
							null
292
						);
293
					setOffsets(result, getIToken($getToken(1)));
294
					$setResult(result);
295
		  $EndCode
296
		./
297
	operationCS2 ::= pathNameCS '::' simpleNameCS '(' parametersCSopt ')' ERROR_Colon
298
		/.$BeginCode
299
					PathNameCS pathNameCS = (PathNameCS)$getSym(1);
300
					CSTNode result = createOperationCS(
301
							pathNameCS,
302
							(SimpleNameCS)$getSym(3),
303
							(EList)$getSym(5),
304
							(TypeCS)$getSym(8)
305
						);
306
					setOffsets(result, pathNameCS, getIToken($getToken(7)));
307
					$setResult(result);
308
		  $EndCode
309
		./
310
	operationCS2 ::= pathNameCS '::' simpleNameCS '(' parametersCSopt ERROR_TOKEN
311
		/.$BeginCode
312
					reportErrorTokenMessage($getToken(6), OCLParserErrors.MISSING_RPAREN);
313
					PathNameCS pathNameCS = (PathNameCS)$getSym(1);
314
					CSTNode result = createOperationCS(
315
							pathNameCS,
316
							(SimpleNameCS)$getSym(3),
317
							(EList)$getSym(5),
318
							null
319
						);
320
					setOffsets(result, pathNameCS, getIToken($getToken(7)));
321
					$setResult(result);
322
		  $EndCode
323
		./
324
	operationCS2 ::= pathNameCS '::' simpleNameCS ERROR_TOKEN
325
		/.$BeginCode
326
					reportErrorTokenMessage($getToken(4), OCLParserErrors.MISSING_LPAREN);
327
					PathNameCS pathNameCS = (PathNameCS)$getSym(1);
328
					CSTNode result = createOperationCS(
329
							pathNameCS,
330
							(SimpleNameCS)$getSym(3),
331
							new BasicEList(),
332
							null
333
						);
334
					setOffsets(result, pathNameCS, getIToken($getToken(4)));
335
					$setResult(result);
336
		  $EndCode
337
		./
338
	operationCS2 ::= pathNameCS '::' ERROR_SimpleNameCS
339
		/.$BeginCode
340
					PathNameCS pathNameCS = (PathNameCS)$getSym(1);
341
					SimpleNameCS simpleNameCS = (SimpleNameCS)$getSym(3);
342
					CSTNode result = createOperationCS(
343
							pathNameCS,
344
							simpleNameCS,
345
							new BasicEList(),
346
							null
347
						);
348
					setOffsets(result, pathNameCS, simpleNameCS);
349
					$setResult(result);
350
		  $EndCode
351
		./
352
353
	parametersCS ::= ERROR_TOKEN
354
		/.$BeginCode
355
					reportErrorTokenMessage($getToken(1), OCLParserErrors.MISSING_PARAMETERS);
356
					EList result = new BasicEList();
357
					$setResult(result);
358
		  $EndCode
359
		./
360
	parametersCS ::= parametersCS ',' ERROR_TOKEN
361
		/.$BeginCode
362
					reportErrorTokenMessage($getToken(3), OCLParserErrors.MISSING_PARAMETER);
363
		  $EndCode
364
		./
365
366
	pathNameCS -> ERROR_PathNameCS
367
		
368
	simpleNameCSopt -> ERROR_SimpleNameCS
369
370
	tupleLiteralExpCS ::= Tuple ERROR_TOKEN
371
		/.$BeginCode
372
					reportErrorTokenMessage($getToken(7), OCLParserErrors.MISSING_LBRACE);
373
					CSTNode result = createTupleLiteralExpCS((EList)$getSym(3));
374
					setOffsets(result, getIToken($getToken(1)), getIToken($getToken(4)));
375
					$setResult(result);
376
		  $EndCode
377
		./
378
379
	variableCS ::= IDENTIFIER ERROR_TOKEN
380
		/.$BeginCode
381
					reportErrorTokenMessage($getToken(2), OCLParserErrors.MISSING_VARIABLE_TYPE);
382
					CSTNode result = createVariableCS(
383
							getTokenText($getToken(1)),
384
							null,
385
							null
386
						);
387
					setOffsets(result, getIToken($getToken(1)), getIToken($getToken(2)));
388
					$setResult(result);
389
		  $EndCode
390
		./
391
392
	variableExpCS ::= simpleNameCS '[' argumentsCS ERROR_TOKEN
393
		/.$NewCase./
394
	variableExpCS ::= keywordAsName1 '[' argumentsCS ERROR_TOKEN
395
		/.$BeginCode
396
					reportErrorTokenMessage($getToken(4), OCLParserErrors.MISSING_RBRACK);
397
					CSTNode result = createVariableExpCS(
398
							(SimpleNameCS)$getSym(1),
399
							(EList)$getSym(3),
400
							null
401
						);
402
					setOffsets(result, (CSTNode)$getSym(1), getIToken($getToken(4)));
403
					$setResult(result);
404
		  $EndCode
405
		./
406
407
	variableListCS ::= ERROR_TOKEN
408
		/.$NewCase./
409
	variableListCS2 ::= ERROR_TOKEN
410
		/.$BeginCode
411
					reportErrorTokenMessage($getToken(1), OCLParserErrors.MISSING_VARIABLES);
412
					EList result = new BasicEList();
413
					$setResult(result);
414
		  $EndCode
415
		./
416
417
%End
(-)src/org/eclipse/ocl/lpg/KeywordTemplateD.gi (+119 lines)
Added Link Here
1
--
2
-- An LPG Lexer Template Using lpg.jar
3
--
4
-- An instance of this template must have a $Export section and the export_terminals option
5
-- There must be only one non-terminal, the start symbol, for the keywords
6
-- The action for each keyword should be a call to $setResult(terminal_symbol)
7
--
8
-- Macro that may be redefined in an instance of this template
9
--
10
--     $eof_char
11
--
12
-- B E G I N N I N G   O F   T E M P L A T E   KeywordTemplateD
13
--
14
%options Programming_Language=java,margin=4
15
%options table
16
%options action-block=("*.java", "/.", "./")
17
%options ParseTable=lpg.runtime.ParseTable
18
%options prefix=Char_
19
%options single-productions
20
21
--
22
-- This template requires that the name of the EOF token be set
23
-- to EOF and that the prefix be "Char_" to be consistent with
24
-- LexerTemplateD.
25
--
26
%Eof
27
    EOF
28
%End
29
30
%Define
31
    --
32
    -- Macro that may be respecified in an instance of this template
33
    --
34
    $eof_char /.Char_EOF./
35
36
    --
37
    -- Macros useful for specifying actions
38
    --
39
    $setResult /.keywordKind[$rule_number] = ./
40
41
    $Header
42
    /.
43
            //
44
            // Rule $rule_number:  $rule_text
45
            //
46
            ./
47
48
    $BeginAction /.$Header./
49
50
    $EndAction /../
51
52
    $BeginJava /.$BeginAction./
53
54
    $EndJava /.$EndAction./
55
%End
56
57
%Headers
58
    /.
59
    public class $action_type extends $prs_type implements $exp_type
60
    {
61
        private char[] inputChars;
62
        private final int keywordKind[] = new int[$num_rules + 1];
63
64
        public int[] getKeywordKinds() { return keywordKind; }
65
66
        public int lexer(int curtok, int lasttok)
67
        {
68
            int current_kind = getKind(inputChars[curtok]),
69
                act;
70
71
            for (act = tAction(START_STATE, current_kind);
72
                 act > NUM_RULES && act < ACCEPT_ACTION;
73
                 act = tAction(act, current_kind))
74
            {
75
                curtok++;
76
                current_kind = (curtok > lasttok
77
                                       ? $eof_char
78
                                       : getKind(inputChars[curtok]));
79
            }
80
81
            if (act > ERROR_ACTION)
82
            {
83
                curtok++;
84
                act -= ERROR_ACTION;
85
            }
86
87
            return keywordKind[act == ERROR_ACTION  || curtok <= lasttok ? 0 : act];
88
        }
89
90
        public void setInputChars(char[] inputChars) { this.inputChars = inputChars; }
91
92
    ./
93
%End
94
95
%Rules
96
    /.
97
98
        public $action_type(char[] inputChars, int identifierKind)
99
        {
100
            this.inputChars = inputChars;
101
            keywordKind[0] = identifierKind;
102
    ./
103
%End
104
105
%Trailers
106
    /.
107
            for (int i = 0; i < keywordKind.length; i++)
108
            {
109
                if (keywordKind[i] == 0)
110
                    keywordKind[i] = identifierKind;
111
            }
112
        }
113
    }
114
    ./
115
%End
116
117
--
118
-- E N D   O F   T E M P L A T E
119
--
(-)src/org/eclipse/ocl/parser/OCLLexer.gi (+613 lines)
Added Link Here
1
--/**
2
-- * <copyright>
3
-- *
4
-- * Copyright (c) 2005, 2009 IBM Corporation, Borland Software Corp. and others.
5
-- * All rights reserved.   This program and the accompanying materials
6
-- * are made available under the terms of the Eclipse Public License v1.0
7
-- * which accompanies this distribution, and is available at
8
-- * http://www.eclipse.org/legal/epl-v10.html
9
-- *f
10
-- * Contributors:
11
-- *   See (or edit) Notice Declaration below
12
-- *   
13
-- * </copyright>
14
-- *
15
-- * $Id: OCLLexer.g,v 1.2 2009/02/12 00:04:09 cdamus Exp $
16
-- */
17
--
18
-- The OCL Lexer
19
--
20
21
%options escape=$
22
%options la=2
23
%options fp=OCLLexer,prefix=Char_
24
%options single-productions
25
%options noserialize
26
%options package=org.eclipse.ocl.parser
27
%options template=../lpg/LexerTemplateD.gi
28
%options filter=OCLKWLexer.gi
29
%options export_terminals=("OCLParsersym.java", "TK_")
30
%options include_directory="../lpg"
31
32
%Define
33
34
	--
35
	-- Definition of macros used in the template
36
	--
37
	$action_class /.$file_prefix./
38
	$eof_token /.$_EOF_TOKEN./
39
    $environment_class /.Environment<?,?,?,?,?,?,?,?,?,?,?,?>./
40
    $adapt_environment /.OCLUtil.getAdapter(environment, BasicEnvironment.class)./
41
    $environment_import /.org.eclipse.ocl.Environment./
42
 
43
	--
44
	-- Definition of macro used in the included file LexerBasicMap.g
45
	--
46
	$kw_lexer_class /.OCLKWLexer./
47
	$copyright_contributions /.*./
48
49
%End
50
51
%Notice
52
	/./**
53
 * <copyright>
54
 *
55
 * Copyright (c) 2005, 2009 IBM Corporation, Borland Software Corp. and others.
56
 * All rights reserved.   This program and the accompanying materials
57
 * are made available under the terms of the Eclipse Public License v1.0
58
 * which accompanies this distribution, and is available at
59
 * http://www.eclipse.org/legal/epl-v10.html
60
 *
61
 * Contributors:
62
 *   IBM - Initial API and implementation
63
 *   E.D.Willink - Lexer and Parser refactoring to support extensibility and flexible error handling
64
 *               - Bug 259818
65
 *   Borland - Bug 242880
66
 *   Adolfo Sanchez-Barbudo Herrera (Open Canarias) - LPG v 2.0.17 adoption (242153)
67
 $copyright_contributions
68
 * </copyright>
69
 *
70
 * $Id: OCLLexer.g,v 1.3 2009/08/28 20:43:11 ewillink Exp $
71
 */
72
	./
73
%End
74
75
%Import
76
	LexerBasicMap.gi
77
%End
78
79
%Globals
80
    /.import $environment_import;
81
    import org.eclipse.ocl.lpg.BasicEnvironment;
82
    import org.eclipse.ocl.util.OCLUtil;
83
    ./
84
%End
85
86
%Export
87
88
	IDENTIFIER
89
	STRING_LITERAL
90
	INTEGER_LITERAL
91
	REAL_LITERAL
92
	NUMERIC_OPERATION
93
	INTEGER_RANGE_START
94
	
95
	PLUS
96
	MINUS
97
	MULTIPLY
98
	DIVIDE
99
100
	GREATER
101
	LESS
102
	EQUAL
103
	GREATER_EQUAL
104
	LESS_EQUAL
105
	NOT_EQUAL
106
107
	LPAREN
108
	RPAREN
109
	LBRACE
110
	RBRACE
111
	LBRACKET
112
	RBRACKET
113
114
	ARROW
115
	BAR
116
	COMMA
117
	COLON
118
	COLONCOLON
119
	SEMICOLON
120
	DOT
121
	DOTDOT
122
	ATPRE
123
	
124
	CARET
125
	CARETCARET
126
	QUESTIONMARK
127
	
128
	SINGLE_LINE_COMMENT
129
	MULTI_LINE_COMMENT
130
131
%End
132
133
%Terminals
134
	CtlCharNotWS
135
136
	LF   CR   HT   FF
137
138
	a b c d e f g h i j k l m n o p q r s t u v w x y z
139
	_
140
141
	A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
142
143
	0 1 2 3 4 5 6 7 8 9
144
145
	AfterASCIINotAcute
146
	Space        ::= ' '
147
	LF           ::= NewLine
148
	CR           ::= Return
149
	HT           ::= HorizontalTab
150
	FF           ::= FormFeed
151
	DoubleQuote  ::= '"'
152
	SingleQuote  ::= "'"
153
	Percent      ::= '%'
154
	VerticalBar  ::= '|'
155
	Exclamation  ::= '!'
156
	AtSign       ::= '@'
157
	BackQuote    ::= '`'
158
	Acute        ::= '´'
159
	Tilde        ::= '~'
160
	Sharp        ::= '#'
161
	DollarSign   ::= '$'
162
	Ampersand    ::= '&'
163
	Caret        ::= '^'
164
	Colon        ::= ':'
165
	SemiColon    ::= ';'
166
	BackSlash    ::= '\'
167
	LeftBrace    ::= '{'
168
	RightBrace   ::= '}'
169
	LeftBracket  ::= '['
170
	RightBracket ::= ']'
171
	QuestionMark ::= '?'
172
	Comma        ::= ','
173
	Dot          ::= '.'
174
	LessThan     ::= '<'
175
	GreaterThan  ::= '>'
176
	Plus         ::= '+'
177
	Minus        ::= '-'
178
	Slash        ::= '/'
179
	Star         ::= '*'
180
	LeftParen    ::= '('
181
	RightParen   ::= ')'
182
	Equal        ::= '='
183
184
%End
185
186
%Start
187
	Token
188
%End
189
190
%Rules
191
192
	---------------------  Rules for Scanned Tokens --------------------------------
193
	-- The lexer creates an array list of tokens which is defined in the PrsStream class.
194
	-- A token has three attributes: a start offset, an end offset and a kind.
195
	-- 
196
	-- Only rules that produce complete tokens have actions to create token objects.
197
	-- When making a token, calls to the methods, $getToken(1) and $getRightSpan(), 
198
	-- provide the offsets (i.e. the span) of a rule's right hand side (rhs) and thus of the token.
199
	-- For a rule of the form A ::= A1 A2 ... An, the start offset of the rhs of A is given by
200
	-- $getToken(1) or by $getLeftSpan() and the end offset by $getRightSpan().
201
	--  
202
	-- Regarding rules for parsing in general, note that for a rhs symbol Ai, the 
203
	-- method $getToken(i) returns the location of the leftmost character derived from Ai.  
204
	-- The method $getLeftSpan(i) returns the same location unless Ai produces %empty in which case
205
	-- it returns the location of the last character derived before reducing Ai to %empty. 
206
	-- The method $getRightSpan(i) returns the location of the rightmost character derived from Ai 
207
	-- unless Ai produces %empty in which case it returns the location of the last character 
208
	-- derived before reducing Ai to %empty.
209
	--------------------------------------------------------------------------------
210
	Token ::= Identifier
211
		/.$BeginAction
212
					checkForKeyWord();
213
		  $EndAction
214
		./
215
216
	-- an empty String literal looks just like an escaped single-quote
217
	Token ::= EscapedSQ
218
		/.$BeginAction
219
					makeToken($_STRING_LITERAL);
220
		  $EndAction
221
		./
222
223
	Token ::= SingleQuote SLNotSQ SingleQuote
224
		/.$BeginAction
225
					makeToken($_STRING_LITERAL);
226
		  $EndAction
227
		./
228
229
	Token ::= Acute SLNotSQOpt Acute
230
		/.$BeginAction
231
					makeToken($_STRING_LITERAL);
232
		  $EndAction
233
		./
234
235
	Token ::= BackQuote SLNotSQOpt Acute
236
		/.$BeginAction
237
					makeToken($_STRING_LITERAL);
238
		  $EndAction
239
		./
240
241
	Token ::= IntegerLiteral
242
		/.$BeginAction
243
					makeToken($_INTEGER_LITERAL);
244
		  $EndAction
245
		./
246
247
	Token ::= RealLiteral
248
		/.$BeginAction
249
					makeToken($_REAL_LITERAL);
250
		  $EndAction
251
		./
252
253
	Token ::= NumericOperation
254
		/.$BeginAction
255
					makeToken($_NUMERIC_OPERATION);
256
		  $EndAction
257
		./
258
259
	Token ::= IntegerRangeStart
260
		/.$BeginAction
261
					makeToken($_INTEGER_RANGE_START);
262
		  $EndAction
263
		./
264
265
	Token ::= SLC
266
		/.$BeginAction
267
					makeComment($_SINGLE_LINE_COMMENT);
268
		  $EndAction
269
		./
270
271
    Token ::= '/' '*' Inside Stars '/'
272
        /.$BeginAction
273
                    makeComment($_MULTI_LINE_COMMENT);
274
          $EndAction
275
        ./
276
277
	Token ::= WS -- White Space is scanned but not added to output vector
278
		/.$BeginAction
279
					skipToken();
280
		  $EndAction
281
		./
282
283
	Token ::= '+'
284
		/.$BeginAction
285
					makeToken($_PLUS);
286
		  $EndAction
287
		./
288
289
	Token ::= '-'
290
		/.$BeginAction
291
					makeToken($_MINUS);
292
		  $EndAction
293
		./
294
295
	Token ::= '*'
296
		/.$BeginAction
297
					makeToken($_MULTIPLY);
298
		  $EndAction
299
		./
300
301
	Token ::= '/'
302
		/.$BeginAction
303
					makeToken($_DIVIDE);
304
		  $EndAction
305
		./
306
307
	Token ::= '('
308
		/.$BeginAction
309
					makeToken($_LPAREN);
310
		  $EndAction
311
		./
312
313
	Token ::= ')'
314
		/.$BeginAction
315
					makeToken($_RPAREN);
316
		  $EndAction
317
		./
318
319
	Token ::= '>'
320
		/.$BeginAction
321
					makeToken($_GREATER);
322
		  $EndAction
323
		./
324
		
325
	Token ::= '<'
326
		/.$BeginAction
327
					makeToken($_LESS);
328
		  $EndAction
329
		./
330
331
	Token ::= '='
332
		/.$BeginAction
333
					makeToken($_EQUAL);
334
		  $EndAction
335
		./
336
337
	Token ::= '>' '='
338
		/.$BeginAction
339
					makeToken($_GREATER_EQUAL);
340
		  $EndAction
341
		./
342
343
	Token ::= '<' '='
344
		/.$BeginAction
345
					makeToken($_LESS_EQUAL);
346
		  $EndAction
347
		./
348
349
	Token ::= '<' '>'
350
		/.$BeginAction
351
					makeToken($_NOT_EQUAL);
352
		  $EndAction
353
		./
354
355
	Token ::= '['
356
		/.$BeginAction
357
					makeToken($_LBRACKET);
358
		  $EndAction
359
		./
360
361
	Token ::= ']'
362
		/.$BeginAction
363
					makeToken($_RBRACKET);
364
		  $EndAction
365
		./
366
367
	Token ::= '{'
368
		/.$BeginAction
369
					makeToken($_LBRACE);
370
		  $EndAction
371
		./
372
373
	Token ::= '}'
374
		/.$BeginAction
375
					makeToken($_RBRACE);
376
		  $EndAction
377
		./
378
379
	Token ::= '-' '>'
380
		/.$BeginAction
381
					makeToken($_ARROW);
382
		  $EndAction
383
		./
384
385
	Token ::= '|'
386
		/.$BeginAction
387
					makeToken($_BAR);
388
		  $EndAction
389
		./
390
391
	Token ::= ','
392
		/.$BeginAction
393
					makeToken($_COMMA);
394
		  $EndAction
395
		./
396
397
	Token ::= ':'
398
		/.$BeginAction
399
					makeToken($_COLON);
400
		  $EndAction
401
		./
402
403
	Token ::= ':' ':'
404
		/.$BeginAction
405
					makeToken($_COLONCOLON);
406
		  $EndAction
407
		./
408
409
	Token ::= ';'
410
		/.$BeginAction
411
					makeToken($_SEMICOLON);
412
		  $EndAction
413
		./
414
415
	Token ::= '.'
416
		/.$BeginAction
417
					makeToken($_DOT);
418
		  $EndAction
419
		./
420
421
	Token ::= '.' '.'
422
		/.$BeginAction
423
					makeToken($_DOTDOT);
424
		  $EndAction
425
		./
426
427
	Token ::= '@' p r e
428
		/.$BeginAction
429
					makeToken($_ATPRE);
430
		  $EndAction
431
		./
432
433
434
	Token ::= '^'
435
		/.$BeginAction
436
					makeToken($_CARET);
437
		  $EndAction
438
		./
439
440
	Token ::= '^' '^'
441
		/.$BeginAction
442
					makeToken($_CARETCARET);
443
		  $EndAction
444
		./
445
		
446
	Token ::= '?'
447
		/.$BeginAction
448
					makeToken($_QUESTIONMARK);
449
		  $EndAction
450
		./
451
452
453
    IntegerLiteral -> Integer
454
    --                | '0' LetterXx HexDigits
455
456
    RealLiteral -> Decimal
457
                 | Decimal Exponent
458
                 | Integer Exponent
459
460
    Inside ::= Inside Stars NotSlashOrStar
461
             | Inside '/'
462
             | Inside NotSlashOrStar
463
             | %empty
464
465
    Stars -> '*'
466
           | Stars '*'
467
468
    SLC -> '-' '-'
469
         | SLC NotEol
470
471
    Integer -> Digit
472
             | Integer Digit
473
474
    HexDigits -> HexDigit
475
               | HexDigits HexDigit
476
477
    Decimal -> Integer '.' Integer
478
479
    Exponent -> LetterEe Integer
480
              | LetterEe '-' Integer
481
              | LetterEe '+' Integer
482
483
    WSChar -> Space
484
            | LF
485
            | CR
486
            | HT
487
            | FF
488
489
    Letter -> LowerCaseLetter
490
            | UpperCaseLetter
491
            | _
492
            | AfterASCIINotAcute
493
494
    LowerCaseLetter -> a | b | c | d | e | f | g | h | i | j | k | l | m |
495
                       n | o | p | q | r | s | t | u | v | w | x | y | z
496
497
    UpperCaseLetter -> A | B | C | D | E | F | G | H | I | J | K | L | M |
498
                       N | O | P | Q | R | S | T | U | V | W | X | Y | Z
499
500
    Digit -> 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9
501
502
    OctalDigit -> 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7
503
504
    a..fA..F -> a | b | c | d | e | f | A | B | C | D | E | F
505
506
    HexDigit -> Digit
507
              | a..fA..F
508
509
    OctalDigits3 -> OctalDigit
510
                  | OctalDigit OctalDigit
511
                  | OctalDigit OctalDigit OctalDigit
512
513
    LetterEe -> 'E'
514
              | 'e'
515
516
    LetterXx -> 'X'
517
              | 'x'
518
519
    WS -> WSChar
520
        | WS WSChar
521
522
    Identifier -> Letter
523
                | Identifier Letter
524
                | Identifier Digit
525
                | Identifier DollarSign
526
                | QuotedName
527
528
    SpecialNotStar -> '+' | '-' | '/' | '(' | ')' | '"' | '!' | '@' | '`' | '~' |
529
                      '%' | '&' | '^' | ':' | ';' | "'" | '\' | '|' | '{' | '}' |
530
                      '[' | ']' | '?' | ',' | '.' | '<' | '>' | '=' | '#' | DollarSign
531
532
    SpecialNotSlash -> '+' | '-' | -- exclude the star as well
533
                       '(' | ')' | '"' | '!' | '@' | '`' | '~' |
534
                       '%' | '&' | '^' | ':' | ';' | "'" | '\' | '|' | '{' | '}' |
535
                       '[' | ']' | '?' | ',' | '.' | '<' | '>' | '=' | '#' | DollarSign
536
537
    SpecialNotSQNotDQ -> '+' | '-' | '/' | '(' | ')' | '*' | '!' | '@' | '`' | '~' |
538
                         '%' | '&' | '^' | ':' | ';' | '|' | '{' | '}' |
539
                         '[' | ']' | '?' | ',' | '.' | '<' | '>' | '=' | '#' | DollarSign
540
541
    
542
    SpecialNotDQ -> SpecialNotSQNotDQ | "'"
543
    SpecialNotSQ -> SpecialNotSQNotDQ | '"'
544
545
    EscapedSymbols -> NotSQNotDQ | '"' | "'" | '\'
546
    BackslashEscapedSymbol -> '\' EscapedSymbols
547
548
    NotSlashOrStar -> Letter
549
                    | Digit
550
                    | SpecialNotSlash
551
                    | WSChar
552
553
    NotEol -> Letter
554
            | Digit
555
            | Space
556
            | '*'
557
            | SpecialNotStar
558
            | HT
559
            | FF
560
            | CtlCharNotWS
561
562
    NotSQNotDQ -> Letter
563
           | Digit
564
           | SpecialNotSQNotDQ
565
           | Space
566
567
    NotDQ -> Letter
568
           | Digit
569
           | SpecialNotDQ
570
           | Space
571
           | EscapedDQ
572
           --| '\' u HexDigit HexDigit HexDigit HexDigit
573
           --| '\' OctalDigit
574
575
    NotSQ -> Letter
576
           | Digit
577
           | SpecialNotSQ
578
           | Space
579
           | EscapedSQ
580
           | BackslashEscapedSymbol
581
           --| '\' u HexDigit HexDigit HexDigit HexDigit
582
           --| '\' OctalDigit
583
584
	EscapedSQ -> SingleQuote SingleQuote
585
586
	-- maintain this for compatibility with the "...\"..." escapes in an
587
	-- escape mechanism (double-quotes) that isn't compliant, anyway
588
	EscapedDQ -> '\' DoubleQuote
589
590
	SLNotDQ -> NotDQ
591
	         | SLNotDQ NotDQ
592
593
	SLNotSQ -> NotSQ
594
	         | SLNotSQ NotSQ
595
596
	SLNotSQOpt -> %empty
597
	            | SLNotSQ
598
599
	QuotedName -> '"' SLNotDQ '"'
600
601
	NumericOperation -> Integer '.' Identifier
602
	NumericOperation -> Integer '.' '+'
603
	NumericOperation -> Integer '.' '-'
604
	NumericOperation -> Integer '.' '*'
605
	NumericOperation -> Integer '.' '/'
606
	NumericOperation -> Integer '.' '<'
607
	NumericOperation -> Integer '.' '<' '='
608
	NumericOperation -> Integer '.' '>' '='
609
	NumericOperation -> Integer '.' '>'
610
611
	IntegerRangeStart -> Integer '.' '.'
612
613
%End
(-)src/org/eclipse/ocl/lpg/KWLexerMap.gi (+80 lines)
Added Link Here
1
%Terminals
2
    DollarSign ::= '$'
3
    Percent ::= '%'
4
    _
5
    a b c d e f g h i j k l m n o p q r s t u v w x y z
6
    A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
7
%End
8
9
%Headers
10
    /.
11
        final static int tokenKind[] = new int[128];
12
        static
13
        {
14
            tokenKind['$'] = $sym_type.$prefix$DollarSign$suffix$;
15
            tokenKind['%'] = $sym_type.$prefix$Percent$suffix$;
16
            tokenKind['_'] = $sym_type.$prefix$_$suffix$;
17
18
            tokenKind['a'] = $sym_type.$prefix$a$suffix$;
19
            tokenKind['b'] = $sym_type.$prefix$b$suffix$;
20
            tokenKind['c'] = $sym_type.$prefix$c$suffix$;
21
            tokenKind['d'] = $sym_type.$prefix$d$suffix$;
22
            tokenKind['e'] = $sym_type.$prefix$e$suffix$;
23
            tokenKind['f'] = $sym_type.$prefix$f$suffix$;
24
            tokenKind['g'] = $sym_type.$prefix$g$suffix$;
25
            tokenKind['h'] = $sym_type.$prefix$h$suffix$;
26
            tokenKind['i'] = $sym_type.$prefix$i$suffix$;
27
            tokenKind['j'] = $sym_type.$prefix$j$suffix$;
28
            tokenKind['k'] = $sym_type.$prefix$k$suffix$;
29
            tokenKind['l'] = $sym_type.$prefix$l$suffix$;
30
            tokenKind['m'] = $sym_type.$prefix$m$suffix$;
31
            tokenKind['n'] = $sym_type.$prefix$n$suffix$;
32
            tokenKind['o'] = $sym_type.$prefix$o$suffix$;
33
            tokenKind['p'] = $sym_type.$prefix$p$suffix$;
34
            tokenKind['q'] = $sym_type.$prefix$q$suffix$;
35
            tokenKind['r'] = $sym_type.$prefix$r$suffix$;
36
            tokenKind['s'] = $sym_type.$prefix$s$suffix$;
37
            tokenKind['t'] = $sym_type.$prefix$t$suffix$;
38
            tokenKind['u'] = $sym_type.$prefix$u$suffix$;
39
            tokenKind['v'] = $sym_type.$prefix$v$suffix$;
40
            tokenKind['w'] = $sym_type.$prefix$w$suffix$;
41
            tokenKind['x'] = $sym_type.$prefix$x$suffix$;
42
            tokenKind['y'] = $sym_type.$prefix$y$suffix$;
43
            tokenKind['z'] = $sym_type.$prefix$z$suffix$;
44
45
            tokenKind['A'] = $sym_type.$prefix$A$suffix$;
46
            tokenKind['B'] = $sym_type.$prefix$B$suffix$;
47
            tokenKind['C'] = $sym_type.$prefix$C$suffix$;
48
            tokenKind['D'] = $sym_type.$prefix$D$suffix$;
49
            tokenKind['E'] = $sym_type.$prefix$E$suffix$;
50
            tokenKind['F'] = $sym_type.$prefix$F$suffix$;
51
            tokenKind['G'] = $sym_type.$prefix$G$suffix$;
52
            tokenKind['H'] = $sym_type.$prefix$H$suffix$;
53
            tokenKind['I'] = $sym_type.$prefix$I$suffix$;
54
            tokenKind['J'] = $sym_type.$prefix$J$suffix$;
55
            tokenKind['K'] = $sym_type.$prefix$K$suffix$;
56
            tokenKind['L'] = $sym_type.$prefix$L$suffix$;
57
            tokenKind['M'] = $sym_type.$prefix$M$suffix$;
58
            tokenKind['N'] = $sym_type.$prefix$N$suffix$;
59
            tokenKind['O'] = $sym_type.$prefix$O$suffix$;
60
            tokenKind['P'] = $sym_type.$prefix$P$suffix$;
61
            tokenKind['Q'] = $sym_type.$prefix$Q$suffix$;
62
            tokenKind['R'] = $sym_type.$prefix$R$suffix$;
63
            tokenKind['S'] = $sym_type.$prefix$S$suffix$;
64
            tokenKind['T'] = $sym_type.$prefix$T$suffix$;
65
            tokenKind['U'] = $sym_type.$prefix$U$suffix$;
66
            tokenKind['V'] = $sym_type.$prefix$V$suffix$;
67
            tokenKind['W'] = $sym_type.$prefix$W$suffix$;
68
            tokenKind['X'] = $sym_type.$prefix$X$suffix$;
69
            tokenKind['Y'] = $sym_type.$prefix$Y$suffix$;
70
            tokenKind['Z'] = $sym_type.$prefix$Z$suffix$;
71
        };
72
    
73
        final int getKind(int c)
74
        {
75
            return (((c & 0xFFFFFF80) == 0) /* 0 <= c < 128? */ ? tokenKind[c] : 0);
76
        }
77
    ./
78
%End
79
80

Return to bug 242153