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