[10723] | 1 | Index: perly.c |
---|
| 2 | *************** |
---|
| 3 | *** 13,82 **** |
---|
| 4 | } |
---|
| 5 | |
---|
| 6 | ! #line 29 "perly.y" |
---|
| 7 | ! typedef union { |
---|
| 8 | ! I32 ival; |
---|
| 9 | ! char *pval; |
---|
| 10 | ! OP *opval; |
---|
| 11 | ! GV *gvval; |
---|
| 12 | ! } YYSTYPE; |
---|
| 13 | ! #line 23 "y.tab.c" |
---|
| 14 | ! #define WORD 257 |
---|
| 15 | ! #define METHOD 258 |
---|
| 16 | ! #define FUNCMETH 259 |
---|
| 17 | ! #define THING 260 |
---|
| 18 | ! #define PMFUNC 261 |
---|
| 19 | ! #define PRIVATEREF 262 |
---|
| 20 | ! #define FUNC0SUB 263 |
---|
| 21 | ! #define UNIOPSUB 264 |
---|
| 22 | ! #define LSTOPSUB 265 |
---|
| 23 | ! #define LABEL 266 |
---|
| 24 | ! #define FORMAT 267 |
---|
| 25 | ! #define SUB 268 |
---|
| 26 | ! #define ANONSUB 269 |
---|
| 27 | ! #define PACKAGE 270 |
---|
| 28 | ! #define USE 271 |
---|
| 29 | ! #define WHILE 272 |
---|
| 30 | ! #define UNTIL 273 |
---|
| 31 | ! #define IF 274 |
---|
| 32 | ! #define UNLESS 275 |
---|
| 33 | ! #define ELSE 276 |
---|
| 34 | ! #define ELSIF 277 |
---|
| 35 | ! #define CONTINUE 278 |
---|
| 36 | ! #define FOR 279 |
---|
| 37 | ! #define LOOPEX 280 |
---|
| 38 | ! #define DOTDOT 281 |
---|
| 39 | ! #define FUNC0 282 |
---|
| 40 | ! #define FUNC1 283 |
---|
| 41 | ! #define FUNC 284 |
---|
| 42 | ! #define UNIOP 285 |
---|
| 43 | ! #define LSTOP 286 |
---|
| 44 | ! #define RELOP 287 |
---|
| 45 | ! #define EQOP 288 |
---|
| 46 | ! #define MULOP 289 |
---|
| 47 | ! #define ADDOP 290 |
---|
| 48 | ! #define DOLSHARP 291 |
---|
| 49 | ! #define DO 292 |
---|
| 50 | ! #define HASHBRACK 293 |
---|
| 51 | ! #define NOAMP 294 |
---|
| 52 | ! #define LOCAL 295 |
---|
| 53 | ! #define MY 296 |
---|
| 54 | ! #define OROP 297 |
---|
| 55 | ! #define ANDOP 298 |
---|
| 56 | ! #define NOTOP 299 |
---|
| 57 | ! #define ASSIGNOP 300 |
---|
| 58 | ! #define OROR 301 |
---|
| 59 | ! #define ANDAND 302 |
---|
| 60 | ! #define BITOROP 303 |
---|
| 61 | ! #define BITANDOP 304 |
---|
| 62 | ! #define SHIFTOP 305 |
---|
| 63 | ! #define MATCHOP 306 |
---|
| 64 | ! #define UMINUS 307 |
---|
| 65 | ! #define REFGEN 308 |
---|
| 66 | ! #define POWOP 309 |
---|
| 67 | ! #define PREINC 310 |
---|
| 68 | ! #define PREDEC 311 |
---|
| 69 | ! #define POSTINC 312 |
---|
| 70 | ! #define POSTDEC 313 |
---|
| 71 | ! #define ARROW 314 |
---|
| 72 | #define YYERRCODE 256 |
---|
| 73 | short yylhs[] = { -1, |
---|
| 74 | --- 13,17 ---- |
---|
| 75 | } |
---|
| 76 | |
---|
| 77 | ! #line 16 "perly.c" |
---|
| 78 | #define YYERRCODE 256 |
---|
| 79 | short yylhs[] = { -1, |
---|
| 80 | *************** |
---|
| 81 | *** 1348,1358 **** |
---|
| 82 | int yyerrflag; |
---|
| 83 | int yychar; |
---|
| 84 | - short *yyssp; |
---|
| 85 | - YYSTYPE *yyvsp; |
---|
| 86 | YYSTYPE yyval; |
---|
| 87 | YYSTYPE yylval; |
---|
| 88 | - short yyss[YYSTACKSIZE]; |
---|
| 89 | - YYSTYPE yyvs[YYSTACKSIZE]; |
---|
| 90 | - #define yystacksize YYSTACKSIZE |
---|
| 91 | #line 631 "perly.y" |
---|
| 92 | /* PROGRAM */ |
---|
| 93 | --- 1283,1288 ---- |
---|
| 94 | *************** |
---|
| 95 | *** 1361,1372 **** |
---|
| 96 | --- 1291,1347 ---- |
---|
| 97 | #define YYACCEPT goto yyaccept |
---|
| 98 | #define YYERROR goto yyerrlab |
---|
| 99 | + |
---|
| 100 | + struct ysv { |
---|
| 101 | + short* yyss; |
---|
| 102 | + YYSTYPE* yyvs; |
---|
| 103 | + int oldyydebug; |
---|
| 104 | + int oldyynerrs; |
---|
| 105 | + int oldyyerrflag; |
---|
| 106 | + int oldyychar; |
---|
| 107 | + YYSTYPE oldyyval; |
---|
| 108 | + YYSTYPE oldyylval; |
---|
| 109 | + }; |
---|
| 110 | + |
---|
| 111 | + void |
---|
| 112 | + yydestruct(ptr) |
---|
| 113 | + void* ptr; |
---|
| 114 | + { |
---|
| 115 | + struct ysv* ysave = (struct ysv*)ptr; |
---|
| 116 | + if (ysave->yyss) Safefree(ysave->yyss); |
---|
| 117 | + if (ysave->yyvs) Safefree(ysave->yyvs); |
---|
| 118 | + yydebug = ysave->oldyydebug; |
---|
| 119 | + yynerrs = ysave->oldyynerrs; |
---|
| 120 | + yyerrflag = ysave->oldyyerrflag; |
---|
| 121 | + yychar = ysave->oldyychar; |
---|
| 122 | + yyval = ysave->oldyyval; |
---|
| 123 | + yylval = ysave->oldyylval; |
---|
| 124 | + Safefree(ysave); |
---|
| 125 | + } |
---|
| 126 | + |
---|
| 127 | int |
---|
| 128 | yyparse() |
---|
| 129 | { |
---|
| 130 | register int yym, yyn, yystate; |
---|
| 131 | + register short *yyssp; |
---|
| 132 | + register YYSTYPE *yyvsp; |
---|
| 133 | + short* yyss; |
---|
| 134 | + YYSTYPE* yyvs; |
---|
| 135 | + unsigned yystacksize = YYSTACKSIZE; |
---|
| 136 | + int retval = 0; |
---|
| 137 | #if YYDEBUG |
---|
| 138 | register char *yys; |
---|
| 139 | extern char *getenv(); |
---|
| 140 | + #endif |
---|
| 141 | + |
---|
| 142 | + struct ysv *ysave = (struct ysv*)safemalloc(sizeof(struct ysv)); |
---|
| 143 | + SAVEDESTRUCTOR(yydestruct, ysave); |
---|
| 144 | + ysave->oldyydebug = yydebug; |
---|
| 145 | + ysave->oldyynerrs = yynerrs; |
---|
| 146 | + ysave->oldyyerrflag = yyerrflag; |
---|
| 147 | + ysave->oldyychar = yychar; |
---|
| 148 | + ysave->oldyyval = yyval; |
---|
| 149 | + ysave->oldyylval = yylval; |
---|
| 150 | |
---|
| 151 | + #if YYDEBUG |
---|
| 152 | if (yys = getenv("YYDEBUG")) |
---|
| 153 | { |
---|
| 154 | *************** |
---|
| 155 | *** 1381,1384 **** |
---|
| 156 | --- 1356,1367 ---- |
---|
| 157 | yychar = (-1); |
---|
| 158 | |
---|
| 159 | + /* |
---|
| 160 | + ** Initialize private stacks (yyparse may be called from an action) |
---|
| 161 | + */ |
---|
| 162 | + ysave->yyss = yyss = (short*)safemalloc(yystacksize*sizeof(short)); |
---|
| 163 | + ysave->yyvs = yyvs = (YYSTYPE*)safemalloc(yystacksize*sizeof(YYSTYPE)); |
---|
| 164 | + if (!yyvs || !yyss) |
---|
| 165 | + goto yyoverflow; |
---|
| 166 | + |
---|
| 167 | yyssp = yyss; |
---|
| 168 | yyvsp = yyvs; |
---|
| 169 | *************** |
---|
| 170 | *** 1396,1400 **** |
---|
| 171 | if (yychar <= YYMAXTOKEN) yys = yyname[yychar]; |
---|
| 172 | if (!yys) yys = "illegal-symbol"; |
---|
| 173 | ! printf("yydebug: state %d, reading %d (%s)\n", yystate, |
---|
| 174 | yychar, yys); |
---|
| 175 | } |
---|
| 176 | --- 1379,1383 ---- |
---|
| 177 | if (yychar <= YYMAXTOKEN) yys = yyname[yychar]; |
---|
| 178 | if (!yys) yys = "illegal-symbol"; |
---|
| 179 | ! fprintf(stderr, "yydebug: state %d, reading %d (%s)\n", yystate, |
---|
| 180 | yychar, yys); |
---|
| 181 | } |
---|
| 182 | *************** |
---|
| 183 | *** 1406,1415 **** |
---|
| 184 | #if YYDEBUG |
---|
| 185 | if (yydebug) |
---|
| 186 | ! printf("yydebug: state %d, shifting to state %d\n", |
---|
| 187 | yystate, yytable[yyn]); |
---|
| 188 | #endif |
---|
| 189 | if (yyssp >= yyss + yystacksize - 1) |
---|
| 190 | { |
---|
| 191 | ! goto yyoverflow; |
---|
| 192 | } |
---|
| 193 | *++yyssp = yystate = yytable[yyn]; |
---|
| 194 | --- 1389,1412 ---- |
---|
| 195 | #if YYDEBUG |
---|
| 196 | if (yydebug) |
---|
| 197 | ! fprintf(stderr, "yydebug: state %d, shifting to state %d\n", |
---|
| 198 | yystate, yytable[yyn]); |
---|
| 199 | #endif |
---|
| 200 | if (yyssp >= yyss + yystacksize - 1) |
---|
| 201 | { |
---|
| 202 | ! /* |
---|
| 203 | ! ** reallocate and recover. Note that pointers |
---|
| 204 | ! ** have to be reset, or bad things will happen |
---|
| 205 | ! */ |
---|
| 206 | ! int yyps_index = (yyssp - yyss); |
---|
| 207 | ! int yypv_index = (yyvsp - yyvs); |
---|
| 208 | ! yystacksize += YYSTACKSIZE; |
---|
| 209 | ! ysave->yyvs = yyvs = |
---|
| 210 | ! (YYSTYPE*)realloc((char*)yyvs,yystacksize * sizeof(YYSTYPE)); |
---|
| 211 | ! ysave->yyss = yyss = |
---|
| 212 | ! (short*)realloc((char*)yyss,yystacksize * sizeof(short)); |
---|
| 213 | ! if (!yyvs || !yyss) |
---|
| 214 | ! goto yyoverflow; |
---|
| 215 | ! yyssp = yyss + yyps_index; |
---|
| 216 | ! yyvsp = yyvs + yypv_index; |
---|
| 217 | } |
---|
| 218 | *++yyssp = yystate = yytable[yyn]; |
---|
| 219 | *************** |
---|
| 220 | *** 1447,1456 **** |
---|
| 221 | #if YYDEBUG |
---|
| 222 | if (yydebug) |
---|
| 223 | ! printf("yydebug: state %d, error recovery shifting\ |
---|
| 224 | ! to state %d\n", *yyssp, yytable[yyn]); |
---|
| 225 | #endif |
---|
| 226 | if (yyssp >= yyss + yystacksize - 1) |
---|
| 227 | { |
---|
| 228 | ! goto yyoverflow; |
---|
| 229 | } |
---|
| 230 | *++yyssp = yystate = yytable[yyn]; |
---|
| 231 | --- 1444,1468 ---- |
---|
| 232 | #if YYDEBUG |
---|
| 233 | if (yydebug) |
---|
| 234 | ! fprintf(stderr, |
---|
| 235 | ! "yydebug: state %d, error recovery shifting to state %d\n", |
---|
| 236 | ! *yyssp, yytable[yyn]); |
---|
| 237 | #endif |
---|
| 238 | if (yyssp >= yyss + yystacksize - 1) |
---|
| 239 | { |
---|
| 240 | ! /* |
---|
| 241 | ! ** reallocate and recover. Note that pointers |
---|
| 242 | ! ** have to be reset, or bad things will happen |
---|
| 243 | ! */ |
---|
| 244 | ! int yyps_index = (yyssp - yyss); |
---|
| 245 | ! int yypv_index = (yyvsp - yyvs); |
---|
| 246 | ! yystacksize += YYSTACKSIZE; |
---|
| 247 | ! ysave->yyvs = yyvs = (YYSTYPE*)realloc((char*)yyvs, |
---|
| 248 | ! yystacksize * sizeof(YYSTYPE)); |
---|
| 249 | ! ysave->yyss = yyss = (short*)realloc((char*)yyss, |
---|
| 250 | ! yystacksize * sizeof(short)); |
---|
| 251 | ! if (!yyvs || !yyss) |
---|
| 252 | ! goto yyoverflow; |
---|
| 253 | ! yyssp = yyss + yyps_index; |
---|
| 254 | ! yyvsp = yyvs + yypv_index; |
---|
| 255 | } |
---|
| 256 | *++yyssp = yystate = yytable[yyn]; |
---|
| 257 | *************** |
---|
| 258 | *** 1462,1467 **** |
---|
| 259 | #if YYDEBUG |
---|
| 260 | if (yydebug) |
---|
| 261 | ! printf("yydebug: error recovery discarding state %d\n", |
---|
| 262 | ! *yyssp); |
---|
| 263 | #endif |
---|
| 264 | if (yyssp <= yyss) goto yyabort; |
---|
| 265 | --- 1474,1480 ---- |
---|
| 266 | #if YYDEBUG |
---|
| 267 | if (yydebug) |
---|
| 268 | ! fprintf(stderr, |
---|
| 269 | ! "yydebug: error recovery discarding state %d\n", |
---|
| 270 | ! *yyssp); |
---|
| 271 | #endif |
---|
| 272 | if (yyssp <= yyss) goto yyabort; |
---|
| 273 | *************** |
---|
| 274 | *** 1480,1485 **** |
---|
| 275 | if (yychar <= YYMAXTOKEN) yys = yyname[yychar]; |
---|
| 276 | if (!yys) yys = "illegal-symbol"; |
---|
| 277 | ! printf("yydebug: state %d, error recovery discards token %d (%s)\n", |
---|
| 278 | ! yystate, yychar, yys); |
---|
| 279 | } |
---|
| 280 | #endif |
---|
| 281 | --- 1493,1499 ---- |
---|
| 282 | if (yychar <= YYMAXTOKEN) yys = yyname[yychar]; |
---|
| 283 | if (!yys) yys = "illegal-symbol"; |
---|
| 284 | ! fprintf(stderr, |
---|
| 285 | ! "yydebug: state %d, error recovery discards token %d (%s)\n", |
---|
| 286 | ! yystate, yychar, yys); |
---|
| 287 | } |
---|
| 288 | #endif |
---|
| 289 | *************** |
---|
| 290 | *** 1490,1494 **** |
---|
| 291 | #if YYDEBUG |
---|
| 292 | if (yydebug) |
---|
| 293 | ! printf("yydebug: state %d, reducing by rule %d (%s)\n", |
---|
| 294 | yystate, yyn, yyrule[yyn]); |
---|
| 295 | #endif |
---|
| 296 | --- 1504,1508 ---- |
---|
| 297 | #if YYDEBUG |
---|
| 298 | if (yydebug) |
---|
| 299 | ! fprintf(stderr, "yydebug: state %d, reducing by rule %d (%s)\n", |
---|
| 300 | yystate, yyn, yyrule[yyn]); |
---|
| 301 | #endif |
---|
| 302 | *************** |
---|
| 303 | *** 2278,2283 **** |
---|
| 304 | #if YYDEBUG |
---|
| 305 | if (yydebug) |
---|
| 306 | ! printf("yydebug: after reduction, shifting from state 0 to\ |
---|
| 307 | ! state %d\n", YYFINAL); |
---|
| 308 | #endif |
---|
| 309 | yystate = YYFINAL; |
---|
| 310 | --- 2292,2298 ---- |
---|
| 311 | #if YYDEBUG |
---|
| 312 | if (yydebug) |
---|
| 313 | ! fprintf(stderr, |
---|
| 314 | ! "yydebug: after reduction, shifting from state 0 to state %d\n", |
---|
| 315 | ! YYFINAL); |
---|
| 316 | #endif |
---|
| 317 | yystate = YYFINAL; |
---|
| 318 | *************** |
---|
| 319 | *** 2293,2297 **** |
---|
| 320 | if (yychar <= YYMAXTOKEN) yys = yyname[yychar]; |
---|
| 321 | if (!yys) yys = "illegal-symbol"; |
---|
| 322 | ! printf("yydebug: state %d, reading %d (%s)\n", |
---|
| 323 | YYFINAL, yychar, yys); |
---|
| 324 | } |
---|
| 325 | --- 2308,2312 ---- |
---|
| 326 | if (yychar <= YYMAXTOKEN) yys = yyname[yychar]; |
---|
| 327 | if (!yys) yys = "illegal-symbol"; |
---|
| 328 | ! fprintf(stderr, "yydebug: state %d, reading %d (%s)\n", |
---|
| 329 | YYFINAL, yychar, yys); |
---|
| 330 | } |
---|
| 331 | *************** |
---|
| 332 | *** 2308,2317 **** |
---|
| 333 | #if YYDEBUG |
---|
| 334 | if (yydebug) |
---|
| 335 | ! printf("yydebug: after reduction, shifting from state %d \ |
---|
| 336 | ! to state %d\n", *yyssp, yystate); |
---|
| 337 | #endif |
---|
| 338 | if (yyssp >= yyss + yystacksize - 1) |
---|
| 339 | { |
---|
| 340 | ! goto yyoverflow; |
---|
| 341 | } |
---|
| 342 | *++yyssp = yystate; |
---|
| 343 | --- 2323,2347 ---- |
---|
| 344 | #if YYDEBUG |
---|
| 345 | if (yydebug) |
---|
| 346 | ! fprintf(stderr, |
---|
| 347 | ! "yydebug: after reduction, shifting from state %d to state %d\n", |
---|
| 348 | ! *yyssp, yystate); |
---|
| 349 | #endif |
---|
| 350 | if (yyssp >= yyss + yystacksize - 1) |
---|
| 351 | { |
---|
| 352 | ! /* |
---|
| 353 | ! ** reallocate and recover. Note that pointers |
---|
| 354 | ! ** have to be reset, or bad things will happen |
---|
| 355 | ! */ |
---|
| 356 | ! int yyps_index = (yyssp - yyss); |
---|
| 357 | ! int yypv_index = (yyvsp - yyvs); |
---|
| 358 | ! yystacksize += YYSTACKSIZE; |
---|
| 359 | ! ysave->yyvs = yyvs = |
---|
| 360 | ! (YYSTYPE*)realloc((char*)yyvs,yystacksize * sizeof(YYSTYPE)); |
---|
| 361 | ! ysave->yyss = yyss = |
---|
| 362 | ! (short*)realloc((char*)yyss,yystacksize * sizeof(short)); |
---|
| 363 | ! if (!yyvs || !yyss) |
---|
| 364 | ! goto yyoverflow; |
---|
| 365 | ! yyssp = yyss + yyps_index; |
---|
| 366 | ! yyvsp = yyvs + yypv_index; |
---|
| 367 | } |
---|
| 368 | *++yyssp = yystate; |
---|
| 369 | *************** |
---|
| 370 | *** 2319,2326 **** |
---|
| 371 | goto yyloop; |
---|
| 372 | yyoverflow: |
---|
| 373 | ! yyerror("yacc stack overflow"); |
---|
| 374 | yyabort: |
---|
| 375 | ! return (1); |
---|
| 376 | yyaccept: |
---|
| 377 | ! return (0); |
---|
| 378 | } |
---|
| 379 | --- 2349,2356 ---- |
---|
| 380 | goto yyloop; |
---|
| 381 | yyoverflow: |
---|
| 382 | ! yyerror("Out of memory for yacc stack"); |
---|
| 383 | yyabort: |
---|
| 384 | ! retval = 1; |
---|
| 385 | yyaccept: |
---|
| 386 | ! return retval; |
---|
| 387 | } |
---|