Debian Codegraph @

CodeLite/scope_parser.cpp

raw
1 #ifndef lint
2 static char yysccsid[] = "@(#)yaccpar 1.9 (Berkeley) 02/21/93";
3 #endif
4 #define YYBYACC 1
5 #define YYMAJOR 1
6 #define YYMINOR 9
7 #define yyclearin (yychar=(-1))
8 #define yyerrok (yyerrflag=0)
9 #define YYRECOVERING (yyerrflag!=0)
10 #define yyparse cl_scope_parse
11 #define yylex cl_scope_lex
12 #define yyerror cl_scope_error
13 #define yychar cl_scope_char
14 #define yyval cl_scope_val
15 #define yylval cl_scope_lval
16 #define yydebug cl_scope_debug
17 #define yynerrs cl_scope_nerrs
18 #define yyerrflag cl_scope_errflag
19 #define yyss cl_scope_ss
20 #define yyssp cl_scope_ssp
21 #define yyvs cl_scope_vs
22 #define yyvsp cl_scope_vsp
23 #define yylhs cl_scope_lhs
24 #define yylen cl_scope_len
25 #define yydefred cl_scope_defred
26 #define yydgoto cl_scope_dgoto
27 #define yysindex cl_scope_sindex
28 #define yyrindex cl_scope_rindex
29 #define yygindex cl_scope_gindex
30 #define yytable cl_scope_table
31 #define yycheck cl_scope_check
32 #define yyname cl_scope_name
33 #define yyrule cl_scope_rule
34 #define YYPREFIX "cl_scope_"
35 /* Copyright Eran Ifrah(c)*/
36 /*************** Includes and Defines *****************************/
37 #include <string>
38 #include <vector>
39 #include <stdio.h>
40 #include <map>
41 #include <string.h>
42
43 #define YYDEBUG_LEXER_TEXT (cl_scope_lval)
44 #define YYSTYPE std::string
45 #define YYDEBUG 0 /* get the pretty debugging code to compile*/
46 static std::string readInitializer(const char* delim);
47 static void readClassName();
48
49 static std::string className;
50
51 static std::string templateInitList;
52 int cl_scope_parse();
53 void cl_scope_error(char *string);
54 void syncParser();
55
56 static std::vector<std::string> gs_additionlNS;
57
58 /*---------------------------------------------*/
59 /* externs defined in the lexer*/
60 /*---------------------------------------------*/
61 extern char *cl_scope_text;
62 extern int cl_scope_lex();
63 extern bool setLexerInput(const std::string &in, const std::map<std::string, std::string> &ignoreTokens);
64 extern int cl_scope_lineno;
65 extern std::vector<std::string> currentScope;
66 extern void printScopeName(); /*print the current scope name*/
67 extern void increaseScope(); /*increase scope with anonymouse value*/
68 extern std::string getCurrentScope();
69 extern void cl_scope_lex_clean();
70 extern void cl_scope_less(int count);
71
72 /*************** Standard ytab.c continues here *********************/
73 #define LE_AUTO 257
74 #define LE_DOUBLE 258
75 #define LE_INT 259
76 #define LE_STRUCT 260
77 #define LE_BREAK 261
78 #define LE_ELSE 262
79 #define LE_LONG 263
80 #define LE_SWITCH 264
81 #define LE_CASE 265
82 #define LE_ENUM 266
83 #define LE_REGISTER 267
84 #define LE_TYPEDEF 268
85 #define LE_CHAR 269
86 #define LE_EXTERN 270
87 #define LE_RETURN 271
88 #define LE_UNION 272
89 #define LE_CONST 273
90 #define LE_FLOAT 274
91 #define LE_SHORT 275
92 #define LE_UNSIGNED 276
93 #define LE_BOOL 277
94 #define LE_CONTINUE 278
95 #define LE_FOR 279
96 #define LE_SIGNED 280
97 #define LE_VOID 281
98 #define LE_DEFAULT 282
99 #define LE_GOTO 283
100 #define LE_SIZEOF 284
101 #define LE_VOLATILE 285
102 #define LE_DO 286
103 #define LE_IF 287
104 #define LE_STATIC 288
105 #define LE_WHILE 289
106 #define LE_NEW 290
107 #define LE_DELETE 291
108 #define LE_THIS 292
109 #define LE_OPERATOR 293
110 #define LE_CLASS 294
111 #define LE_PUBLIC 295
112 #define LE_PROTECTED 296
113 #define LE_PRIVATE 297
114 #define LE_VIRTUAL 298
115 #define LE_FRIEND 299
116 #define LE_INLINE 300
117 #define LE_OVERLOAD 301
118 #define LE_OVERRIDE 302
119 #define LE_FINAL 303
120 #define LE_TEMPLATE 304
121 #define LE_TYPENAME 305
122 #define LE_THROW 306
123 #define LE_CATCH 307
124 #define LE_IDENTIFIER 308
125 #define LE_STRINGliteral 309
126 #define LE_FLOATINGconstant 310
127 #define LE_INTEGERconstant 311
128 #define LE_CHARACTERconstant 312
129 #define LE_OCTALconstant 313
130 #define LE_HEXconstant 314
131 #define LE_POUNDPOUND 315
132 #define LE_CComment 316
133 #define LE_CPPComment 317
134 #define LE_NAMESPACE 318
135 #define LE_USING 319
136 #define LE_TYPEDEFname 320
137 #define LE_ARROW 321
138 #define LE_ICR 322
139 #define LE_DECR 323
140 #define LE_LS 324
141 #define LE_RS 325
142 #define LE_LE 326
143 #define LE_GE 327
144 #define LE_EQ 328
145 #define LE_NE 329
146 #define LE_ANDAND 330
147 #define LE_OROR 331
148 #define LE_ELLIPSIS 332
149 #define LE_CLCL 333
150 #define LE_DOTstar 334
151 #define LE_ARROWstar 335
152 #define LE_MULTassign 336
153 #define LE_DIVassign 337
154 #define LE_MODassign 338
155 #define LE_PLUSassign 339
156 #define LE_MINUSassign 340
157 #define LE_LSassign 341
158 #define LE_RSassign 342
159 #define LE_ANDassign 343
160 #define LE_ERassign 344
161 #define LE_ORassign 345
162 #define LE_MACRO 346
163 #define LE_DYNAMIC_CAST 347
164 #define LE_STATIC_CAST 348
165 #define LE_CONST_CAST 349
166 #define LE_REINTERPRET_CAST 350
167 #define LE_SIZE_T 351
168 #define LE_TIME_T 352
169 #define LE_DECLSPEC 353
170 #define LE_DLLIMPORT 354
171 #define LE_DLLIEXPORT 355
172 #define YYERRCODE 256
173 short cl_scope_lhs[] = { -1,
174 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
175 1, 2, 2, 2, 2, 2, 0, 0, 3, 3,
176 3, 3, 3, 3, 3, 3, 3, 3, 3, 14,
177 14, 14, 16, 16, 15, 15, 17, 17, 18, 18,
178 18, 19, 19, 19, 10, 9, 9, 4, 11, 12,
179 13, 24, 24, 25, 25, 26, 26, 26, 26, 26,
180 26, 26, 26, 26, 26, 26, 26, 26, 26, 26,
181 26, 26, 26, 26, 26, 26, 26, 26, 26, 26,
182 26, 26, 26, 26, 26, 26, 26, 26, 26, 26,
183 26, 26, 26, 26, 26, 26, 27, 27, 28, 28,
184 5, 31, 8, 32, 8, 33, 8, 21, 21, 34,
185 35, 34, 29, 29, 20, 20, 36, 36, 37, 37,
186 22, 23, 23, 23, 30, 30, 30, 39, 6, 40,
187 40, 40, 40, 41, 38, 38, 38, 7,
188 };
189 short cl_scope_len[] = { 2,
190 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
191 1, 2, 2, 2, 2, 1, 0, 2, 1, 1,
192 1, 1, 1, 1, 1, 1, 1, 1, 1, 0,
193 2, 3, 1, 3, 1, 1, 0, 4, 0, 1,
194 3, 4, 4, 7, 5, 5, 3, 3, 1, 1,
195 1, 1, 1, 1, 2, 1, 1, 1, 1, 1,
196 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
197 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
198 1, 2, 2, 1, 1, 1, 1, 1, 1, 1,
199 1, 1, 1, 1, 1, 1, 1, 1, 0, 4,
200 2, 0, 12, 0, 9, 0, 11, 0, 2, 2,
201 0, 4, 0, 1, 0, 1, 0, 1, 0, 2,
202 2, 0, 1, 1, 3, 3, 6, 0, 7, 0,
203 2, 2, 2, 2, 0, 1, 3, 4,
204 };
205 short cl_scope_defred[] = { 17,
206 0, 29, 0, 0, 123, 50, 49, 51, 124, 18,
207 19, 20, 21, 22, 23, 24, 25, 26, 27, 28,
208 0, 101, 108, 0, 0, 0, 0, 0, 0, 0,
209 0, 0, 47, 0, 53, 52, 114, 48, 0, 0,
210 109, 128, 138, 35, 36, 33, 0, 0, 0, 116,
211 108, 110, 111, 45, 0, 0, 0, 38, 46, 0,
212 108, 0, 0, 0, 136, 32, 34, 6, 1, 0,
213 2, 5, 3, 0, 10, 0, 9, 0, 0, 11,
214 0, 16, 119, 0, 0, 112, 0, 134, 0, 129,
215 15, 14, 4, 8, 7, 12, 13, 84, 85, 72,
216 76, 77, 68, 69, 78, 79, 80, 81, 70, 71,
217 75, 73, 87, 88, 89, 90, 91, 92, 93, 94,
218 95, 96, 57, 86, 66, 67, 56, 58, 59, 60,
219 61, 62, 63, 64, 65, 74, 0, 0, 55, 0,
220 126, 0, 54, 0, 125, 104, 0, 0, 133, 132,
221 131, 137, 82, 83, 0, 40, 108, 120, 118, 121,
222 106, 0, 102, 0, 119, 0, 0, 97, 98, 105,
223 0, 41, 127, 0, 119, 0, 0, 0, 42, 43,
224 107, 0, 0, 0, 0, 103, 119, 0, 44, 100,
225 };
226 short cl_scope_dgoto[] = { 1,
227 82, 83, 10, 11, 12, 13, 14, 15, 16, 17,
228 18, 19, 20, 46, 47, 48, 28, 155, 156, 157,
229 29, 141, 21, 38, 84, 139, 170, 183, 39, 61,
230 171, 162, 167, 41, 62, 160, 142, 64, 55, 88,
231 65,
232 };
233 short cl_scope_sindex[] = { 0,
234 -3, 0, -269, -259, 0, 0, 0, 0, 0, 0,
235 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
236 -241, 0, 0, -239, -236, 28, -25, -211, -202, -2,
237 5, -268, 0, -175, 0, 0, 0, 0, -144, -58,
238 0, 0, 0, 0, 0, 0, -172, -12, -52, 0,
239 0, 0, 0, 0, -171, 77, -268, 0, 0, 129,
240 0, -194, 79, -23, 0, 0, 0, 0, 0, -163,
241 0, 0, 0, -150, 0, -150, 0, -33, -48, 0,
242 -204, 0, 0, 101, -201, 0, -179, 0, -171, 0,
243 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
244 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
245 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
246 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
247 0, 0, 0, 0, 0, 0, 102, 49, 0, -144,
248 0, 74, 0, 105, 0, 0, -19, 111, 0, 0,
249 0, 0, 0, 0, -11, 0, 0, 0, 0, 0,
250 0, -28, 0, -144, 0, 158, -144, 0, 0, 0,
251 -144, 0, 0, -18, 0, 21, -152, -144, 0, 0,
252 0, 116, 34, -10, -144, 0, 0, 4, 0, 0,
253 };
254 short cl_scope_rindex[] = { 0,
255 -111, 0, 0, 0, 0, 0, 0, 0, 0, 0,
256 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
257 78, 0, 0, 0, 0, 0, -149, 104, 0, 0,
258 0, -8, 0, 0, 0, 0, 0, 0, 193, 0,
259 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
260 0, 0, 0, 0, -22, 23, -8, 0, 0, 0,
261 0, 0, -20, 0, 0, 0, 0, 0, 0, 24,
262 0, 0, 0, 32, 0, 37, 0, 0, 42, 0,
263 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
264 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
265 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
266 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
267 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
268 0, 0, 0, 0, 0, 0, 0, 0, 0, -9,
269 0, -24, 0, 0, 0, 0, 120, 0, 0, 0,
270 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
271 0, 0, 0, 167, 0, 0, 44, 0, 0, 0,
272 -107, 0, 0, 2, 0, 0, 45, -9, 0, 0,
273 0, 0, 0, 0, -38, 0, 0, 0, 0, 0,
274 };
275 short cl_scope_gindex[] = { 0,
276 41, 6, 0, 0, 0, 0, 0, 0, 0, 0,
277 0, 0, 0, 114, 0, 0, 0, -88, 9, -21,
278 -4, -64, 0, 0, 33, 0, 0, 0, 0, 0,
279 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
280 85,
281 };
282 #define YYTABLESIZE 544
283 short cl_scope_table[] = { 135,
284 54, 53, 39, 130, 132, 39, 137, 53, 128, 127,
285 124, 140, 136, 129, 122, 115, 117, 51, 145, 117,
286 89, 135, 34, 130, 24, 44, 125, 123, 126, 169,
287 25, 57, 164, 164, 39, 30, 45, 117, 22, 119,
288 53, 178, 119, 119, 190, 119, 60, 164, 35, 58,
289 165, 187, 39, 30, 9, 5, 85, 138, 23, 8,
290 131, 4, 26, 119, 4, 4, 31, 4, 30, 8,
291 59, 31, 8, 8, 7, 8, 27, 7, 7, 119,
292 7, 54, 36, 119, 31, 4, 37, 32, 78, 184,
293 133, 78, 134, 8, 168, 91, 188, 33, 7, 92,
294 173, 90, 135, 143, 130, 40, 147, 68, 69, 179,
295 180, 159, 93, 144, 96, 158, 97, 148, 71, 6,
296 42, 7, 189, 72, 73, 94, 75, 43, 50, 95,
297 77, 149, 49, 150, 151, 56, 63, 66, 86, 87,
298 146, 154, 153, 181, 161, 176, 122, 122, 122, 177,
299 163, 122, 166, 182, 122, 185, 186, 122, 108, 54,
300 122, 122, 122, 122, 122, 122, 115, 99, 122, 122,
301 67, 175, 172, 152, 0, 0, 0, 0, 0, 0,
302 0, 122, 122, 0, 0, 0, 122, 0, 0, 0,
303 0, 0, 122, 0, 0, 0, 122, 0, 115, 0,
304 80, 0, 0, 37, 0, 0, 122, 0, 0, 0,
305 0, 0, 0, 0, 0, 0, 0, 0, 0, 115,
306 115, 0, 0, 0, 115, 0, 0, 0, 0, 113,
307 115, 0, 0, 0, 0, 115, 115, 115, 115, 122,
308 0, 115, 115, 0, 0, 0, 0, 0, 115, 115,
309 0, 0, 2, 115, 81, 0, 98, 99, 0, 115,
310 0, 3, 0, 0, 115, 115, 115, 115, 117, 115,
311 115, 115, 0, 0, 52, 0, 0, 0, 0, 0,
312 52, 0, 0, 117, 52, 0, 0, 100, 101, 102,
313 103, 104, 105, 106, 107, 108, 109, 110, 115, 0,
314 111, 112, 113, 114, 115, 116, 117, 118, 119, 120,
315 121, 122, 115, 52, 52, 4, 4, 0, 115, 0,
316 0, 0, 0, 111, 8, 0, 0, 0, 0, 7,
317 0, 4, 0, 0, 119, 37, 37, 37, 0, 8,
318 37, 115, 0, 0, 7, 0, 37, 0, 0, 119,
319 37, 37, 37, 37, 37, 0, 0, 37, 37, 0,
320 0, 113, 113, 0, 0, 0, 113, 0, 0, 0,
321 37, 37, 113, 0, 0, 37, 113, 113, 113, 113,
322 113, 0, 0, 113, 113, 37, 68, 69, 0, 0,
323 0, 70, 0, 0, 0, 0, 113, 71, 0, 0,
324 0, 0, 72, 73, 74, 75, 0, 0, 76, 77,
325 0, 113, 0, 0, 0, 68, 69, 0, 0, 0,
326 70, 78, 0, 0, 115, 115, 71, 0, 37, 115,
327 0, 72, 73, 74, 75, 115, 79, 76, 77, 0,
328 115, 115, 115, 115, 0, 0, 115, 115, 0, 0,
329 115, 115, 0, 0, 113, 115, 0, 0, 0, 0,
330 0, 115, 0, 0, 0, 174, 115, 115, 115, 115,
331 0, 0, 115, 115, 115, 0, 0, 0, 0, 80,
332 0, 0, 0, 0, 0, 115, 0, 0, 0, 0,
333 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
334 115, 0, 0, 0, 0, 0, 0, 0, 80, 0,
335 0, 0, 0, 0, 0, 0, 0, 115, 0, 0,
336 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
337 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
338 0, 0, 0, 115,
339 };
340 short cl_scope_check[] = { 33,
341 59, 60, 41, 37, 38, 44, 40, 60, 42, 43,
342 44, 60, 46, 47, 126, 123, 41, 39, 83, 44,
343 44, 44, 27, 44, 266, 294, 60, 61, 62, 58,
344 272, 44, 44, 44, 44, 44, 305, 62, 308, 38,
345 60, 60, 41, 42, 41, 44, 51, 44, 260, 62,
346 62, 62, 62, 62, 58, 59, 61, 91, 318, 63,
347 94, 38, 304, 62, 41, 42, 44, 44, 308, 38,
348 123, 308, 41, 42, 38, 44, 318, 41, 42, 38,
349 44, 40, 294, 42, 62, 62, 298, 60, 293, 178,
350 124, 293, 126, 62, 123, 259, 185, 123, 62, 263,
351 165, 125, 125, 308, 125, 308, 308, 258, 259, 174,
352 175, 38, 263, 81, 74, 42, 76, 85, 269, 123,
353 123, 125, 187, 274, 275, 276, 277, 123, 273, 280,
354 281, 311, 308, 313, 314, 308, 308, 61, 333, 61,
355 40, 93, 41, 123, 40, 167, 258, 259, 260, 171,
356 40, 263, 157, 306, 266, 40, 123, 269, 308, 40,
357 272, 273, 274, 275, 276, 277, 123, 123, 280, 281,
358 57, 166, 164, 89, -1, -1, -1, -1, -1, -1,
359 -1, 293, 294, -1, -1, -1, 298, -1, -1, -1,
360 -1, -1, 304, -1, -1, -1, 308, -1, 306, -1,
361 351, -1, -1, 126, -1, -1, 318, -1, -1, -1,
362 -1, -1, -1, -1, -1, -1, -1, -1, -1, 258,
363 259, -1, -1, -1, 263, -1, -1, -1, -1, 126,
364 269, -1, -1, -1, -1, 274, 275, 276, 277, 351,
365 -1, 280, 281, -1, -1, -1, -1, -1, 258, 259,
366 -1, -1, 256, 263, 126, -1, 290, 291, -1, 269,
367 -1, 265, -1, -1, 274, 275, 276, 277, 293, 308,
368 280, 281, -1, -1, 333, -1, -1, -1, -1, -1,
369 333, -1, -1, 308, 333, -1, -1, 321, 322, 323,
370 324, 325, 326, 327, 328, 329, 330, 331, 308, -1,
371 334, 335, 336, 337, 338, 339, 340, 341, 342, 343,
372 344, 345, 351, 333, 333, 319, 293, -1, 126, -1,
373 -1, -1, -1, 333, 293, -1, -1, -1, -1, 293,
374 -1, 308, -1, -1, 293, 258, 259, 260, -1, 308,
375 263, 351, -1, -1, 308, -1, 269, -1, -1, 308,
376 273, 274, 275, 276, 277, -1, -1, 280, 281, -1,
377 -1, 258, 259, -1, -1, -1, 263, -1, -1, -1,
378 293, 294, 269, -1, -1, 298, 273, 274, 275, 276,
379 277, -1, -1, 280, 281, 308, 258, 259, -1, -1,
380 -1, 263, -1, -1, -1, -1, 293, 269, -1, -1,
381 -1, -1, 274, 275, 276, 277, -1, -1, 280, 281,
382 -1, 308, -1, -1, -1, 258, 259, -1, -1, -1,
383 263, 293, -1, -1, 258, 259, 269, -1, 351, 263,
384 -1, 274, 275, 276, 277, 269, 308, 280, 281, -1,
385 274, 275, 276, 277, -1, -1, 280, 281, -1, -1,
386 258, 259, -1, -1, 351, 263, -1, -1, -1, -1,
387 -1, 269, -1, -1, -1, 308, 274, 275, 276, 277,
388 -1, -1, 280, 281, 308, -1, -1, -1, -1, 351,
389 -1, -1, -1, -1, -1, 293, -1, -1, -1, -1,
390 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
391 308, -1, -1, -1, -1, -1, -1, -1, 351, -1,
392 -1, -1, -1, -1, -1, -1, -1, 351, -1, -1,
393 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
394 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
395 -1, -1, -1, 351,
396 };
397 #define YYFINAL 1
398 #ifndef YYDEBUG
399 #define YYDEBUG 1
400 #endif
401 #define YYMAXTOKEN 355
402 #if YYDEBUG
403 char *cl_scope_name[] = {
404 "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,
405 "'!'",0,0,0,"'%'","'&'",0,"'('","')'","'*'","'+'","','",0,"'.'","'/'",0,0,0,0,0,
406 0,0,0,0,0,"':'","';'","'<'","'='","'>'","'?'",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
407 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,
408 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,
409 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,
410 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,
411 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",
412 "LE_DOUBLE","LE_INT","LE_STRUCT","LE_BREAK","LE_ELSE","LE_LONG","LE_SWITCH",
413 "LE_CASE","LE_ENUM","LE_REGISTER","LE_TYPEDEF","LE_CHAR","LE_EXTERN",
414 "LE_RETURN","LE_UNION","LE_CONST","LE_FLOAT","LE_SHORT","LE_UNSIGNED","LE_BOOL",
415 "LE_CONTINUE","LE_FOR","LE_SIGNED","LE_VOID","LE_DEFAULT","LE_GOTO","LE_SIZEOF",
416 "LE_VOLATILE","LE_DO","LE_IF","LE_STATIC","LE_WHILE","LE_NEW","LE_DELETE",
417 "LE_THIS","LE_OPERATOR","LE_CLASS","LE_PUBLIC","LE_PROTECTED","LE_PRIVATE",
418 "LE_VIRTUAL","LE_FRIEND","LE_INLINE","LE_OVERLOAD","LE_OVERRIDE","LE_FINAL",
419 "LE_TEMPLATE","LE_TYPENAME","LE_THROW","LE_CATCH","LE_IDENTIFIER",
420 "LE_STRINGliteral","LE_FLOATINGconstant","LE_INTEGERconstant",
421 "LE_CHARACTERconstant","LE_OCTALconstant","LE_HEXconstant","LE_POUNDPOUND",
422 "LE_CComment","LE_CPPComment","LE_NAMESPACE","LE_USING","LE_TYPEDEFname",
423 "LE_ARROW","LE_ICR","LE_DECR","LE_LS","LE_RS","LE_LE","LE_GE","LE_EQ","LE_NE",
424 "LE_ANDAND","LE_OROR","LE_ELLIPSIS","LE_CLCL","LE_DOTstar","LE_ARROWstar",
425 "LE_MULTassign","LE_DIVassign","LE_MODassign","LE_PLUSassign","LE_MINUSassign",
426 "LE_LSassign","LE_RSassign","LE_ANDassign","LE_ERassign","LE_ORassign",
427 "LE_MACRO","LE_DYNAMIC_CAST","LE_STATIC_CAST","LE_CONST_CAST",
428 "LE_REINTERPRET_CAST","LE_SIZE_T","LE_TIME_T","LE_DECLSPEC","LE_DLLIMPORT",
429 "LE_DLLIEXPORT",
430 };
431 char *cl_scope_rule[] = {
432 "$accept : translation_unit",
433 "basic_type_name_inter : LE_INT",
434 "basic_type_name_inter : LE_CHAR",
435 "basic_type_name_inter : LE_SHORT",
436 "basic_type_name_inter : LE_LONG",
437 "basic_type_name_inter : LE_FLOAT",
438 "basic_type_name_inter : LE_DOUBLE",
439 "basic_type_name_inter : LE_SIGNED",
440 "basic_type_name_inter : LE_UNSIGNED",
441 "basic_type_name_inter : LE_VOID",
442 "basic_type_name_inter : LE_BOOL",
443 "basic_type_name_inter : LE_SIZE_T",
444 "basic_type_name : LE_UNSIGNED basic_type_name_inter",
445 "basic_type_name : LE_SIGNED basic_type_name_inter",
446 "basic_type_name : LE_LONG LE_LONG",
447 "basic_type_name : LE_LONG LE_INT",
448 "basic_type_name : basic_type_name_inter",
449 "translation_unit :",
450 "translation_unit : translation_unit external_decl",
451 "external_decl : class_decl",
452 "external_decl : dummy_case",
453 "external_decl : enum_decl",
454 "external_decl : union_decl",
455 "external_decl : function_decl",
456 "external_decl : namespace_decl",
457 "external_decl : using_namespace",
458 "external_decl : scope_reducer",
459 "external_decl : scope_increaer",
460 "external_decl : question_expression",
461 "external_decl : error",
462 "template_arg :",
463 "template_arg : template_specifiter LE_IDENTIFIER",
464 "template_arg : template_specifiter LE_IDENTIFIER '='",
465 "template_arg_list : template_arg",
466 "template_arg_list : template_arg_list ',' template_arg",
467 "template_specifiter : LE_CLASS",
468 "template_specifiter : LE_TYPENAME",
469 "opt_template_qualifier :",
470 "opt_template_qualifier : LE_TEMPLATE '<' template_arg_list '>'",
471 "template_parameter_list :",
472 "template_parameter_list : template_parameter",
473 "template_parameter_list : template_parameter_list ',' template_parameter",
474 "template_parameter : const_spec nested_scope_specifier LE_IDENTIFIER special_star_amp",
475 "template_parameter : const_spec nested_scope_specifier basic_type_name special_star_amp",
476 "template_parameter : const_spec nested_scope_specifier LE_IDENTIFIER '<' template_parameter_list '>' special_star_amp",
477 "using_namespace : LE_USING LE_NAMESPACE nested_scope_specifier LE_IDENTIFIER ';'",
478 "namespace_decl : stmnt_starter LE_NAMESPACE nested_scope_specifier LE_IDENTIFIER '{'",
479 "namespace_decl : stmnt_starter LE_NAMESPACE '{'",
480 "class_decl : stmnt_starter opt_template_qualifier class_keyword",
481 "scope_reducer : '}'",
482 "scope_increaer : '{'",
483 "question_expression : '?'",
484 "class_keyword : LE_CLASS",
485 "class_keyword : LE_STRUCT",
486 "func_name : LE_IDENTIFIER",
487 "func_name : LE_OPERATOR any_operator",
488 "any_operator : '+'",
489 "any_operator : '='",
490 "any_operator : '*'",
491 "any_operator : '/'",
492 "any_operator : '%'",
493 "any_operator : '^'",
494 "any_operator : '&'",
495 "any_operator : '|'",
496 "any_operator : '~'",
497 "any_operator : '!'",
498 "any_operator : '<'",
499 "any_operator : '>'",
500 "any_operator : LE_LS",
501 "any_operator : LE_RS",
502 "any_operator : LE_ANDAND",
503 "any_operator : LE_OROR",
504 "any_operator : LE_ARROW",
505 "any_operator : LE_ARROWstar",
506 "any_operator : '.'",
507 "any_operator : LE_DOTstar",
508 "any_operator : LE_ICR",
509 "any_operator : LE_DECR",
510 "any_operator : LE_LE",
511 "any_operator : LE_GE",
512 "any_operator : LE_EQ",
513 "any_operator : LE_NE",
514 "any_operator : '(' ')'",
515 "any_operator : '[' ']'",
516 "any_operator : LE_NEW",
517 "any_operator : LE_DELETE",
518 "any_operator : ','",
519 "any_operator : LE_MULTassign",
520 "any_operator : LE_DIVassign",
521 "any_operator : LE_MODassign",
522 "any_operator : LE_PLUSassign",
523 "any_operator : LE_MINUSassign",
524 "any_operator : LE_LSassign",
525 "any_operator : LE_RSassign",
526 "any_operator : LE_ANDassign",
527 "any_operator : LE_ERassign",
528 "any_operator : LE_ORassign",
529 "optional_initialization_list : '{'",
530 "optional_initialization_list : ':'",
531 "declare_throw :",
532 "declare_throw : LE_THROW '(' template_parameter_list ')'",
533 "dummy_case : LE_CASE LE_IDENTIFIER",
534 "$$1 :",
535 "function_decl : stmnt_starter opt_template_qualifier virtual_spec const_spec variable_decl nested_scope_specifier func_name '(' $$1 const_spec declare_throw '{'",
536 "$$2 :",
537 "function_decl : stmnt_starter opt_template_qualifier virtual_spec const_spec nested_scope_specifier func_name '(' $$2 optional_initialization_list",
538 "$$3 :",
539 "function_decl : stmnt_starter opt_template_qualifier virtual_spec const_spec nested_scope_specifier '~' func_name '(' $$3 const_spec '{'",
540 "nested_scope_specifier :",
541 "nested_scope_specifier : nested_scope_specifier scope_specifier",
542 "scope_specifier : LE_IDENTIFIER LE_CLCL",
543 "$$4 :",
544 "scope_specifier : LE_IDENTIFIER '<' $$4 LE_CLCL",
545 "virtual_spec :",
546 "virtual_spec : LE_VIRTUAL",
547 "const_spec :",
548 "const_spec : LE_CONST",
549 "amp_item :",
550 "amp_item : '&'",
551 "star_list :",
552 "star_list : star_list '*'",
553 "special_star_amp : star_list amp_item",
554 "stmnt_starter :",
555 "stmnt_starter : ';'",
556 "stmnt_starter : ':'",
557 "variable_decl : nested_scope_specifier basic_type_name special_star_amp",
558 "variable_decl : nested_scope_specifier LE_IDENTIFIER special_star_amp",
559 "variable_decl : nested_scope_specifier LE_IDENTIFIER '<' template_parameter_list '>' special_star_amp",
560 "$$5 :",
561 "enum_decl : stmnt_starter LE_ENUM LE_IDENTIFIER '{' $$5 enum_arg_list '}'",
562 "enum_optional_assign :",
563 "enum_optional_assign : '=' LE_HEXconstant",
564 "enum_optional_assign : '=' LE_OCTALconstant",
565 "enum_optional_assign : '=' LE_INTEGERconstant",
566 "enum_argument : LE_IDENTIFIER enum_optional_assign",
567 "enum_arg_list :",
568 "enum_arg_list : enum_argument",
569 "enum_arg_list : enum_arg_list ',' enum_argument",
570 "union_decl : stmnt_starter LE_UNION LE_IDENTIFIER '{'",
571 };
572 #endif
573 #ifndef YYSTYPE
574 typedef int YYSTYPE;
575 #endif
576 #ifdef YYSTACKSIZE
577 #undef YYMAXDEPTH
578 #define YYMAXDEPTH YYSTACKSIZE
579 #else
580 #ifdef YYMAXDEPTH
581 #define YYSTACKSIZE YYMAXDEPTH
582 #else
583 #define YYSTACKSIZE 500
584 #define YYMAXDEPTH 500
585 #endif
586 #endif
587 int yydebug;
588 int yynerrs;
589 int yyerrflag;
590 int yychar;
591 short *yyssp;
592 YYSTYPE *yyvsp;
593 YYSTYPE yyval;
594 YYSTYPE yylval;
595 short yyss[YYSTACKSIZE];
596 YYSTYPE yyvs[YYSTACKSIZE];
597 #define yystacksize YYSTACKSIZE
598 void yyerror(char *s) {}
599
600 void syncParser(){
601 //move lexer to the next ';' line or scope opening '{'
602 //int ch = cl_scope_lex();
603 }
604
605 //swallow all tokens up to the first '{'
606 void consumeInitializationList(){
607 while( true ){
608 int ch = cl_scope_lex();
609 if(ch == 0){
610 break;
611 }
612
613 if(ch == '{'){
614 break;
615 }
616 }
617 }
618
619 void consumeFuncArgList(){
620 int depth = 1;
621 while(depth > 0){
622 int ch = cl_scope_lex();
623 if(ch == 0){
624 break;
625 }
626
627 if(ch == ')'){
628 depth--;
629 continue;
630 }
631 else if(ch == '('){
632 depth ++ ;
633 continue;
634 }
635 }
636 }
637
638 void readClassName()
639 {
640 #define NEXT_TOK() c = cl_scope_lex(); if(c == 0) {className.clear(); return;}
641 #define BREAK_IF_NOT(x) if(c != (int)x) {className.clear(); break;}
642 #define BREAK_IF_NOT2(x, y) if(c != (int)x && c != (int)y) break;
643 #define BREAK_IF(x) if(c == (int)x) break;
644
645 className.clear();
646
647 // look ahead and see if we can see another
648 while( true ){
649 int c = cl_scope_lex();
650 if(c == 0){ // EOF?
651 className.clear();
652 break;
653 }
654
655 if(c == LE_MACRO || c == LE_FINAL) {
656 continue;
657
658 } else if(c == LE_IDENTIFIER) {
659 className = cl_scope_text;
660
661 } else if(c == LE_DECLSPEC && className.empty()) {
662 // found decl sepc
663
664 // Next token is '('
665 NEXT_TOK();
666 BREAK_IF_NOT('(');
667
668 // Next token is LE_DLLIMPORT or LE_DLLEXPORT
669 NEXT_TOK();
670 BREAK_IF_NOT2(LE_DLLIEXPORT, LE_DLLIMPORT);
671
672 // Next token should be closing brace
673 NEXT_TOK();
674 BREAK_IF_NOT(')');
675
676 } else if( (c == '{') && (!className.empty()) ){
677 // The following is the class content
678 break;
679
680 } else if( c == ':' && !className.empty() ) {
681 // we got the class name, and we found ':'
682 // read all tokens up until the first open brace
683 while (true) {
684 NEXT_TOK();
685 if( c == (int)'{') {
686 return;
687 }
688 }
689 } else {
690 className.clear();
691 break;
692
693 }
694 }
695 }
696
697 /**
698 * consume all token until matching closing brace is found
699 */
700 void consumeDecl()
701 {
702 int depth = 1;
703 while(depth > 0)
704 {
705 int ch = cl_scope_lex();
706 if(ch ==0)
707 {
708 break;
709 }
710 if(ch == '}')
711 {
712 depth--;
713 if(depth == 0) currentScope.pop_back();//reduce the scope
714 continue;
715 }
716 else if(ch == '{')
717 {
718 depth ++ ;
719 continue;
720 }
721 }
722
723 }
724
725 void consumeTemplateDecl()
726 {
727 templateInitList.clear();
728 int dep = 0;
729 while( true ){
730 int c = cl_scope_lex();
731 if(c == 0){ // EOF?
732 break;
733 }
734
735 if(c == '>' && dep == 0){
736 templateInitList += cl_scope_text;
737 break;
738
739 } else {
740 templateInitList += cl_scope_text;
741 templateInitList += " ";
742 }
743
744 switch(c) {
745 case (int)'<':
746 dep++;
747 break;
748 case (int)'>':
749 dep--;
750 break;
751 default:
752 break;
753 }
754 }
755
756 if(templateInitList.empty() == false)
757 templateInitList.insert(0, "<");
758 }
759
760 std::string readInitializer(const char* delim)
761 {
762 std::string intializer;
763 int dep = 0;
764 while( true ){
765 int c = cl_scope_lex();
766 if(c == 0){ // EOF?
767 break;
768 }
769
770 if(strchr(delim, (char)c) && dep == 0){
771 cl_scope_less(0);
772 break;
773
774 } else {
775 intializer += cl_scope_text;
776 intializer += " ";
777 }
778
779 switch(c) {
780 case (int)'<':
781 dep++;
782 break;
783 case (int)'>':
784 dep--;
785 break;
786 default:
787 break;
788 }
789 }
790 return intializer;
791 }
792 //swallow all tokens up to the first '{'
793 void consumeNotIncluding(int ch){
794 while( true ){
795 int c = cl_scope_lex();
796 if(c == 0){ // EOF?
797 break;
798 }
799
800 //keep the function signature
801 if(c == ch){
802 cl_scope_less(0);
803 break;
804 }
805 }
806 }
807
808 // return the scope name at the end of the input string
809 std::string get_scope_name( const std::string &in,
810 std::vector<std::string> &additionalNS,
811 const std::map<std::string, std::string> &ignoreTokens)
812 {
813 if( !setLexerInput(in, ignoreTokens) ){
814 return "";
815 }
816
817 //call tghe main parsing routine
818 cl_scope_parse();
819 std::string scope = getCurrentScope();
820 //do the lexer cleanup
821 cl_scope_lex_clean();
822
823 for(size_t i=0; i<gs_additionlNS.size(); i++){
824 additionalNS.push_back(gs_additionlNS.at(i));
825 }
826 gs_additionlNS.clear();
827 return scope;
828 }
829 #define YYABORT goto yyabort
830 #define YYREJECT goto yyabort
831 #define YYACCEPT goto yyaccept
832 #define YYERROR goto yyerrlab
833 int
834 yyparse()
835 {
836 register int yym, yyn, yystate;
837 #if YYDEBUG
838 register char *yys;
839 extern char *getenv();
840
841 if (yys = getenv("YYDEBUG"))
842 {
843 yyn = *yys;
844 if (yyn >= '0' && yyn <= '9')
845 yydebug = yyn - '0';
846 }
847 #endif
848
849 yynerrs = 0;
850 yyerrflag = 0;
851 yychar = (-1);
852
853 yyssp = yyss;
854 yyvsp = yyvs;
855 *yyssp = yystate = 0;
856
857 yyloop:
858 if (yyn = yydefred[yystate]) goto yyreduce;
859 if (yychar < 0)
860 {
861 if ((yychar = yylex()) < 0) yychar = 0;
862 #if YYDEBUG
863 if (yydebug)
864 {
865 yys = 0;
866 if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
867 if (!yys) yys = "illegal-symbol";
868 printf("%sdebug: state %d, reading %d (%s)\n",
869 YYPREFIX, yystate, yychar, yys);
870 }
871 #endif
872 }
873 if ((yyn = yysindex[yystate]) && (yyn += yychar) >= 0 &&
874 yyn <= YYTABLESIZE && yycheck[yyn] == yychar)
875 {
876 #if YYDEBUG
877 if (yydebug)
878 printf("%sdebug: state %d, shifting to state %d\n",
879 YYPREFIX, yystate, yytable[yyn]);
880 #endif
881 if (yyssp >= yyss + yystacksize - 1)
882 {
883 goto yyoverflow;
884 }
885 *++yyssp = yystate = yytable[yyn];
886 *++yyvsp = yylval;
887 yychar = (-1);
888 if (yyerrflag > 0) --yyerrflag;
889 goto yyloop;
890 }
891 if ((yyn = yyrindex[yystate]) && (yyn += yychar) >= 0 &&
892 yyn <= YYTABLESIZE && yycheck[yyn] == yychar)
893 {
894 yyn = yytable[yyn];
895 goto yyreduce;
896 }
897 if (yyerrflag) goto yyinrecovery;
898 #ifdef lint
899 goto yynewerror;
900 #endif
901 yynewerror:
902 yyerror("syntax error");
903 #ifdef lint
904 goto yyerrlab;
905 #endif
906 yyerrlab:
907 ++yynerrs;
908 yyinrecovery:
909 if (yyerrflag < 3)
910 {
911 yyerrflag = 3;
912 for (;;)
913 {
914 if ((yyn = yysindex[*yyssp]) && (yyn += YYERRCODE) >= 0 &&
915 yyn <= YYTABLESIZE && yycheck[yyn] == YYERRCODE)
916 {
917 #if YYDEBUG
918 if (yydebug)
919 printf("%sdebug: state %d, error recovery shifting\
920 to state %d\n", YYPREFIX, *yyssp, yytable[yyn]);
921 #endif
922 if (yyssp >= yyss + yystacksize - 1)
923 {
924 goto yyoverflow;
925 }
926 *++yyssp = yystate = yytable[yyn];
927 *++yyvsp = yylval;
928 goto yyloop;
929 }
930 else
931 {
932 #if YYDEBUG
933 if (yydebug)
934 printf("%sdebug: error recovery discarding state %d\n",
935 YYPREFIX, *yyssp);
936 #endif
937 if (yyssp <= yyss) goto yyabort;
938 --yyssp;
939 --yyvsp;
940 }
941 }
942 }
943 else
944 {
945 if (yychar == 0) goto yyabort;
946 #if YYDEBUG
947 if (yydebug)
948 {
949 yys = 0;
950 if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
951 if (!yys) yys = "illegal-symbol";
952 printf("%sdebug: state %d, error recovery discards token %d (%s)\n",
953 YYPREFIX, yystate, yychar, yys);
954 }
955 #endif
956 yychar = (-1);
957 goto yyloop;
958 }
959 yyreduce:
960 #if YYDEBUG
961 if (yydebug)
962 printf("%sdebug: state %d, reducing by rule %d (%s)\n",
963 YYPREFIX, yystate, yyn, yyrule[yyn]);
964 #endif
965 yym = yylen[yyn];
966 yyval = yyvsp[1-yym];
967 switch (yyn)
968 {
969 case 1:
970 { yyval = yyvsp[0]; }
971 break;
972 case 2:
973 { yyval = yyvsp[0]; }
974 break;
975 case 3:
976 { yyval = yyvsp[0]; }
977 break;
978 case 4:
979 { yyval = yyvsp[0]; }
980 break;
981 case 5:
982 { yyval = yyvsp[0]; }
983 break;
984 case 6:
985 { yyval = yyvsp[0]; }
986 break;
987 case 7:
988 { yyval = yyvsp[0]; }
989 break;
990 case 8:
991 { yyval = yyvsp[0]; }
992 break;
993 case 9:
994 { yyval = yyvsp[0]; }
995 break;
996 case 10:
997 { yyval = yyvsp[0]; }
998 break;
999 case 11:
1000 { yyval = yyvsp[0]; }
1001 break;
1002 case 12:
1003 { yyval = yyvsp[-1] + " " + yyvsp[0]; }
1004 break;
1005 case 13:
1006 { yyval = yyvsp[-1] + " " + yyvsp[0]; }
1007 break;
1008 case 14:
1009 { yyval = yyvsp[-1] + " " + yyvsp[0]; }
1010 break;
1011 case 15:
1012 { yyval = yyvsp[-1] + " " + yyvsp[0]; }
1013 break;
1014 case 16:
1015 { yyval = yyvsp[0]; }
1016 break;
1017 case 29:
1018 {
1019 /*printf("CodeLite: syntax error, unexpected token '%s' found at line %d \n", cl_scope_text, cl_scope_lineno);*/
1020 /*syncParser();*/
1021 }
1022 break;
1023 case 30:
1024 { yyval = "";}
1025 break;
1026 case 31:
1027 {yyval = yyvsp[-1] + " " + yyvsp[0];}
1028 break;
1029 case 32:
1030 {yyval = yyvsp[-2] + " " + yyvsp[-1] + "=" + readInitializer(",>");}
1031 break;
1032 case 33:
1033 { yyval = yyvsp[0]; }
1034 break;
1035 case 34:
1036 { yyval = yyvsp[-2] + " " + yyvsp[-1] + " " + yyvsp[0]; }
1037 break;
1038 case 35:
1039 { yyval = yyvsp[0]; }
1040 break;
1041 case 36:
1042 { yyval = yyvsp[0]; }
1043 break;
1044 case 38:
1045 {
1046 yyval = yyvsp[-3] + yyvsp[-2] + yyvsp[-1] + yyvsp[0];
1047 }
1048 break;
1049 case 39:
1050 {yyval = "";}
1051 break;
1052 case 40:
1053 {yyval = yyvsp[0];}
1054 break;
1055 case 41:
1056 {yyval = yyvsp[-2] + yyvsp[-1] + yyvsp[0];}
1057 break;
1058 case 42:
1059 {
1060 yyval = yyvsp[-3] + yyvsp[-2] + yyvsp[-1] +yyvsp[0];
1061 }
1062 break;
1063 case 43:
1064 {
1065 yyval = yyvsp[-3] + yyvsp[-2] + yyvsp[-1] +yyvsp[0];
1066 }
1067 break;
1068 case 44:
1069 {
1070 yyval = yyvsp[-6] + yyvsp[-5] + yyvsp[-4] +yyvsp[-3] + yyvsp[-2] + yyvsp[-1] + yyvsp[0] + " " ;
1071 }
1072 break;
1073 case 45:
1074 {
1075 gs_additionlNS.push_back(yyvsp[-2]+yyvsp[-1]);
1076 }
1077 break;
1078 case 46:
1079 {
1080 currentScope.push_back(yyvsp[-2]+yyvsp[-1]);
1081
1082 }
1083 break;
1084 case 47:
1085 {
1086 /*anonymouse namespace*/
1087 increaseScope();
1088
1089 }
1090 break;
1091 case 48:
1092 {
1093 readClassName();
1094 /*increase the scope level*/
1095 if(className.empty() == false) {
1096 currentScope.push_back( className );
1097 printScopeName();
1098 }
1099 }
1100 break;
1101 case 49:
1102 {
1103 if(currentScope.empty())
1104 {
1105 /*fatal error!*/
1106 /*printf("CodeLite: fatal error - cant go beyond global scope!\n");*/
1107 }
1108 else
1109 {
1110 currentScope.pop_back();
1111 printScopeName();
1112 }
1113 }
1114 break;
1115 case 50:
1116 {
1117 /*increase random scope*/
1118 increaseScope();
1119 printScopeName();
1120 }
1121 break;
1122 case 51:
1123 {
1124 consumeNotIncluding(';');
1125 }
1126 break;
1127 case 52:
1128 {yyval = yyvsp[0];}
1129 break;
1130 case 53:
1131 {yyval = yyvsp[0];}
1132 break;
1133 case 54:
1134 {yyval = yyvsp[0];}
1135 break;
1136 case 55:
1137 {yyval = yyvsp[-1] + yyvsp[0];}
1138 break;
1139 case 82:
1140 {yyval = yyvsp[-1] + yyvsp[0];}
1141 break;
1142 case 83:
1143 {yyval = yyvsp[-1] + yyvsp[0];}
1144 break;
1145 case 97:
1146 {yyval = '{';}
1147 break;
1148 case 98:
1149 {consumeInitializationList() /*eat everything including the open brace*/;}
1150 break;
1151 case 99:
1152 {yyval = "";}
1153 break;
1154 case 100:
1155 {yyval = yyvsp[-1];}
1156 break;
1157 case 101:
1158 {
1159 /* eat up all tokens not including the ':'*/
1160 consumeNotIncluding(':');
1161 }
1162 break;
1163 case 102:
1164 {consumeFuncArgList();}
1165 break;
1166 case 103:
1167 {
1168 /*printf("found function %s\n", $7.c_str());*/
1169 /*trim down trailing '::' from scope name*/
1170 if(yyvsp[-6].find_last_not_of(":") != std::string::npos){
1171 yyvsp[-6].erase(yyvsp[-6].find_last_not_of(":")+1);
1172 }
1173 currentScope.push_back(yyvsp[-6]);
1174 printScopeName();
1175 }
1176 break;
1177 case 104:
1178 {consumeFuncArgList();}
1179 break;
1180 case 105:
1181 {
1182
1183 /*trim down trailing '::' from scope name*/
1184 if(yyvsp[-4].find_last_not_of(":") != std::string::npos){
1185 yyvsp[-4].erase(yyvsp[-4].find_last_not_of(":")+1);
1186 }
1187 currentScope.push_back(yyvsp[-4]);
1188 printScopeName();
1189 }
1190 break;
1191 case 106:
1192 {consumeFuncArgList();}
1193 break;
1194 case 107:
1195 {
1196
1197 /*trim down trailing '::' from scope name*/
1198 if(yyvsp[-6].find_last_not_of(":") != std::string::npos){
1199 yyvsp[-6].erase(yyvsp[-6].find_last_not_of(":")+1);
1200 }
1201 currentScope.push_back(yyvsp[-6]);
1202 printScopeName();
1203 }
1204 break;
1205 case 108:
1206 {yyval = "";}
1207 break;
1208 case 109:
1209 { yyval = yyvsp[-1] + yyvsp[0];}
1210 break;
1211 case 110:
1212 {yyval = yyvsp[-1]+ yyvsp[0];}
1213 break;
1214 case 111:
1215 {consumeTemplateDecl();}
1216 break;
1217 case 112:
1218 {yyval = yyvsp[-3] + yyvsp[0];}
1219 break;
1220 case 113:
1221 {yyval = ""; }
1222 break;
1223 case 114:
1224 { yyval = yyvsp[0]; }
1225 break;
1226 case 115:
1227 {yyval = ""; }
1228 break;
1229 case 116:
1230 { yyval = yyvsp[0]; }
1231 break;
1232 case 117:
1233 {yyval = ""; }
1234 break;
1235 case 118:
1236 { yyval = yyvsp[0]; }
1237 break;
1238 case 119:
1239 {yyval = ""; }
1240 break;
1241 case 120:
1242 {yyval = yyvsp[-1] + yyvsp[0];}
1243 break;
1244 case 121:
1245 { yyval = yyvsp[-1] + yyvsp[0]; }
1246 break;
1247 case 122:
1248 {yyval = "";}
1249 break;
1250 case 123:
1251 { yyval = ";";}
1252 break;
1253 case 124:
1254 { yyval = ":";}
1255 break;
1256 case 125:
1257 {yyval = yyvsp[-2] + yyvsp[-1] + yyvsp[0] ;}
1258 break;
1259 case 126:
1260 {yyval = yyvsp[-2] + yyvsp[-1] + yyvsp[0] ;}
1261 break;
1262 case 127:
1263 {yyval = yyvsp[-5] + yyvsp[-4] + yyvsp[-3] + yyvsp[-2] + yyvsp[-1] + yyvsp[0] ;}
1264 break;
1265 case 128:
1266 {currentScope.push_back(yyvsp[-1]); printScopeName();}
1267 break;
1268 case 129:
1269 {
1270 currentScope.pop_back();/*reduce the scope*/
1271 printScopeName();
1272 /*printf("found enum: %s, args are: %s\n", $2.c_str(), $5.c_str());*/
1273 }
1274 break;
1275 case 130:
1276 {yyval = "";}
1277 break;
1278 case 131:
1279 {yyval = yyvsp[-1] + yyvsp[0];}
1280 break;
1281 case 132:
1282 {yyval = yyvsp[-1] + yyvsp[0];}
1283 break;
1284 case 133:
1285 {yyval = yyvsp[-1] + yyvsp[0];}
1286 break;
1287 case 134:
1288 {yyval = yyvsp[-1] + yyvsp[0];}
1289 break;
1290 case 135:
1291 {yyval = "";}
1292 break;
1293 case 136:
1294 {yyval = yyvsp[0];}
1295 break;
1296 case 137:
1297 {yyval = yyvsp[-2] + yyvsp[-1] + yyvsp[0];}
1298 break;
1299 case 138:
1300 {
1301 currentScope.push_back(yyvsp[-1]);
1302 printScopeName();
1303 consumeDecl();
1304 printScopeName();
1305 }
1306 break;
1307 }
1308 yyssp -= yym;
1309 yystate = *yyssp;
1310 yyvsp -= yym;
1311 yym = yylhs[yyn];
1312 if (yystate == 0 && yym == 0)
1313 {
1314 #if YYDEBUG
1315 if (yydebug)
1316 printf("%sdebug: after reduction, shifting from state 0 to\
1317 state %d\n", YYPREFIX, YYFINAL);
1318 #endif
1319 yystate = YYFINAL;
1320 *++yyssp = YYFINAL;
1321 *++yyvsp = yyval;
1322 if (yychar < 0)
1323 {
1324 if ((yychar = yylex()) < 0) yychar = 0;
1325 #if YYDEBUG
1326 if (yydebug)
1327 {
1328 yys = 0;
1329 if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
1330 if (!yys) yys = "illegal-symbol";
1331 printf("%sdebug: state %d, reading %d (%s)\n",
1332 YYPREFIX, YYFINAL, yychar, yys);
1333 }
1334 #endif
1335 }
1336 if (yychar == 0) goto yyaccept;
1337 goto yyloop;
1338 }
1339 if ((yyn = yygindex[yym]) && (yyn += yystate) >= 0 &&
1340 yyn <= YYTABLESIZE && yycheck[yyn] == yystate)
1341 yystate = yytable[yyn];
1342 else
1343 yystate = yydgoto[yym];
1344 #if YYDEBUG
1345 if (yydebug)
1346 printf("%sdebug: after reduction, shifting from state %d \
1347 to state %d\n", YYPREFIX, *yyssp, yystate);
1348 #endif
1349 if (yyssp >= yyss + yystacksize - 1)
1350 {
1351 goto yyoverflow;
1352 }
1353 *++yyssp = yystate;
1354 *++yyvsp = yyval;
1355 goto yyloop;
1356 yyoverflow:
1357 yyerror("yacc stack overflow");
1358 yyabort:
1359 return (1);
1360 yyaccept:
1361 return (0);
1362 }