1
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */
4
* Copyright (C) Eran Ifrah (Main file for CodeLite www.codelite.org/ )
5
* Copyright (C) Massimo Cora' 2009 <maxcvs@email.it> (Customizations for Anjuta)
7
* anjuta is free software: you can redistribute it and/or modify it
8
* under the terms of the GNU General Public License as published by the
9
* Free Software Foundation, either version 3 of the License, or
10
* (at your option) any later version.
12
* anjuta is distributed in the hope that it will be useful, but
13
* WITHOUT ANY WARRANTY; without even the implied warranty of
14
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
15
* See the GNU General Public License for more details.
17
* You should have received a copy of the GNU General Public License along
18
* with this program. If not, see <http://www.gnu.org/licenses/>.
22
static char yysccsid[] = "@(#)yaccpar 1.9 (Berkeley) 02/21/93";
27
#define yyclearin (yychar=(-1))
28
#define yyerrok (yyerrflag=0)
29
#define YYRECOVERING (yyerrflag!=0)
30
#define yyparse cl_scope_parse
31
#define yylex cl_scope_lex
32
#define yyerror cl_scope_error
33
#define yychar cl_scope_char
34
#define yyval cl_scope_val
35
#define yylval cl_scope_lval
36
#define yydebug cl_scope_debug
37
#define yynerrs cl_scope_nerrs
38
#define yyerrflag cl_scope_errflag
39
#define yyss cl_scope_ss
40
#define yyssp cl_scope_ssp
41
#define yyvs cl_scope_vs
42
#define yyvsp cl_scope_vsp
43
#define yylhs cl_scope_lhs
44
#define yylen cl_scope_len
45
#define yydefred cl_scope_defred
46
#define yydgoto cl_scope_dgoto
47
#define yysindex cl_scope_sindex
48
#define yyrindex cl_scope_rindex
49
#define yygindex cl_scope_gindex
50
#define yytable cl_scope_table
51
#define yycheck cl_scope_check
52
#define yyname cl_scope_name
53
#define yyrule cl_scope_rule
54
#define YYPREFIX "cl_scope_"
55
/* Copyright Eran Ifrah(c)*/
56
/*************** Includes and Defines *****************************/
62
#define YYDEBUG_LEXER_TEXT (cl_scope_lval)
63
#define YYSTYPE std::string
64
#define YYDEBUG 0 /* get the pretty debugging code to compile*/
67
void cl_scope_error(char *string);
70
static std::vector<std::string> gs_additionlNS;
72
/*---------------------------------------------*/
73
/* externs defined in the lexer*/
74
/*---------------------------------------------*/
75
extern char *cl_scope_text;
76
extern int cl_scope_lex();
77
extern bool setLexerInput(const std::string &in, const std::map<std::string, std::string> &ignoreTokens);
78
extern int cl_scope_lineno;
79
extern std::vector<std::string> currentScope;
80
extern void printScopeName(); /*print the current scope name*/
81
extern void increaseScope(); /*increase scope with anonymouse value*/
82
extern std::string getCurrentScope();
83
extern void cl_scope_lex_clean();
84
extern void cl_scope_less(int count);
86
/*************** Standard ytab.c continues here *********************/
97
#define LE_REGISTER 267
98
#define LE_TYPEDEF 268
100
#define LE_EXTERN 270
101
#define LE_RETURN 271
106
#define LE_UNSIGNED 276
107
#define LE_CONTINUE 277
109
#define LE_SIGNED 279
111
#define LE_DEFAULT 281
113
#define LE_SIZEOF 283
114
#define LE_VOLATILE 284
117
#define LE_STATIC 287
120
#define LE_DELETE 290
122
#define LE_OPERATOR 292
124
#define LE_PUBLIC 294
125
#define LE_PROTECTED 295
126
#define LE_PRIVATE 296
127
#define LE_VIRTUAL 297
128
#define LE_FRIEND 298
129
#define LE_INLINE 299
130
#define LE_OVERLOAD 300
131
#define LE_TEMPLATE 301
132
#define LE_TYPENAME 302
135
#define LE_IDENTIFIER 305
136
#define LE_STRINGliteral 306
137
#define LE_FLOATINGconstant 307
138
#define LE_INTEGERconstant 308
139
#define LE_CHARACTERconstant 309
140
#define LE_OCTALconstant 310
141
#define LE_HEXconstant 311
142
#define LE_POUNDPOUND 312
143
#define LE_CComment 313
144
#define LE_CPPComment 314
145
#define LE_NAMESPACE 315
147
#define LE_TYPEDEFname 317
157
#define LE_ANDAND 327
159
#define LE_ELLIPSIS 329
161
#define LE_DOTstar 331
162
#define LE_ARROWstar 332
163
#define LE_MULTassign 333
164
#define LE_DIVassign 334
165
#define LE_MODassign 335
166
#define LE_PLUSassign 336
167
#define LE_MINUSassign 337
168
#define LE_LSassign 338
169
#define LE_RSassign 339
170
#define LE_ANDassign 340
171
#define LE_ERassign 341
172
#define LE_ORassign 342
174
#define LE_DYNAMIC_CAST 344
175
#define LE_STATIC_CAST 345
176
#define LE_CONST_CAST 346
177
#define LE_REINTERPRET_CAST 347
178
#define YYERRCODE 256
179
short cl_scope_lhs[] = { -1,
180
1, 1, 1, 1, 1, 1, 1, 1, 1, 0,
181
0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
182
2, 12, 12, 14, 14, 13, 13, 15, 15, 16,
183
16, 16, 17, 19, 19, 18, 18, 18, 18, 20,
184
20, 20, 21, 21, 21, 8, 7, 7, 26, 26,
185
3, 3, 9, 10, 11, 27, 27, 28, 28, 29,
186
29, 29, 29, 29, 29, 29, 29, 29, 29, 29,
187
29, 29, 29, 29, 29, 29, 29, 29, 29, 29,
188
29, 29, 29, 29, 29, 29, 29, 29, 29, 29,
189
29, 29, 29, 29, 29, 29, 29, 29, 29, 29,
190
30, 30, 31, 31, 34, 6, 35, 6, 36, 6,
191
23, 23, 37, 38, 37, 32, 32, 22, 22, 39,
192
39, 40, 40, 24, 25, 25, 25, 33, 33, 33,
193
42, 4, 43, 43, 43, 43, 44, 41, 41, 41,
196
short cl_scope_len[] = { 2,
197
1, 1, 1, 1, 1, 1, 1, 1, 1, 0,
198
2, 1, 1, 1, 1, 1, 1, 1, 1, 1,
199
1, 0, 2, 1, 3, 1, 1, 0, 4, 0,
200
1, 3, 3, 0, 3, 0, 1, 1, 1, 0,
201
1, 3, 4, 4, 7, 5, 4, 3, 0, 1,
202
6, 8, 1, 1, 1, 1, 1, 1, 2, 1,
203
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
204
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
205
1, 1, 1, 1, 1, 2, 2, 1, 1, 1,
206
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
207
1, 1, 0, 4, 0, 12, 0, 9, 0, 11,
208
0, 2, 2, 0, 4, 0, 1, 0, 1, 0,
209
1, 0, 2, 2, 0, 1, 1, 3, 3, 6,
210
0, 7, 0, 2, 2, 2, 2, 0, 1, 3,
213
short cl_scope_defred[] = { 10,
214
0, 21, 0, 126, 54, 127, 53, 55, 11, 12,
215
13, 14, 15, 16, 17, 18, 19, 20, 0, 111,
216
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
217
48, 57, 56, 117, 0, 0, 0, 112, 131, 141,
218
26, 27, 24, 0, 0, 47, 50, 0, 119, 111,
219
113, 114, 46, 0, 23, 0, 29, 0, 0, 111,
220
0, 0, 0, 139, 25, 51, 0, 6, 1, 4,
221
2, 5, 3, 8, 7, 9, 0, 0, 0, 122,
222
0, 0, 115, 0, 137, 0, 132, 37, 39, 38,
223
0, 31, 0, 88, 89, 76, 80, 81, 72, 73,
224
82, 83, 84, 85, 74, 75, 79, 77, 91, 92,
225
93, 94, 95, 96, 97, 98, 99, 100, 90, 70,
226
71, 60, 61, 62, 63, 64, 65, 66, 67, 68,
227
69, 78, 0, 0, 59, 0, 129, 0, 58, 0,
228
128, 107, 0, 0, 136, 135, 134, 140, 0, 52,
229
0, 86, 87, 0, 41, 111, 123, 121, 124, 109,
230
0, 105, 32, 0, 33, 0, 122, 0, 0, 101,
231
102, 108, 0, 0, 42, 130, 0, 122, 0, 0,
232
35, 0, 43, 44, 110, 0, 0, 0, 0, 106,
235
short cl_scope_dgoto[] = { 1,
236
80, 9, 10, 11, 12, 13, 14, 15, 16, 17,
237
18, 43, 44, 45, 25, 91, 92, 93, 165, 154,
238
155, 156, 26, 137, 19, 48, 35, 81, 135, 172,
239
187, 36, 60, 173, 161, 169, 38, 61, 159, 138,
242
short cl_scope_sindex[] = { 0,
243
-37, 0, -290, 0, 0, 0, 0, 0, 0, 0,
244
0, 0, 0, 0, 0, 0, 0, 0, -223, 0,
245
-242, -231, 25, -105, -210, -201, -13, 2, -247, 9,
246
0, 0, 0, 0, -227, -178, -58, 0, 0, 0,
247
0, 0, 0, -188, 3, 0, 0, -171, 0, 0,
248
0, 0, 0, -164, 0, -247, 0, -20, 108, 0,
249
-187, 81, -12, 0, 0, 0, -156, 0, 0, 0,
250
0, 0, 0, 0, 0, 0, -33, -57, -248, 0,
251
110, -191, 0, -180, 0, -164, 0, 0, 0, 0,
252
-4, 0, -157, 0, 0, 0, 0, 0, 0, 0,
253
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
254
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
255
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
256
0, 0, 112, 58, 0, -178, 0, 67, 0, 114,
257
0, 0, -54, 117, 0, 0, 0, 0, -156, 0,
258
96, 0, 0, 4, 0, 0, 0, 0, 0, 0,
259
-16, 0, 0, -178, 0, -178, 0, -207, -178, 0,
260
0, 0, -178, 38, 0, 0, -52, 0, 41, -135,
261
0, -178, 0, 0, 0, 129, 47, 40, -178, 0,
264
short cl_scope_rindex[] = { 0,
265
-114, 0, 0, 0, 0, 0, 0, 0, 0, 0,
266
0, 0, 0, 0, 0, 0, 0, 0, 76, 0,
267
0, 0, 0, 0, -47, 0, 0, 0, 46, 0,
268
0, 0, 0, 0, -134, 116, 0, 0, 0, 0,
269
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
270
0, 0, 0, -7, 0, 46, 0, 0, 0, 0,
271
0, -5, 0, 0, 0, 0, -24, 0, 0, 0,
272
0, 0, 0, 0, 0, 0, 0, -23, 0, 0,
273
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
274
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
275
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
276
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
277
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
278
0, 0, 0, 0, 0, -9, 0, -8, 0, 0,
279
0, 0, 132, 0, 0, 0, 0, 0, -132, 0,
280
1, 0, 0, 0, 0, 0, 0, 0, 0, 0,
281
0, 0, 0, -28, 0, -199, 0, 0, 51, 0,
282
0, 0, -100, 0, 0, 0, 85, 0, 0, 52,
283
0, -9, 0, 0, 0, 0, 0, 0, 53, 0,
286
short cl_scope_gindex[] = { 0,
287
8, 0, 0, 0, 0, 0, 0, 0, 0, 0,
288
0, 121, 0, 0, 0, 0, 31, 0, 0, -93,
289
15, -6, -19, -56, 0, 0, 0, 54, 0, 0,
290
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
293
#define YYTABLESIZE 421
294
short cl_scope_table[] = { 131,
295
53, 52, 136, 126, 128, 52, 133, 182, 124, 122,
296
119, 125, 132, 125, 122, 40, 58, 31, 122, 30,
297
6, 4, 118, 141, 20, 8, 120, 123, 121, 50,
298
59, 86, 120, 40, 40, 120, 138, 67, 133, 149,
299
82, 171, 21, 77, 34, 41, 56, 166, 22, 32,
300
68, 69, 40, 120, 42, 70, 139, 134, 118, 118,
301
127, 71, 27, 118, 57, 167, 72, 73, 74, 118,
302
174, 75, 76, 28, 118, 118, 118, 23, 116, 118,
303
118, 166, 33, 166, 29, 5, 34, 7, 188, 22,
304
129, 24, 130, 40, 49, 192, 40, 177, 30, 181,
305
77, 191, 66, 37, 158, 118, 170, 22, 157, 39,
306
176, 194, 87, 143, 166, 47, 55, 138, 150, 133,
307
183, 184, 122, 34, 40, 122, 122, 145, 122, 146,
308
147, 46, 140, 58, 193, 144, 168, 88, 89, 90,
309
62, 84, 83, 125, 125, 125, 122, 151, 125, 142,
310
153, 125, 152, 160, 125, 164, 162, 125, 125, 125,
311
125, 125, 179, 185, 125, 125, 180, 186, 189, 190,
312
49, 58, 36, 118, 103, 178, 65, 125, 125, 163,
313
175, 0, 125, 148, 0, 0, 125, 0, 0, 0,
314
125, 0, 0, 0, 0, 0, 0, 0, 0, 30,
315
125, 28, 118, 0, 0, 0, 0, 0, 0, 0,
316
116, 116, 0, 0, 0, 116, 0, 0, 2, 0,
317
0, 116, 0, 0, 0, 116, 116, 116, 116, 118,
318
118, 116, 116, 79, 118, 0, 0, 0, 0, 0,
319
118, 118, 0, 0, 116, 118, 118, 118, 118, 118,
320
118, 118, 0, 118, 0, 94, 95, 116, 0, 118,
321
0, 0, 0, 0, 118, 118, 118, 0, 122, 118,
322
118, 51, 51, 0, 0, 51, 118, 51, 3, 0,
323
36, 122, 0, 120, 96, 97, 98, 99, 100, 101,
324
102, 103, 104, 105, 106, 118, 120, 107, 108, 109,
325
110, 111, 112, 113, 114, 115, 116, 117, 118, 0,
326
118, 118, 0, 0, 0, 118, 0, 0, 0, 0,
327
114, 118, 0, 0, 0, 0, 118, 118, 118, 0,
328
0, 118, 118, 28, 28, 28, 0, 0, 28, 0,
329
0, 0, 0, 0, 28, 0, 0, 0, 28, 28,
330
28, 28, 0, 0, 28, 28, 0, 118, 0, 0,
331
0, 0, 0, 0, 0, 68, 69, 28, 28, 0,
332
70, 0, 28, 118, 118, 0, 71, 0, 118, 0,
333
28, 72, 73, 74, 118, 0, 75, 76, 0, 118,
334
118, 118, 0, 0, 118, 118, 0, 0, 0, 77,
335
0, 0, 0, 0, 0, 0, 0, 118, 0, 0,
336
0, 0, 78, 0, 0, 0, 0, 0, 0, 0,
339
short cl_scope_check[] = { 33,
340
59, 60, 60, 37, 38, 60, 40, 60, 42, 43,
341
44, 126, 46, 47, 38, 44, 40, 123, 42, 44,
342
58, 59, 123, 80, 315, 63, 60, 61, 62, 36,
343
50, 44, 41, 62, 44, 44, 44, 58, 44, 44,
344
60, 58, 266, 292, 44, 293, 44, 44, 272, 260,
345
258, 259, 62, 62, 302, 263, 305, 91, 258, 259,
346
94, 269, 305, 263, 62, 62, 274, 275, 276, 269,
347
164, 279, 280, 305, 274, 275, 276, 301, 126, 279,
348
280, 44, 293, 44, 60, 123, 297, 125, 182, 44,
349
124, 315, 126, 41, 273, 189, 44, 305, 123, 62,
350
292, 62, 123, 305, 38, 305, 123, 62, 42, 123,
351
167, 41, 125, 305, 44, 343, 305, 125, 123, 125,
352
177, 178, 38, 123, 123, 41, 42, 308, 44, 310,
353
311, 123, 79, 305, 191, 82, 156, 294, 295, 296,
354
305, 61, 330, 258, 259, 260, 62, 305, 263, 40,
355
93, 266, 41, 40, 269, 60, 40, 272, 273, 274,
356
275, 276, 169, 123, 279, 280, 173, 303, 40, 123,
357
305, 40, 305, 123, 123, 168, 56, 292, 293, 149,
358
166, -1, 297, 86, -1, -1, 301, -1, -1, -1,
359
305, -1, -1, -1, -1, -1, -1, -1, -1, 305,
360
315, 126, 303, -1, -1, -1, -1, -1, -1, -1,
361
258, 259, -1, -1, -1, 263, -1, -1, 256, -1,
362
-1, 269, -1, -1, -1, 273, 274, 275, 276, 258,
363
259, 279, 280, 126, 263, -1, -1, -1, -1, -1,
364
269, 126, -1, -1, 292, 274, 275, 276, 258, 259,
365
279, 280, -1, 263, -1, 289, 290, 305, -1, 269,
366
-1, -1, -1, -1, 274, 275, 276, -1, 292, 279,
367
280, 330, 330, -1, -1, 330, 305, 330, 316, -1,
368
305, 305, -1, 292, 318, 319, 320, 321, 322, 323,
369
324, 325, 326, 327, 328, 305, 305, 331, 332, 333,
370
334, 335, 336, 337, 338, 339, 340, 341, 342, -1,
371
258, 259, -1, -1, -1, 263, -1, -1, -1, -1,
372
330, 269, -1, -1, -1, -1, 274, 275, 276, -1,
373
-1, 279, 280, 258, 259, 260, -1, -1, 263, -1,
374
-1, -1, -1, -1, 269, -1, -1, -1, 273, 274,
375
275, 276, -1, -1, 279, 280, -1, 305, -1, -1,
376
-1, -1, -1, -1, -1, 258, 259, 292, 293, -1,
377
263, -1, 297, 258, 259, -1, 269, -1, 263, -1,
378
305, 274, 275, 276, 269, -1, 279, 280, -1, 274,
379
275, 276, -1, -1, 279, 280, -1, -1, -1, 292,
380
-1, -1, -1, -1, -1, -1, -1, 292, -1, -1,
381
-1, -1, 305, -1, -1, -1, -1, -1, -1, -1,
388
#define YYMAXTOKEN 347
390
char *cl_scope_name[] = {
391
"end-of-file",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
392
"'!'",0,0,0,"'%'","'&'",0,"'('","')'","'*'","'+'","','",0,"'.'","'/'",0,0,0,0,0,
393
0,0,0,0,0,"':'","';'","'<'","'='","'>'","'?'",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
394
0,0,0,0,0,0,0,0,0,0,"'['",0,"']'","'^'",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
395
0,0,0,0,0,0,0,0,"'{'","'|'","'}'","'~'",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
396
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
397
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
398
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,"LE_AUTO",
399
"LE_DOUBLE","LE_INT","LE_STRUCT","LE_BREAK","LE_ELSE","LE_LONG","LE_SWITCH",
400
"LE_CASE","LE_ENUM","LE_REGISTER","LE_TYPEDEF","LE_CHAR","LE_EXTERN",
401
"LE_RETURN","LE_UNION","LE_CONST","LE_FLOAT","LE_SHORT","LE_UNSIGNED",
402
"LE_CONTINUE","LE_FOR","LE_SIGNED","LE_VOID","LE_DEFAULT","LE_GOTO","LE_SIZEOF",
403
"LE_VOLATILE","LE_DO","LE_IF","LE_STATIC","LE_WHILE","LE_NEW","LE_DELETE",
404
"LE_THIS","LE_OPERATOR","LE_CLASS","LE_PUBLIC","LE_PROTECTED","LE_PRIVATE",
405
"LE_VIRTUAL","LE_FRIEND","LE_INLINE","LE_OVERLOAD","LE_TEMPLATE","LE_TYPENAME",
406
"LE_THROW","LE_CATCH","LE_IDENTIFIER","LE_STRINGliteral","LE_FLOATINGconstant",
407
"LE_INTEGERconstant","LE_CHARACTERconstant","LE_OCTALconstant","LE_HEXconstant",
408
"LE_POUNDPOUND","LE_CComment","LE_CPPComment","LE_NAMESPACE","LE_USING",
409
"LE_TYPEDEFname","LE_ARROW","LE_ICR","LE_DECR","LE_LS","LE_RS","LE_LE","LE_GE",
410
"LE_EQ","LE_NE","LE_ANDAND","LE_OROR","LE_ELLIPSIS","LE_CLCL","LE_DOTstar",
411
"LE_ARROWstar","LE_MULTassign","LE_DIVassign","LE_MODassign","LE_PLUSassign",
412
"LE_MINUSassign","LE_LSassign","LE_RSassign","LE_ANDassign","LE_ERassign",
413
"LE_ORassign","LE_MACRO","LE_DYNAMIC_CAST","LE_STATIC_CAST","LE_CONST_CAST",
414
"LE_REINTERPRET_CAST",
416
char *cl_scope_rule[] = {
417
"$accept : translation_unit",
418
"basic_type_name : LE_INT",
419
"basic_type_name : LE_CHAR",
420
"basic_type_name : LE_SHORT",
421
"basic_type_name : LE_LONG",
422
"basic_type_name : LE_FLOAT",
423
"basic_type_name : LE_DOUBLE",
424
"basic_type_name : LE_SIGNED",
425
"basic_type_name : LE_UNSIGNED",
426
"basic_type_name : LE_VOID",
427
"translation_unit :",
428
"translation_unit : translation_unit external_decl",
429
"external_decl : class_decl",
430
"external_decl : enum_decl",
431
"external_decl : union_decl",
432
"external_decl : function_decl",
433
"external_decl : namespace_decl",
434
"external_decl : using_namespace",
435
"external_decl : scope_reducer",
436
"external_decl : scope_increaer",
437
"external_decl : question_expression",
438
"external_decl : error",
440
"template_arg : template_specifiter LE_IDENTIFIER",
441
"template_arg_list : template_arg",
442
"template_arg_list : template_arg_list ',' template_arg",
443
"template_specifiter : LE_CLASS",
444
"template_specifiter : LE_TYPENAME",
445
"opt_template_qualifier :",
446
"opt_template_qualifier : LE_TEMPLATE '<' template_arg_list '>'",
448
"derivation_list : parent_class",
449
"derivation_list : derivation_list ',' parent_class",
450
"parent_class : access_specifier LE_IDENTIFIER opt_template_specifier",
451
"opt_template_specifier :",
452
"opt_template_specifier : '<' template_parameter_list '>'",
453
"access_specifier :",
454
"access_specifier : LE_PUBLIC",
455
"access_specifier : LE_PRIVATE",
456
"access_specifier : LE_PROTECTED",
457
"template_parameter_list :",
458
"template_parameter_list : template_parameter",
459
"template_parameter_list : template_parameter_list ',' template_parameter",
460
"template_parameter : const_spec nested_scope_specifier LE_IDENTIFIER special_star_amp",
461
"template_parameter : const_spec nested_scope_specifier basic_type_name special_star_amp",
462
"template_parameter : const_spec nested_scope_specifier LE_IDENTIFIER '<' template_parameter_list '>' special_star_amp",
463
"using_namespace : LE_USING LE_NAMESPACE nested_scope_specifier LE_IDENTIFIER ';'",
464
"namespace_decl : stmnt_starter LE_NAMESPACE LE_IDENTIFIER '{'",
465
"namespace_decl : stmnt_starter LE_NAMESPACE '{'",
466
"opt_class_qualifier :",
467
"opt_class_qualifier : LE_MACRO",
468
"class_decl : stmnt_starter opt_template_qualifier class_keyword opt_class_qualifier LE_IDENTIFIER '{'",
469
"class_decl : stmnt_starter opt_template_qualifier class_keyword opt_class_qualifier LE_IDENTIFIER ':' derivation_list '{'",
470
"scope_reducer : '}'",
471
"scope_increaer : '{'",
472
"question_expression : '?'",
473
"class_keyword : LE_CLASS",
474
"class_keyword : LE_STRUCT",
475
"func_name : LE_IDENTIFIER",
476
"func_name : LE_OPERATOR any_operator",
477
"any_operator : '+'",
478
"any_operator : '='",
479
"any_operator : '*'",
480
"any_operator : '/'",
481
"any_operator : '%'",
482
"any_operator : '^'",
483
"any_operator : '&'",
484
"any_operator : '|'",
485
"any_operator : '~'",
486
"any_operator : '!'",
487
"any_operator : '<'",
488
"any_operator : '>'",
489
"any_operator : LE_LS",
490
"any_operator : LE_RS",
491
"any_operator : LE_ANDAND",
492
"any_operator : LE_OROR",
493
"any_operator : LE_ARROW",
494
"any_operator : LE_ARROWstar",
495
"any_operator : '.'",
496
"any_operator : LE_DOTstar",
497
"any_operator : LE_ICR",
498
"any_operator : LE_DECR",
499
"any_operator : LE_LE",
500
"any_operator : LE_GE",
501
"any_operator : LE_EQ",
502
"any_operator : LE_NE",
503
"any_operator : '(' ')'",
504
"any_operator : '[' ']'",
505
"any_operator : LE_NEW",
506
"any_operator : LE_DELETE",
507
"any_operator : ','",
508
"any_operator : LE_MULTassign",
509
"any_operator : LE_DIVassign",
510
"any_operator : LE_MODassign",
511
"any_operator : LE_PLUSassign",
512
"any_operator : LE_MINUSassign",
513
"any_operator : LE_LSassign",
514
"any_operator : LE_RSassign",
515
"any_operator : LE_ANDassign",
516
"any_operator : LE_ERassign",
517
"any_operator : LE_ORassign",
518
"optional_initialization_list : '{'",
519
"optional_initialization_list : ':'",
521
"declare_throw : LE_THROW '(' template_parameter_list ')'",
523
"function_decl : stmnt_starter opt_template_qualifier virtual_spec const_spec variable_decl nested_scope_specifier func_name '(' $$1 const_spec declare_throw '{'",
525
"function_decl : stmnt_starter opt_template_qualifier virtual_spec const_spec nested_scope_specifier func_name '(' $$2 optional_initialization_list",
527
"function_decl : stmnt_starter opt_template_qualifier virtual_spec const_spec nested_scope_specifier '~' func_name '(' $$3 const_spec '{'",
528
"nested_scope_specifier :",
529
"nested_scope_specifier : nested_scope_specifier scope_specifier",
530
"scope_specifier : LE_IDENTIFIER LE_CLCL",
532
"scope_specifier : LE_IDENTIFIER '<' $$4 LE_CLCL",
534
"virtual_spec : LE_VIRTUAL",
536
"const_spec : LE_CONST",
540
"star_list : star_list '*'",
541
"special_star_amp : star_list amp_item",
543
"stmnt_starter : ';'",
544
"stmnt_starter : ':'",
545
"variable_decl : nested_scope_specifier basic_type_name special_star_amp",
546
"variable_decl : nested_scope_specifier LE_IDENTIFIER special_star_amp",
547
"variable_decl : nested_scope_specifier LE_IDENTIFIER '<' template_parameter_list '>' special_star_amp",
549
"enum_decl : stmnt_starter LE_ENUM LE_IDENTIFIER '{' $$5 enum_arg_list '}'",
550
"enum_optional_assign :",
551
"enum_optional_assign : '=' LE_HEXconstant",
552
"enum_optional_assign : '=' LE_OCTALconstant",
553
"enum_optional_assign : '=' LE_INTEGERconstant",
554
"enum_argument : LE_IDENTIFIER enum_optional_assign",
556
"enum_arg_list : enum_argument",
557
"enum_arg_list : enum_arg_list ',' enum_argument",
558
"union_decl : stmnt_starter LE_UNION LE_IDENTIFIER '{'",
566
#define YYMAXDEPTH YYSTACKSIZE
569
#define YYSTACKSIZE YYMAXDEPTH
571
#define YYSTACKSIZE 500
572
#define YYMAXDEPTH 500
583
short yyss[YYSTACKSIZE];
584
YYSTYPE yyvs[YYSTACKSIZE];
585
#define yystacksize YYSTACKSIZE
586
void yyerror(char *s) {}
589
//move lexer to the next ';' line or scope opening '{'
590
//int ch = cl_scope_lex();
593
//swallow all tokens up to the first '{'
594
void consumeInitializationList(){
596
int ch = cl_scope_lex();
607
//swallow all tokens up to the first '{'
609
std::string cs = "{";
612
int ch = cl_scope_lex();
630
printf("Consumed body: [%s]\n", cs.c_str());
633
void consumeFuncArgList(){
636
int ch = cl_scope_lex();
653
* consume all token until matching closing brace is found
660
int ch = cl_scope_lex();
668
if(depth == 0) currentScope.pop_back();//reduce the scope
680
void consumeTemplateDecl()
685
int ch = cl_scope_lex();
686
//printf("ch=%d\n", ch);
705
//swallow all tokens up to the first '{'
706
void consumeNotIncluding(int ch){
708
int c = cl_scope_lex();
713
//keep the function signature
721
// return the scope name at the end of the input string
722
std::string get_scope_name( const std::string &in,
723
std::vector<std::string> &additionalNS,
724
const std::map<std::string, std::string> &ignoreTokens)
726
if( !setLexerInput(in, ignoreTokens) ){
730
//call tghe main parsing routine
732
std::string scope = getCurrentScope();
733
//do the lexer cleanup
734
cl_scope_lex_clean();
736
for(size_t i=0; i<gs_additionlNS.size(); i++){
737
additionalNS.push_back(gs_additionlNS.at(i));
739
gs_additionlNS.clear();
742
#define YYABORT goto yyabort
743
#define YYREJECT goto yyabort
744
#define YYACCEPT goto yyaccept
745
#define YYERROR goto yyerrlab
749
register int yym, yyn, yystate;
752
extern char *getenv();
754
if (yys = getenv("YYDEBUG"))
757
if (yyn >= '0' && yyn <= '9')
768
*yyssp = yystate = 0;
771
if (yyn = yydefred[yystate]) goto yyreduce;
774
if ((yychar = yylex()) < 0) yychar = 0;
779
if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
780
if (!yys) yys = "illegal-symbol";
781
printf("%sdebug: state %d, reading %d (%s)\n",
782
YYPREFIX, yystate, yychar, yys);
786
if ((yyn = yysindex[yystate]) && (yyn += yychar) >= 0 &&
787
yyn <= YYTABLESIZE && yycheck[yyn] == yychar)
791
printf("%sdebug: state %d, shifting to state %d\n",
792
YYPREFIX, yystate, yytable[yyn]);
794
if (yyssp >= yyss + yystacksize - 1)
798
*++yyssp = yystate = yytable[yyn];
801
if (yyerrflag > 0) --yyerrflag;
804
if ((yyn = yyrindex[yystate]) && (yyn += yychar) >= 0 &&
805
yyn <= YYTABLESIZE && yycheck[yyn] == yychar)
810
if (yyerrflag) goto yyinrecovery;
815
yyerror("syntax error");
827
if ((yyn = yysindex[*yyssp]) && (yyn += YYERRCODE) >= 0 &&
828
yyn <= YYTABLESIZE && yycheck[yyn] == YYERRCODE)
832
printf("%sdebug: state %d, error recovery shifting\
833
to state %d\n", YYPREFIX, *yyssp, yytable[yyn]);
835
if (yyssp >= yyss + yystacksize - 1)
839
*++yyssp = yystate = yytable[yyn];
847
printf("%sdebug: error recovery discarding state %d\n",
850
if (yyssp <= yyss) goto yyabort;
858
if (yychar == 0) goto yyabort;
863
if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
864
if (!yys) yys = "illegal-symbol";
865
printf("%sdebug: state %d, error recovery discards token %d (%s)\n",
866
YYPREFIX, yystate, yychar, yys);
875
printf("%sdebug: state %d, reducing by rule %d (%s)\n",
876
YYPREFIX, yystate, yyn, yyrule[yyn]);
879
yyval = yyvsp[1-yym];
883
{ yyval = yyvsp[0]; }
886
{ yyval = yyvsp[0]; }
889
{ yyval = yyvsp[0]; }
892
{ yyval = yyvsp[0]; }
895
{ yyval = yyvsp[0]; }
898
{ yyval = yyvsp[0]; }
901
{ yyval = yyvsp[0]; }
904
{ yyval = yyvsp[0]; }
907
{ yyval = yyvsp[0]; }
911
/* printf("CodeLite: syntax error, unexpected token '%s' found at line %d \n", cl_scope_text, cl_scope_lineno);*/
919
{yyval = yyvsp[-1] + " " + yyvsp[0];}
922
{ yyval = yyvsp[0]; }
925
{ yyval = yyvsp[-2] + " " + yyvsp[-1] + " " + yyvsp[0]; }
928
{ yyval = yyvsp[0]; }
931
{ yyval = yyvsp[0]; }
934
{ yyval = yyvsp[-3] + yyvsp[-2] + yyvsp[-1] + yyvsp[0];}
943
{yyval = yyvsp[-2] + yyvsp[-1] + yyvsp[0];}
946
{yyval = yyvsp[-2] + " " + yyvsp[-1] + yyvsp[0];}
952
{yyval = yyvsp[-2] + yyvsp[-1] + yyvsp[0];}
973
{yyval = yyvsp[-2] + yyvsp[-1] + yyvsp[0];}
977
yyval = yyvsp[-3] + yyvsp[-2] + yyvsp[-1] +yyvsp[0];
982
yyval = yyvsp[-3] + yyvsp[-2] + yyvsp[-1] +yyvsp[0];
987
yyval = yyvsp[-6] + yyvsp[-5] + yyvsp[-4] +yyvsp[-3] + yyvsp[-2] + yyvsp[-1] + yyvsp[0] + " " ;
992
/*printf("Found using namespace %s\n", $3.c_str());*/
993
gs_additionlNS.push_back(yyvsp[-2]+yyvsp[-1]);
998
currentScope.push_back(yyvsp[-1]);
1004
/*anonymouse namespace*/
1017
/*increase the scope level*/
1018
currentScope.push_back(yyvsp[-1]);
1024
/*increase the scope level*/
1025
currentScope.push_back(yyvsp[-3]);
1031
if(currentScope.empty())
1034
/*printf("CodeLite: fatal error - cant go beyond global scope!\n");*/
1038
currentScope.pop_back();
1045
/*increase random scope*/
1052
consumeNotIncluding(';');
1065
{yyval = yyvsp[-1];}
1071
{consumeInitializationList() /*eat everything including the open brace*/;}
1077
{yyval = yyvsp[-1];}
1080
{consumeFuncArgList();}
1084
/*trim down trailing '::' from scope name*/
1085
if(yyvsp[-6].find_last_not_of(":") != std::string::npos){
1086
yyvsp[-6].erase(yyvsp[-6].find_last_not_of(":")+1);
1088
currentScope.push_back(yyvsp[-6]);
1093
{consumeFuncArgList();}
1098
/*trim down trailing '::' from scope name*/
1099
if(yyvsp[-4].find_last_not_of(":") != std::string::npos){
1100
yyvsp[-4].erase(yyvsp[-4].find_last_not_of(":")+1);
1102
currentScope.push_back(yyvsp[-4]);
1107
{consumeFuncArgList();}
1112
/*trim down trailing '::' from scope name*/
1113
if(yyvsp[-6].find_last_not_of(":") != std::string::npos){
1114
yyvsp[-6].erase(yyvsp[-6].find_last_not_of(":")+1);
1116
currentScope.push_back(yyvsp[-6]);
1124
{ yyval = yyvsp[-1] + yyvsp[0];}
1127
{yyval = yyvsp[-1]+ yyvsp[0];}
1130
{consumeTemplateDecl();}
1133
{yyval = yyvsp[-3] + yyvsp[0];}
1139
{ yyval = yyvsp[0]; }
1145
{ yyval = yyvsp[0]; }
1151
{ yyval = yyvsp[0]; }
1157
{yyval = yyvsp[-1] + yyvsp[0];}
1160
{ yyval = yyvsp[-1] + yyvsp[0]; }
1172
{yyval = yyvsp[-2] + yyvsp[-1] + yyvsp[0] ;}
1175
{yyval = yyvsp[-2] + yyvsp[-1] + yyvsp[0] ;}
1178
{yyval = yyvsp[-5] + yyvsp[-4] + yyvsp[-3] + yyvsp[-2] + yyvsp[-1] + yyvsp[0] ;}
1181
{currentScope.push_back(yyvsp[-1]); printScopeName();}
1185
currentScope.pop_back();/*reduce the scope*/
1187
/*printf("found enum: %s, args are: %s\n", $2.c_str(), $5.c_str());*/
1194
{yyval = yyvsp[-1] + yyvsp[0];}
1197
{yyval = yyvsp[-1] + yyvsp[0];}
1200
{yyval = yyvsp[-1] + yyvsp[0];}
1203
{yyval = yyvsp[-1] + yyvsp[0];}
1212
{yyval = yyvsp[-2] + yyvsp[-1] + yyvsp[0];}
1216
currentScope.push_back(yyvsp[-1]);
1227
if (yystate == 0 && yym == 0)
1231
printf("%sdebug: after reduction, shifting from state 0 to\
1232
state %d\n", YYPREFIX, YYFINAL);
1239
if ((yychar = yylex()) < 0) yychar = 0;
1244
if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
1245
if (!yys) yys = "illegal-symbol";
1246
printf("%sdebug: state %d, reading %d (%s)\n",
1247
YYPREFIX, YYFINAL, yychar, yys);
1251
if (yychar == 0) goto yyaccept;
1254
if ((yyn = yygindex[yym]) && (yyn += yystate) >= 0 &&
1255
yyn <= YYTABLESIZE && yycheck[yyn] == yystate)
1256
yystate = yytable[yyn];
1258
yystate = yydgoto[yym];
1261
printf("%sdebug: after reduction, shifting from state %d \
1262
to state %d\n", YYPREFIX, *yyssp, yystate);
1264
if (yyssp >= yyss + yystacksize - 1)
1272
yyerror("yacc stack overflow");