Debian Codegraph @

CodeLite/cpp_func_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_func_parse
11 #define yylex cl_func_lex
12 #define yyerror cl_func_error
13 #define yychar cl_func_char
14 #define yyval cl_func_val
15 #define yylval cl_func_lval
16 #define yydebug cl_func_debug
17 #define yynerrs cl_func_nerrs
18 #define yyerrflag cl_func_errflag
19 #define yyss cl_func_ss
20 #define yyssp cl_func_ssp
21 #define yyvs cl_func_vs
22 #define yyvsp cl_func_vsp
23 #define yylhs cl_func_lhs
24 #define yylen cl_func_len
25 #define yydefred cl_func_defred
26 #define yydgoto cl_func_dgoto
27 #define yysindex cl_func_sindex
28 #define yyrindex cl_func_rindex
29 #define yygindex cl_func_gindex
30 #define yytable cl_func_table
31 #define yycheck cl_func_check
32 #define yyname cl_func_name
33 #define yyrule cl_func_rule
34 #define YYPREFIX "cl_func_"
35 /* Copyright Eran Ifrah(c)*/
36 /*************** Includes and Defines *****************************/
37 #include "string"
38 #include "vector"
39 #include "stdio.h"
40 #include "map"
41 #include "function.h"
42
43 #define YYDEBUG_LEXER_TEXT (cl_func_lval)
44 #define YYSTYPE std::string
45 #define YYDEBUG 0 /* get the pretty debugging code to compile*/
46
47 #ifdef yylex
48 #undef yylex
49 #define yylex cl_scope_lex
50 #endif
51
52 int cl_func_parse();
53 void cl_func_error(char *string);
54
55 static FunctionList *g_funcs = NULL;
56 static clFunction curr_func;
57
58 /*---------------------------------------------*/
59 /* externs defined in the lexer*/
60 /*---------------------------------------------*/
61 extern char *cl_func_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 void cl_scope_lex_clean();
66
67
68 /*************** Standard ytab.c continues here *********************/
69 #define LE_AUTO 257
70 #define LE_DOUBLE 258
71 #define LE_INT 259
72 #define LE_STRUCT 260
73 #define LE_BREAK 261
74 #define LE_ELSE 262
75 #define LE_LONG 263
76 #define LE_SWITCH 264
77 #define LE_CASE 265
78 #define LE_ENUM 266
79 #define LE_REGISTER 267
80 #define LE_TYPEDEF 268
81 #define LE_CHAR 269
82 #define LE_EXTERN 270
83 #define LE_RETURN 271
84 #define LE_UNION 272
85 #define LE_CONST 273
86 #define LE_FLOAT 274
87 #define LE_SHORT 275
88 #define LE_UNSIGNED 276
89 #define LE_BOOL 277
90 #define LE_CONTINUE 278
91 #define LE_FOR 279
92 #define LE_SIGNED 280
93 #define LE_VOID 281
94 #define LE_DEFAULT 282
95 #define LE_GOTO 283
96 #define LE_SIZEOF 284
97 #define LE_VOLATILE 285
98 #define LE_DO 286
99 #define LE_IF 287
100 #define LE_STATIC 288
101 #define LE_WHILE 289
102 #define LE_NEW 290
103 #define LE_DELETE 291
104 #define LE_THIS 292
105 #define LE_OPERATOR 293
106 #define LE_CLASS 294
107 #define LE_PUBLIC 295
108 #define LE_PROTECTED 296
109 #define LE_PRIVATE 297
110 #define LE_VIRTUAL 298
111 #define LE_FRIEND 299
112 #define LE_INLINE 300
113 #define LE_OVERLOAD 301
114 #define LE_OVERRIDE 302
115 #define LE_FINAL 303
116 #define LE_TEMPLATE 304
117 #define LE_TYPENAME 305
118 #define LE_THROW 306
119 #define LE_CATCH 307
120 #define LE_IDENTIFIER 308
121 #define LE_STRINGliteral 309
122 #define LE_FLOATINGconstant 310
123 #define LE_INTEGERconstant 311
124 #define LE_CHARACTERconstant 312
125 #define LE_OCTALconstant 313
126 #define LE_HEXconstant 314
127 #define LE_POUNDPOUND 315
128 #define LE_CComment 316
129 #define LE_CPPComment 317
130 #define LE_NAMESPACE 318
131 #define LE_USING 319
132 #define LE_TYPEDEFname 320
133 #define LE_ARROW 321
134 #define LE_ICR 322
135 #define LE_DECR 323
136 #define LE_LS 324
137 #define LE_RS 325
138 #define LE_LE 326
139 #define LE_GE 327
140 #define LE_EQ 328
141 #define LE_NE 329
142 #define LE_ANDAND 330
143 #define LE_OROR 331
144 #define LE_ELLIPSIS 332
145 #define LE_CLCL 333
146 #define LE_DOTstar 334
147 #define LE_ARROWstar 335
148 #define LE_MULTassign 336
149 #define LE_DIVassign 337
150 #define LE_MODassign 338
151 #define LE_PLUSassign 339
152 #define LE_MINUSassign 340
153 #define LE_LSassign 341
154 #define LE_RSassign 342
155 #define LE_ANDassign 343
156 #define LE_ERassign 344
157 #define LE_ORassign 345
158 #define LE_MACRO 346
159 #define LE_DYNAMIC_CAST 347
160 #define LE_STATIC_CAST 348
161 #define LE_CONST_CAST 349
162 #define LE_REINTERPRET_CAST 350
163 #define LE_SIZE_T 351
164 #define LE_TIME_T 352
165 #define YYERRCODE 256
166 short cl_func_lhs[] = { -1,
167 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
168 1, 1, 2, 2, 2, 2, 2, 0, 0, 5,
169 3, 3, 6, 6, 8, 8, 7, 7, 9, 9,
170 10, 10, 10, 11, 11, 11, 15, 15, 15, 16,
171 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
172 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
173 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
174 20, 4, 21, 21, 23, 23, 23, 24, 24, 13,
175 13, 22, 22, 25, 26, 25, 18, 18, 12, 12,
176 27, 27, 28, 28, 14, 17, 17, 17, 19, 19,
177 19,
178 };
179 short cl_func_len[] = { 2,
180 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
181 1, 1, 2, 2, 2, 2, 1, 0, 2, 0,
182 2, 1, 0, 2, 1, 3, 1, 1, 0, 4,
183 0, 1, 3, 4, 4, 7, 1, 2, 2, 1,
184 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
185 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
186 1, 1, 1, 1, 1, 2, 2, 1, 1, 1,
187 0, 15, 0, 4, 0, 1, 1, 1, 1, 0,
188 2, 0, 2, 2, 0, 4, 0, 1, 0, 1,
189 0, 1, 0, 2, 2, 0, 1, 1, 3, 3,
190 6,
191 };
192 short cl_func_defred[] = { 18,
193 0, 22, 19, 0, 97, 98, 21, 0, 0, 0,
194 0, 88, 0, 27, 28, 25, 0, 0, 90, 80,
195 24, 0, 30, 0, 0, 26, 6, 1, 0, 2,
196 5, 3, 0, 10, 0, 9, 0, 12, 11, 17,
197 93, 81, 80, 16, 15, 4, 8, 7, 13, 14,
198 84, 0, 100, 0, 99, 0, 0, 32, 80, 0,
199 94, 92, 95, 0, 0, 0, 0, 0, 93, 0,
200 86, 68, 69, 56, 60, 61, 52, 53, 62, 63,
201 64, 65, 54, 55, 59, 57, 70, 50, 51, 48,
202 40, 41, 42, 43, 44, 45, 46, 47, 49, 58,
203 0, 0, 39, 85, 38, 71, 33, 101, 0, 93,
204 66, 67, 0, 0, 34, 35, 0, 0, 0, 0,
205 93, 0, 0, 0, 36, 0, 83, 76, 77, 0,
206 74, 78, 79, 72,
207 };
208 short cl_func_dgoto[] = { 1,
209 40, 41, 3, 7, 4, 16, 17, 18, 10, 57,
210 58, 59, 24, 53, 67, 103, 8, 13, 25, 113,
211 120, 124, 130, 134, 42, 60, 63, 54,
212 };
213 short cl_func_sindex[] = { 0,
214 -247, 0, 0, 22, 0, 0, 0, -267, 7, -223,
215 -229, 0, -185, 0, 0, 0, -212, -26, 0, 0,
216 0, -229, 0, 84, -185, 0, 0, 0, -181, 0,
217 0, 0, 142, 0, 142, 0, -59, 0, 0, 0,
218 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
219 0, -185, 0, 51, 0, -121, -11, 0, 0, -235,
220 0, 0, 0, 1, -58, -203, 67, -185, 0, 113,
221 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
222 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
223 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
224 68, 17, 0, 0, 0, 0, 0, 0, -56, 0,
225 0, 0, -185, -185, 0, 0, -191, 8, 81, 62,
226 0, -185, -189, -200, 0, 53, 0, 0, 0, -52,
227 0, 0, 0, 0,
228 };
229 short cl_func_rindex[] = { 0,
230 75, 0, 0, -190, 0, 0, 0, -128, 0, -67,
231 12, 0, 122, 0, 0, 0, 0, 0, 0, 0,
232 0, 12, 0, 0, -120, 0, 0, 0, -27, 0,
233 0, 0, -22, 0, -13, 0, -15, 0, 0, 0,
234 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
235 0, -32, 0, -20, 0, 0, 0, 0, 0, 0,
236 0, 0, 0, 0, 88, 0, 0, 122, 0, 0,
237 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
238 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
239 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
240 0, 0, 0, 0, 0, 0, 0, 0, 78, 0,
241 0, 0, -6, -32, 0, 0, 3, 0, 0, -46,
242 0, -41, 0, -51, 0, 0, 0, 0, 0, 0,
243 0, 0, 0, 0,
244 };
245 short cl_func_gindex[] = { 0,
246 24, 59, 0, 0, 0, 110, 0, 0, 0, -64,
247 69, 41, -33, -9, 0, 0, 0, 0, 0, 0,
248 0, 0, 0, 0, 0, 0, 0, 0,
249 };
250 #define YYTABLESIZE 494
251 short cl_func_table[] = { 31,
252 52, 104, 31, 114, 66, 89, 133, 75, 2, 56,
253 4, 31, 82, 4, 4, 8, 4, 22, 8, 8,
254 91, 8, 93, 91, 7, 70, 93, 7, 7, 31,
255 7, 55, 68, 99, 4, 23, 9, 95, 97, 8,
256 101, 91, 93, 91, 87, 92, 100, 94, 7, 118,
257 69, 68, 89, 20, 89, 23, 49, 126, 50, 108,
258 88, 73, 89, 73, 14, 43, 11, 96, 96, 121,
259 132, 75, 96, 23, 12, 15, 82, 44, 96, 6,
260 5, 45, 96, 96, 96, 96, 96, 19, 62, 96,
261 96, 102, 61, 131, 96, 21, 68, 71, 4, 115,
262 116, 128, 129, 8, 105, 91, 106, 96, 111, 112,
263 93, 125, 7, 96, 119, 93, 89, 96, 93, 93,
264 122, 93, 123, 127, 98, 73, 90, 37, 110, 29,
265 29, 26, 20, 20, 29, 0, 107, 0, 0, 93,
266 29, 0, 0, 0, 29, 29, 29, 29, 29, 0,
267 0, 29, 29, 117, 0, 0, 0, 0, 0, 0,
268 96, 96, 0, 0, 0, 0, 0, 0, 0, 29,
269 0, 64, 89, 0, 0, 0, 0, 0, 0, 29,
270 0, 0, 0, 0, 0, 0, 65, 89, 0, 0,
271 87, 87, 0, 0, 0, 87, 0, 0, 0, 0,
272 0, 87, 0, 0, 0, 87, 87, 87, 87, 87,
273 0, 0, 87, 87, 0, 0, 89, 89, 0, 0,
274 0, 89, 29, 29, 0, 89, 89, 89, 0, 0,
275 89, 0, 89, 89, 89, 89, 89, 0, 89, 89,
276 87, 89, 89, 89, 89, 4, 0, 89, 89, 0,
277 8, 0, 91, 0, 0, 82, 82, 93, 0, 7,
278 0, 0, 0, 0, 0, 4, 89, 0, 0, 0,
279 8, 0, 91, 51, 51, 89, 51, 93, 0, 7,
280 4, 0, 0, 87, 87, 8, 0, 91, 0, 0,
281 72, 73, 93, 0, 7, 89, 89, 0, 0, 89,
282 85, 0, 0, 0, 73, 73, 0, 0, 0, 89,
283 89, 0, 0, 0, 0, 0, 0, 0, 89, 89,
284 0, 74, 75, 76, 77, 78, 79, 80, 81, 82,
285 83, 84, 20, 20, 85, 86, 0, 20, 0, 0,
286 0, 27, 28, 20, 0, 0, 29, 20, 20, 20,
287 20, 20, 30, 0, 20, 20, 0, 31, 32, 33,
288 34, 0, 0, 35, 36, 0, 0, 0, 0, 0,
289 27, 28, 20, 0, 0, 29, 0, 0, 20, 89,
290 89, 30, 20, 0, 89, 0, 31, 32, 33, 34,
291 89, 37, 35, 36, 0, 89, 89, 89, 89, 27,
292 28, 89, 89, 0, 46, 0, 0, 0, 0, 0,
293 30, 0, 0, 0, 0, 31, 32, 47, 34, 0,
294 109, 48, 36, 0, 0, 20, 20, 0, 0, 89,
295 0, 0, 0, 0, 38, 39, 0, 0, 0, 0,
296 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
297 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
298 0, 0, 0, 38, 39, 0, 0, 0, 0, 0,
299 0, 0, 89, 89, 0, 0, 0, 0, 0, 0,
300 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
301 0, 0, 38, 39,
302 };
303 short cl_func_check[] = { 41,
304 60, 60, 44, 60, 126, 126, 59, 59, 256, 43,
305 38, 44, 59, 41, 42, 38, 44, 44, 41, 42,
306 41, 44, 38, 44, 38, 59, 42, 41, 42, 62,
307 44, 41, 44, 33, 62, 62, 304, 37, 38, 62,
308 40, 62, 42, 43, 44, 45, 46, 47, 62, 114,
309 62, 44, 59, 13, 61, 44, 33, 122, 35, 69,
310 60, 59, 62, 61, 294, 25, 60, 258, 259, 62,
311 123, 123, 263, 62, 298, 305, 123, 259, 269, 58,
312 59, 263, 273, 274, 275, 276, 277, 273, 38, 280,
313 281, 91, 42, 41, 94, 308, 44, 333, 126, 109,
314 110, 302, 303, 126, 308, 126, 40, 298, 41, 93,
315 126, 121, 126, 304, 306, 38, 123, 308, 41, 42,
316 40, 44, 61, 313, 124, 123, 126, 40, 70, 258,
317 259, 22, 58, 59, 263, -1, 68, -1, -1, 62,
318 269, -1, -1, -1, 273, 274, 275, 276, 277, -1,
319 -1, 280, 281, 113, -1, -1, -1, -1, -1, -1,
320 351, 352, -1, -1, -1, -1, -1, -1, -1, 298,
321 -1, 293, 293, -1, -1, -1, -1, -1, -1, 308,
322 -1, -1, -1, -1, -1, -1, 308, 308, -1, -1,
323 258, 259, -1, -1, -1, 263, -1, -1, -1, -1,
324 -1, 269, -1, -1, -1, 273, 274, 275, 276, 277,
325 -1, -1, 280, 281, -1, -1, 258, 259, -1, -1,
326 -1, 263, 351, 352, -1, 258, 259, 269, -1, -1,
327 263, -1, 274, 275, 276, 277, 269, -1, 280, 281,
328 308, 274, 275, 276, 277, 273, -1, 280, 281, -1,
329 273, -1, 273, -1, -1, 302, 303, 273, -1, 273,
330 -1, -1, -1, -1, -1, 293, 308, -1, -1, -1,
331 293, -1, 293, 333, 333, 308, 333, 293, -1, 293,
332 308, -1, -1, 351, 352, 308, -1, 308, -1, -1,
333 290, 291, 308, -1, 308, 302, 303, -1, -1, 306,
334 333, -1, -1, -1, 302, 303, -1, -1, -1, 351,
335 352, -1, -1, -1, -1, -1, -1, -1, 351, 352,
336 -1, 321, 322, 323, 324, 325, 326, 327, 328, 329,
337 330, 331, 258, 259, 334, 335, -1, 263, -1, -1,
338 -1, 258, 259, 269, -1, -1, 263, 273, 274, 275,
339 276, 277, 269, -1, 280, 281, -1, 274, 275, 276,
340 277, -1, -1, 280, 281, -1, -1, -1, -1, -1,
341 258, 259, 298, -1, -1, 263, -1, -1, 304, 258,
342 259, 269, 308, -1, 263, -1, 274, 275, 276, 277,
343 269, 308, 280, 281, -1, 274, 275, 276, 277, 258,
344 259, 280, 281, -1, 263, -1, -1, -1, -1, -1,
345 269, -1, -1, -1, -1, 274, 275, 276, 277, -1,
346 308, 280, 281, -1, -1, 351, 352, -1, -1, 308,
347 -1, -1, -1, -1, 351, 352, -1, -1, -1, -1,
348 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
349 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
350 -1, -1, -1, 351, 352, -1, -1, -1, -1, -1,
351 -1, -1, 351, 352, -1, -1, -1, -1, -1, -1,
352 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
353 -1, -1, 351, 352,
354 };
355 #define YYFINAL 1
356 #ifndef YYDEBUG
357 #define YYDEBUG 1
358 #endif
359 #define YYMAXTOKEN 352
360 #if YYDEBUG
361 char *cl_func_name[] = {
362 "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,
363 "'!'",0,0,0,"'%'","'&'",0,"'('","')'","'*'","'+'","','","'-'","'.'","'/'",0,0,0,
364 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,
365 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,
366 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,
367 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,
368 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,
369 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","LE_DOUBLE",
370 "LE_INT","LE_STRUCT","LE_BREAK","LE_ELSE","LE_LONG","LE_SWITCH","LE_CASE",
371 "LE_ENUM","LE_REGISTER","LE_TYPEDEF","LE_CHAR","LE_EXTERN","LE_RETURN",
372 "LE_UNION","LE_CONST","LE_FLOAT","LE_SHORT","LE_UNSIGNED","LE_BOOL",
373 "LE_CONTINUE","LE_FOR","LE_SIGNED","LE_VOID","LE_DEFAULT","LE_GOTO","LE_SIZEOF",
374 "LE_VOLATILE","LE_DO","LE_IF","LE_STATIC","LE_WHILE","LE_NEW","LE_DELETE",
375 "LE_THIS","LE_OPERATOR","LE_CLASS","LE_PUBLIC","LE_PROTECTED","LE_PRIVATE",
376 "LE_VIRTUAL","LE_FRIEND","LE_INLINE","LE_OVERLOAD","LE_OVERRIDE","LE_FINAL",
377 "LE_TEMPLATE","LE_TYPENAME","LE_THROW","LE_CATCH","LE_IDENTIFIER",
378 "LE_STRINGliteral","LE_FLOATINGconstant","LE_INTEGERconstant",
379 "LE_CHARACTERconstant","LE_OCTALconstant","LE_HEXconstant","LE_POUNDPOUND",
380 "LE_CComment","LE_CPPComment","LE_NAMESPACE","LE_USING","LE_TYPEDEFname",
381 "LE_ARROW","LE_ICR","LE_DECR","LE_LS","LE_RS","LE_LE","LE_GE","LE_EQ","LE_NE",
382 "LE_ANDAND","LE_OROR","LE_ELLIPSIS","LE_CLCL","LE_DOTstar","LE_ARROWstar",
383 "LE_MULTassign","LE_DIVassign","LE_MODassign","LE_PLUSassign","LE_MINUSassign",
384 "LE_LSassign","LE_RSassign","LE_ANDassign","LE_ERassign","LE_ORassign",
385 "LE_MACRO","LE_DYNAMIC_CAST","LE_STATIC_CAST","LE_CONST_CAST",
386 "LE_REINTERPRET_CAST","LE_SIZE_T","LE_TIME_T",
387 };
388 char *cl_func_rule[] = {
389 "$accept : translation_unit",
390 "basic_type_name_inter : LE_INT",
391 "basic_type_name_inter : LE_CHAR",
392 "basic_type_name_inter : LE_SHORT",
393 "basic_type_name_inter : LE_LONG",
394 "basic_type_name_inter : LE_FLOAT",
395 "basic_type_name_inter : LE_DOUBLE",
396 "basic_type_name_inter : LE_SIGNED",
397 "basic_type_name_inter : LE_UNSIGNED",
398 "basic_type_name_inter : LE_VOID",
399 "basic_type_name_inter : LE_BOOL",
400 "basic_type_name_inter : LE_TIME_T",
401 "basic_type_name_inter : LE_SIZE_T",
402 "basic_type_name : LE_UNSIGNED basic_type_name_inter",
403 "basic_type_name : LE_SIGNED basic_type_name_inter",
404 "basic_type_name : LE_LONG LE_LONG",
405 "basic_type_name : LE_LONG LE_INT",
406 "basic_type_name : basic_type_name_inter",
407 "translation_unit :",
408 "translation_unit : translation_unit external_decl",
409 "$$1 :",
410 "external_decl : $$1 function_decl",
411 "external_decl : error",
412 "template_arg :",
413 "template_arg : template_specifiter LE_IDENTIFIER",
414 "template_arg_list : template_arg",
415 "template_arg_list : template_arg_list ',' template_arg",
416 "template_specifiter : LE_CLASS",
417 "template_specifiter : LE_TYPENAME",
418 "opt_template_qualifier :",
419 "opt_template_qualifier : LE_TEMPLATE '<' template_arg_list '>'",
420 "template_parameter_list :",
421 "template_parameter_list : template_parameter",
422 "template_parameter_list : template_parameter_list ',' template_parameter",
423 "template_parameter : const_spec nested_scope_specifier LE_IDENTIFIER special_star_amp",
424 "template_parameter : const_spec nested_scope_specifier basic_type_name special_star_amp",
425 "template_parameter : const_spec nested_scope_specifier LE_IDENTIFIER '<' template_parameter_list '>' special_star_amp",
426 "func_name : LE_IDENTIFIER",
427 "func_name : '~' LE_IDENTIFIER",
428 "func_name : LE_OPERATOR any_operator",
429 "any_operator : '+'",
430 "any_operator : '-'",
431 "any_operator : '*'",
432 "any_operator : '/'",
433 "any_operator : '%'",
434 "any_operator : '^'",
435 "any_operator : '&'",
436 "any_operator : '|'",
437 "any_operator : '~'",
438 "any_operator : '!'",
439 "any_operator : '<'",
440 "any_operator : '>'",
441 "any_operator : LE_LS",
442 "any_operator : LE_RS",
443 "any_operator : LE_ANDAND",
444 "any_operator : LE_OROR",
445 "any_operator : LE_ARROW",
446 "any_operator : LE_ARROWstar",
447 "any_operator : '.'",
448 "any_operator : LE_DOTstar",
449 "any_operator : LE_ICR",
450 "any_operator : LE_DECR",
451 "any_operator : LE_LE",
452 "any_operator : LE_GE",
453 "any_operator : LE_EQ",
454 "any_operator : LE_NE",
455 "any_operator : '(' ')'",
456 "any_operator : '[' ']'",
457 "any_operator : LE_NEW",
458 "any_operator : LE_DELETE",
459 "any_operator : ','",
460 "$$2 :",
461 "function_decl : stmnt_starter opt_template_qualifier virtual_spec const_spec variable_decl const_spec nested_scope_specifier func_name '(' $$2 const_spec declare_throw opt_pure_virtual override_final_specifier func_postfix",
462 "declare_throw :",
463 "declare_throw : LE_THROW '(' template_parameter_list ')'",
464 "override_final_specifier :",
465 "override_final_specifier : LE_OVERRIDE",
466 "override_final_specifier : LE_FINAL",
467 "func_postfix : '{'",
468 "func_postfix : ';'",
469 "nested_scope_specifier :",
470 "nested_scope_specifier : nested_scope_specifier scope_specifier",
471 "opt_pure_virtual :",
472 "opt_pure_virtual : '=' LE_OCTALconstant",
473 "scope_specifier : LE_IDENTIFIER LE_CLCL",
474 "$$3 :",
475 "scope_specifier : LE_IDENTIFIER '<' $$3 LE_CLCL",
476 "virtual_spec :",
477 "virtual_spec : LE_VIRTUAL",
478 "const_spec :",
479 "const_spec : LE_CONST",
480 "amp_item :",
481 "amp_item : '&'",
482 "star_list :",
483 "star_list : star_list '*'",
484 "special_star_amp : star_list amp_item",
485 "stmnt_starter :",
486 "stmnt_starter : ';'",
487 "stmnt_starter : ':'",
488 "variable_decl : nested_scope_specifier basic_type_name special_star_amp",
489 "variable_decl : nested_scope_specifier LE_IDENTIFIER special_star_amp",
490 "variable_decl : nested_scope_specifier LE_IDENTIFIER '<' template_parameter_list '>' special_star_amp",
491 };
492 #endif
493 #ifndef YYSTYPE
494 typedef int YYSTYPE;
495 #endif
496 #ifdef YYSTACKSIZE
497 #undef YYMAXDEPTH
498 #define YYMAXDEPTH YYSTACKSIZE
499 #else
500 #ifdef YYMAXDEPTH
501 #define YYSTACKSIZE YYMAXDEPTH
502 #else
503 #define YYSTACKSIZE 500
504 #define YYMAXDEPTH 500
505 #endif
506 #endif
507 int yydebug;
508 int yynerrs;
509 int yyerrflag;
510 int yychar;
511 short *yyssp;
512 YYSTYPE *yyvsp;
513 YYSTYPE yyval;
514 YYSTYPE yylval;
515 short yyss[YYSTACKSIZE];
516 YYSTYPE yyvs[YYSTACKSIZE];
517 #define yystacksize YYSTACKSIZE
518 void yyerror(char *s) {}
519
520 void func_consumeFuncArgList()
521 {
522 curr_func.m_signature = "(";
523
524 int depth = 1;
525 while(depth > 0)
526 {
527 int ch = cl_scope_lex();
528 if(ch == 0)
529 {
530 break;
531 }
532
533 curr_func.m_signature += cl_func_lval;
534 curr_func.m_signature += " ";
535 if(ch == ')')
536 {
537 depth--;
538 continue;
539 }
540 else if(ch == '(')
541 {
542 depth ++ ;
543 continue;
544 }
545 }
546 }
547
548 /**
549 * consume all token until matching closing brace is found
550 */
551 void func_consumeDecl()
552 {
553 int depth = 1;
554 while(depth > 0)
555 {
556 int ch = cl_scope_lex();
557 //printf("ch=%d\n", ch);
558 //fflush(stdout);
559 if(ch ==0)
560 {
561 break;
562 }
563 if(ch == '}')
564 {
565 depth--;
566 continue;
567 }
568 else if(ch == '{')
569 {
570 depth ++ ;
571 continue;
572 }
573 }
574
575 }
576
577 void func_consumeTemplateDecl()
578 {
579 int depth = 1;
580 while(depth > 0)
581 {
582 int ch = cl_scope_lex();
583 //printf("ch=%d\n", ch);
584 //fflush(stdout);
585 if(ch ==0){
586 break;
587 }
588
589 if(ch == '>')
590 {
591 depth--;
592 continue;
593 }
594 else if(ch == '<')
595 {
596 depth ++ ;
597 continue;
598 }
599 }
600 }
601
602 // return the scope name at the end of the input string
603 void get_functions(const std::string &in, FunctionList &li, const std::map<std::string, std::string> &ignoreTokens)
604 {
605 if( !setLexerInput(in, ignoreTokens) )
606 {
607 return;
608 }
609
610 g_funcs = &li;
611
612 //call tghe main parsing routine
613 cl_func_parse();
614 g_funcs = NULL;
615
616 //do the lexer cleanup
617 cl_scope_lex_clean();
618 }
619 #define YYABORT goto yyabort
620 #define YYREJECT goto yyabort
621 #define YYACCEPT goto yyaccept
622 #define YYERROR goto yyerrlab
623 int
624 yyparse()
625 {
626 register int yym, yyn, yystate;
627 #if YYDEBUG
628 register char *yys;
629 extern char *getenv();
630
631 if (yys = getenv("YYDEBUG"))
632 {
633 yyn = *yys;
634 if (yyn >= '0' && yyn <= '9')
635 yydebug = yyn - '0';
636 }
637 #endif
638
639 yynerrs = 0;
640 yyerrflag = 0;
641 yychar = (-1);
642
643 yyssp = yyss;
644 yyvsp = yyvs;
645 *yyssp = yystate = 0;
646
647 yyloop:
648 if (yyn = yydefred[yystate]) goto yyreduce;
649 if (yychar < 0)
650 {
651 if ((yychar = yylex()) < 0) yychar = 0;
652 #if YYDEBUG
653 if (yydebug)
654 {
655 yys = 0;
656 if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
657 if (!yys) yys = "illegal-symbol";
658 printf("%sdebug: state %d, reading %d (%s)\n",
659 YYPREFIX, yystate, yychar, yys);
660 }
661 #endif
662 }
663 if ((yyn = yysindex[yystate]) && (yyn += yychar) >= 0 &&
664 yyn <= YYTABLESIZE && yycheck[yyn] == yychar)
665 {
666 #if YYDEBUG
667 if (yydebug)
668 printf("%sdebug: state %d, shifting to state %d\n",
669 YYPREFIX, yystate, yytable[yyn]);
670 #endif
671 if (yyssp >= yyss + yystacksize - 1)
672 {
673 goto yyoverflow;
674 }
675 *++yyssp = yystate = yytable[yyn];
676 *++yyvsp = yylval;
677 yychar = (-1);
678 if (yyerrflag > 0) --yyerrflag;
679 goto yyloop;
680 }
681 if ((yyn = yyrindex[yystate]) && (yyn += yychar) >= 0 &&
682 yyn <= YYTABLESIZE && yycheck[yyn] == yychar)
683 {
684 yyn = yytable[yyn];
685 goto yyreduce;
686 }
687 if (yyerrflag) goto yyinrecovery;
688 #ifdef lint
689 goto yynewerror;
690 #endif
691 yynewerror:
692 yyerror("syntax error");
693 #ifdef lint
694 goto yyerrlab;
695 #endif
696 yyerrlab:
697 ++yynerrs;
698 yyinrecovery:
699 if (yyerrflag < 3)
700 {
701 yyerrflag = 3;
702 for (;;)
703 {
704 if ((yyn = yysindex[*yyssp]) && (yyn += YYERRCODE) >= 0 &&
705 yyn <= YYTABLESIZE && yycheck[yyn] == YYERRCODE)
706 {
707 #if YYDEBUG
708 if (yydebug)
709 printf("%sdebug: state %d, error recovery shifting\
710 to state %d\n", YYPREFIX, *yyssp, yytable[yyn]);
711 #endif
712 if (yyssp >= yyss + yystacksize - 1)
713 {
714 goto yyoverflow;
715 }
716 *++yyssp = yystate = yytable[yyn];
717 *++yyvsp = yylval;
718 goto yyloop;
719 }
720 else
721 {
722 #if YYDEBUG
723 if (yydebug)
724 printf("%sdebug: error recovery discarding state %d\n",
725 YYPREFIX, *yyssp);
726 #endif
727 if (yyssp <= yyss) goto yyabort;
728 --yyssp;
729 --yyvsp;
730 }
731 }
732 }
733 else
734 {
735 if (yychar == 0) goto yyabort;
736 #if YYDEBUG
737 if (yydebug)
738 {
739 yys = 0;
740 if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
741 if (!yys) yys = "illegal-symbol";
742 printf("%sdebug: state %d, error recovery discards token %d (%s)\n",
743 YYPREFIX, yystate, yychar, yys);
744 }
745 #endif
746 yychar = (-1);
747 goto yyloop;
748 }
749 yyreduce:
750 #if YYDEBUG
751 if (yydebug)
752 printf("%sdebug: state %d, reducing by rule %d (%s)\n",
753 YYPREFIX, yystate, yyn, yyrule[yyn]);
754 #endif
755 yym = yylen[yyn];
756 yyval = yyvsp[1-yym];
757 switch (yyn)
758 {
759 case 1:
760 { yyval = yyvsp[0]; }
761 break;
762 case 2:
763 { yyval = yyvsp[0]; }
764 break;
765 case 3:
766 { yyval = yyvsp[0]; }
767 break;
768 case 4:
769 { yyval = yyvsp[0]; }
770 break;
771 case 5:
772 { yyval = yyvsp[0]; }
773 break;
774 case 6:
775 { yyval = yyvsp[0]; }
776 break;
777 case 7:
778 { yyval = yyvsp[0]; }
779 break;
780 case 8:
781 { yyval = yyvsp[0]; }
782 break;
783 case 9:
784 { yyval = yyvsp[0]; }
785 break;
786 case 10:
787 { yyval = yyvsp[0]; }
788 break;
789 case 11:
790 { yyval = yyvsp[0]; }
791 break;
792 case 12:
793 { yyval = yyvsp[0]; }
794 break;
795 case 13:
796 { yyval = yyvsp[-1] + " " + yyvsp[0]; }
797 break;
798 case 14:
799 { yyval = yyvsp[-1] + " " + yyvsp[0]; }
800 break;
801 case 15:
802 { yyval = yyvsp[-1] + " " + yyvsp[0]; }
803 break;
804 case 16:
805 { yyval = yyvsp[-1] + " " + yyvsp[0]; }
806 break;
807 case 17:
808 { yyval = yyvsp[0]; }
809 break;
810 case 20:
811 {curr_func.Reset();}
812 break;
813 case 22:
814 {
815 /*printf("CodeLite: syntax error, unexpected token '%s' found\n", cl_func_lval.c_str());*/
816 }
817 break;
818 case 23:
819 { yyval = "";}
820 break;
821 case 24:
822 {yyval = yyvsp[-1] + " " + yyvsp[0];}
823 break;
824 case 25:
825 { yyval = yyvsp[0]; }
826 break;
827 case 26:
828 { yyval = yyvsp[-2] + " " + yyvsp[-1] + " " + yyvsp[0]; }
829 break;
830 case 27:
831 { yyval = yyvsp[0]; }
832 break;
833 case 28:
834 { yyval = yyvsp[0]; }
835 break;
836 case 30:
837 { yyval = yyvsp[-3] + yyvsp[-2] + yyvsp[-1] + yyvsp[0];}
838 break;
839 case 31:
840 {yyval = "";}
841 break;
842 case 32:
843 {yyval = yyvsp[0];}
844 break;
845 case 33:
846 {yyval = yyvsp[-2] + yyvsp[-1] + yyvsp[0];}
847 break;
848 case 34:
849 {
850 yyval = yyvsp[-3] + yyvsp[-2] + yyvsp[-1] +yyvsp[0];
851 }
852 break;
853 case 35:
854 {
855 yyval = yyvsp[-3] + yyvsp[-2] + yyvsp[-1] +yyvsp[0];
856 }
857 break;
858 case 36:
859 {
860 yyval = yyvsp[-6] + yyvsp[-5] + yyvsp[-4] +yyvsp[-3] + yyvsp[-2] + yyvsp[-1] + yyvsp[0] + " " ;
861 }
862 break;
863 case 37:
864 {yyval = yyvsp[0];}
865 break;
866 case 38:
867 {yyval = yyvsp[-1] + yyvsp[0];}
868 break;
869 case 39:
870 {yyval = yyvsp[-1] + yyvsp[0];}
871 break;
872 case 71:
873 {func_consumeFuncArgList();}
874 break;
875 case 72:
876 {
877 /*trim down trailing '::' from scope name*/
878 yyvsp[-9].erase(yyvsp[-9].find_last_not_of(":")+1);
879 curr_func.m_isVirtual = yyvsp[-12].find("virtual") != std::string::npos;
880 curr_func.m_isPureVirtual = yyvsp[-2].find("=") != std::string::npos;
881 curr_func.m_isConst = yyvsp[-4].find("const") != std::string::npos;
882 curr_func.m_isFinal = yyvsp[-1].find("final") != std::string::npos;
883 curr_func.m_name = yyvsp[-7];
884 curr_func.m_scope = yyvsp[-8];
885 curr_func.m_retrunValusConst = yyvsp[-11];
886 curr_func.m_lineno = cl_scope_lineno;
887 curr_func.m_throws = yyvsp[-3];
888 curr_func.m_returnValue.m_rightSideConst = yyvsp[-9];
889 curr_func.m_returnValue.m_isConst = !yyvsp[-11].empty();
890 if(g_funcs)
891 {
892 g_funcs->push_back(curr_func);
893 }
894 curr_func.Reset();
895 }
896 break;
897 case 73:
898 {yyval = "";}
899 break;
900 case 74:
901 {yyval = yyvsp[-1];}
902 break;
903 case 75:
904 {yyval = "";}
905 break;
906 case 80:
907 {yyval = "";}
908 break;
909 case 81:
910 { yyval = yyvsp[-1] + yyvsp[0];}
911 break;
912 case 82:
913 {yyval = "";}
914 break;
915 case 83:
916 {yyval = yyvsp[-1] + yyvsp[0];}
917 break;
918 case 84:
919 {yyval = yyvsp[-1]+ yyvsp[0];}
920 break;
921 case 85:
922 {func_consumeTemplateDecl();}
923 break;
924 case 86:
925 {yyval = yyvsp[-3] + yyvsp[0];}
926 break;
927 case 87:
928 {yyval = ""; }
929 break;
930 case 88:
931 { yyval = yyvsp[0]; }
932 break;
933 case 89:
934 {yyval = ""; }
935 break;
936 case 90:
937 { yyval = yyvsp[0]; }
938 break;
939 case 91:
940 {yyval = ""; }
941 break;
942 case 92:
943 { yyval = yyvsp[0]; }
944 break;
945 case 93:
946 {yyval = ""; }
947 break;
948 case 94:
949 {yyval = yyvsp[-1] + yyvsp[0];}
950 break;
951 case 95:
952 { yyval = yyvsp[-1] + yyvsp[0]; }
953 break;
954 case 96:
955 {yyval = "";}
956 break;
957 case 97:
958 { yyval = ";";}
959 break;
960 case 98:
961 { yyval = ":";}
962 break;
963 case 99:
964 {
965 yyvsp[-2].erase(yyvsp[-2].find_last_not_of(":")+1);
966 curr_func.m_returnValue.m_type = yyvsp[-1];
967 curr_func.m_returnValue.m_typeScope = yyvsp[-2];
968 curr_func.m_returnValue.m_starAmp = yyvsp[0];
969 curr_func.m_returnValue.m_isPtr = (yyvsp[0].find("*") != (size_t)-1);
970 yyval = yyvsp[-2] + yyvsp[-1] + yyvsp[0];
971 }
972 break;
973 case 100:
974 {
975 yyvsp[-2].erase(yyvsp[-2].find_last_not_of(":")+1);
976 curr_func.m_returnValue.m_type = yyvsp[-1];
977 curr_func.m_returnValue.m_typeScope = yyvsp[-2];
978 curr_func.m_returnValue.m_starAmp = yyvsp[0];
979 curr_func.m_returnValue.m_isPtr = (yyvsp[0].find("*") != (size_t)-1);
980 yyval = yyvsp[-2] + yyvsp[-1] + yyvsp[0] ;
981 }
982 break;
983 case 101:
984 {
985 yyvsp[-5].erase(yyvsp[-5].find_last_not_of(":")+1);
986 curr_func.m_returnValue.m_type = yyvsp[-4];
987 curr_func.m_returnValue.m_typeScope = yyvsp[-5];
988 curr_func.m_returnValue.m_starAmp = yyvsp[0];
989 curr_func.m_returnValue.m_isPtr = (yyvsp[0].find("*") != (size_t)-1);
990 curr_func.m_returnValue.m_isTemplate = true;
991 curr_func.m_returnValue.m_templateDecl = yyvsp[-2];
992 yyval = yyvsp[-5] + yyvsp[-4] + yyvsp[-3] + yyvsp[-2] + yyvsp[-1] + yyvsp[0] ;
993 }
994 break;
995 }
996 yyssp -= yym;
997 yystate = *yyssp;
998 yyvsp -= yym;
999 yym = yylhs[yyn];
1000 if (yystate == 0 && yym == 0)
1001 {
1002 #if YYDEBUG
1003 if (yydebug)
1004 printf("%sdebug: after reduction, shifting from state 0 to\
1005 state %d\n", YYPREFIX, YYFINAL);
1006 #endif
1007 yystate = YYFINAL;
1008 *++yyssp = YYFINAL;
1009 *++yyvsp = yyval;
1010 if (yychar < 0)
1011 {
1012 if ((yychar = yylex()) < 0) yychar = 0;
1013 #if YYDEBUG
1014 if (yydebug)
1015 {
1016 yys = 0;
1017 if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
1018 if (!yys) yys = "illegal-symbol";
1019 printf("%sdebug: state %d, reading %d (%s)\n",
1020 YYPREFIX, YYFINAL, yychar, yys);
1021 }
1022 #endif
1023 }
1024 if (yychar == 0) goto yyaccept;
1025 goto yyloop;
1026 }
1027 if ((yyn = yygindex[yym]) && (yyn += yystate) >= 0 &&
1028 yyn <= YYTABLESIZE && yycheck[yyn] == yystate)
1029 yystate = yytable[yyn];
1030 else
1031 yystate = yydgoto[yym];
1032 #if YYDEBUG
1033 if (yydebug)
1034 printf("%sdebug: after reduction, shifting from state %d \
1035 to state %d\n", YYPREFIX, *yyssp, yystate);
1036 #endif
1037 if (yyssp >= yyss + yystacksize - 1)
1038 {
1039 goto yyoverflow;
1040 }
1041 *++yyssp = yystate;
1042 *++yyvsp = yyval;
1043 goto yyloop;
1044 yyoverflow:
1045 yyerror("yacc stack overflow");
1046 yyabort:
1047 return (1);
1048 yyaccept:
1049 return (0);
1050 }