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