1 /* original parser id follows */ 2 /* yysccsid[] = "@(#)yaccpar 1.9 (Berkeley) 02/21/93" */ 3 /* (use YYMAJOR/YYMINOR for ifdefs dependent on parser version) */ 4 5 #define YYBYACC 1 6 #define YYMAJOR 1 7 #define YYMINOR 9 8 #define YYCHECK "yyyymmdd" 9 10 #define YYEMPTY (-1) 11 #define yyclearin (yychar = YYEMPTY) 12 #define yyerrok (yyerrflag = 0) 13 #define YYRECOVERING() (yyerrflag != 0) 14 #define YYENOMEM (-2) 15 #define YYEOF 0 16 17 #ifndef yyparse 18 #define yyparse quote_calc_parse 19 #endif /* yyparse */ 20 21 #ifndef yylex 22 #define yylex quote_calc_lex 23 #endif /* yylex */ 24 25 #ifndef yyerror 26 #define yyerror quote_calc_error 27 #endif /* yyerror */ 28 29 #ifndef yychar 30 #define yychar quote_calc_char 31 #endif /* yychar */ 32 33 #ifndef yyval 34 #define yyval quote_calc_val 35 #endif /* yyval */ 36 37 #ifndef yylval 38 #define yylval quote_calc_lval 39 #endif /* yylval */ 40 41 #ifndef yydebug 42 #define yydebug quote_calc_debug 43 #endif /* yydebug */ 44 45 #ifndef yynerrs 46 #define yynerrs quote_calc_nerrs 47 #endif /* yynerrs */ 48 49 #ifndef yyerrflag 50 #define yyerrflag quote_calc_errflag 51 #endif /* yyerrflag */ 52 53 #ifndef yylhs 54 #define yylhs quote_calc_lhs 55 #endif /* yylhs */ 56 57 #ifndef yylen 58 #define yylen quote_calc_len 59 #endif /* yylen */ 60 61 #ifndef yydefred 62 #define yydefred quote_calc_defred 63 #endif /* yydefred */ 64 65 #ifndef yydgoto 66 #define yydgoto quote_calc_dgoto 67 #endif /* yydgoto */ 68 69 #ifndef yysindex 70 #define yysindex quote_calc_sindex 71 #endif /* yysindex */ 72 73 #ifndef yyrindex 74 #define yyrindex quote_calc_rindex 75 #endif /* yyrindex */ 76 77 #ifndef yygindex 78 #define yygindex quote_calc_gindex 79 #endif /* yygindex */ 80 81 #ifndef yytable 82 #define yytable quote_calc_table 83 #endif /* yytable */ 84 85 #ifndef yycheck 86 #define yycheck quote_calc_check 87 #endif /* yycheck */ 88 89 #ifndef yyname 90 #define yyname quote_calc_name 91 #endif /* yyname */ 92 93 #ifndef yyrule 94 #define yyrule quote_calc_rule 95 #endif /* yyrule */ 96 #define YYPREFIX "quote_calc_" 97 98 #define YYPURE 0 99 100 #line 2 "quote_calc.y" 101 # include <stdio.h> 102 # include <ctype.h> 103 104 int regs[26]; 105 int base; 106 107 int yylex(void); 108 static void yyerror(const char *s); 109 110 #line 111 "quote_calc.tab.c" 111 112 #if ! defined(YYSTYPE) && ! defined(YYSTYPE_IS_DECLARED) 113 /* Default: YYSTYPE is the semantic value type. */ 114 typedef int YYSTYPE; 115 # define YYSTYPE_IS_DECLARED 1 116 #endif 117 118 /* compatibility with bison */ 119 #ifdef YYPARSE_PARAM 120 /* compatibility with FreeBSD */ 121 # ifdef YYPARSE_PARAM_TYPE 122 # define YYPARSE_DECL() yyparse(YYPARSE_PARAM_TYPE YYPARSE_PARAM) 123 # else 124 # define YYPARSE_DECL() yyparse(void *YYPARSE_PARAM) 125 # endif 126 #else 127 # define YYPARSE_DECL() yyparse(void) 128 #endif 129 130 /* Parameters sent to lex. */ 131 #ifdef YYLEX_PARAM 132 # define YYLEX_DECL() yylex(void *YYLEX_PARAM) 133 # define YYLEX yylex(YYLEX_PARAM) 134 #else 135 # define YYLEX_DECL() yylex(void) 136 # define YYLEX yylex() 137 #endif 138 139 /* Parameters sent to yyerror. */ 140 #ifndef YYERROR_DECL 141 #define YYERROR_DECL() yyerror(const char *s) 142 #endif 143 #ifndef YYERROR_CALL 144 #define YYERROR_CALL(msg) yyerror(msg) 145 #endif 146 147 extern int YYPARSE_DECL(); 148 149 #define OP_ADD 257 150 #define ADD 258 151 #define OP_SUB 259 152 #define SUB 260 153 #define OP_MUL 261 154 #define MUL 262 155 #define OP_DIV 263 156 #define DIV 264 157 #define OP_MOD 265 158 #define MOD 266 159 #define OP_AND 267 160 #define AND 268 161 #define DIGIT 269 162 #define LETTER 270 163 #define UMINUS 271 164 #define YYERRCODE 256 165 typedef int YYINT; 166 static const YYINT quote_calc_lhs[] = { -1, 167 0, 0, 0, 1, 1, 2, 2, 2, 2, 2, 168 2, 2, 2, 2, 2, 2, 3, 3, 169 }; 170 static const YYINT quote_calc_len[] = { 2, 171 0, 3, 3, 1, 3, 3, 3, 3, 3, 3, 172 3, 3, 3, 2, 1, 1, 1, 2, 173 }; 174 static const YYINT quote_calc_defred[] = { 1, 175 0, 0, 0, 17, 0, 0, 0, 0, 0, 3, 176 15, 0, 0, 0, 2, 0, 0, 0, 0, 0, 177 0, 0, 18, 0, 6, 0, 0, 0, 0, 0, 178 0, 0, 179 }; 180 static const YYINT quote_calc_dgoto[] = { 1, 181 7, 8, 9, 182 }; 183 static const YYINT quote_calc_sindex[] = { 0, 184 -38, 5, -36, 0, -51, -36, 7, -121, -248, 0, 185 0, -243, -36, -22, 0, -36, -36, -36, -36, -36, 186 -36, -36, 0, -121, 0, -121, -121, -121, -121, -121, 187 -121, -243, 188 }; 189 static const YYINT quote_calc_rindex[] = { 0, 190 0, 0, 0, 0, -9, 0, 0, 13, -10, 0, 191 0, -5, 0, 0, 0, 0, 0, 0, 0, 0, 192 0, 0, 0, 15, 0, -3, -2, -1, 1, 2, 193 3, -4, 194 }; 195 static const YYINT quote_calc_gindex[] = { 0, 196 0, 42, 0, 197 }; 198 #define YYTABLESIZE 258 199 static const YYINT quote_calc_table[] = { 16, 200 15, 6, 22, 6, 14, 13, 7, 8, 9, 13, 201 10, 11, 12, 16, 10, 17, 15, 18, 25, 19, 202 23, 20, 4, 21, 5, 0, 0, 0, 0, 0, 203 16, 0, 0, 0, 0, 14, 13, 7, 8, 9, 204 0, 10, 11, 12, 12, 0, 0, 14, 0, 0, 205 0, 0, 0, 0, 24, 0, 0, 26, 27, 28, 206 29, 30, 31, 32, 0, 0, 0, 0, 0, 0, 207 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 208 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 209 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 210 0, 22, 0, 0, 0, 0, 0, 0, 0, 0, 211 0, 0, 0, 16, 15, 0, 0, 0, 14, 13, 212 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 213 0, 0, 0, 0, 0, 16, 0, 17, 0, 18, 214 0, 19, 0, 20, 0, 21, 0, 0, 0, 0, 215 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 216 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 217 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 218 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 219 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 220 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 221 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 222 3, 0, 3, 0, 0, 0, 0, 0, 0, 0, 223 4, 5, 4, 11, 16, 0, 17, 0, 18, 0, 224 19, 0, 20, 0, 21, 0, 16, 15, 16, 15, 225 16, 15, 16, 15, 16, 15, 16, 15, 226 }; 227 static const YYINT quote_calc_check[] = { 10, 228 10, 40, 124, 40, 10, 10, 10, 10, 10, 61, 229 10, 10, 10, 257, 10, 259, 10, 261, 41, 263, 230 269, 265, 10, 267, 10, -1, -1, -1, -1, -1, 231 41, -1, -1, -1, -1, 41, 41, 41, 41, 41, 232 -1, 41, 41, 41, 3, -1, -1, 6, -1, -1, 233 -1, -1, -1, -1, 13, -1, -1, 16, 17, 18, 234 19, 20, 21, 22, -1, -1, -1, -1, -1, -1, 235 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 236 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 237 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 238 -1, 124, -1, -1, -1, -1, -1, -1, -1, -1, 239 -1, -1, -1, 124, 124, -1, -1, -1, 124, 124, 240 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 241 -1, -1, -1, -1, -1, 257, -1, 259, -1, 261, 242 -1, 263, -1, 265, -1, 267, -1, -1, -1, -1, 243 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 244 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 245 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 246 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 247 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 248 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 249 -1, -1, -1, -1, -1, -1, -1, 256, -1, -1, 250 259, -1, 259, -1, -1, -1, -1, -1, -1, -1, 251 269, 270, 269, 270, 257, -1, 259, -1, 261, -1, 252 263, -1, 265, -1, 267, -1, 257, 257, 259, 259, 253 261, 261, 263, 263, 265, 265, 267, 267, 254 }; 255 #define YYFINAL 1 256 #ifndef YYDEBUG 257 #define YYDEBUG 0 258 #endif 259 #define YYMAXTOKEN 271 260 #define YYUNDFTOKEN 277 261 #define YYTRANSLATE(a) ((a) > YYMAXTOKEN ? YYUNDFTOKEN : (a)) 262 #if YYDEBUG 263 static const char *const quote_calc_name[] = { 264 265 "end-of-file",0,0,0,0,0,0,0,0,0,"'\\n'",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 266 0,0,0,0,0,0,"'%'","'&'",0,"'('","')'","'*'","'+'",0,"'-'",0,"'/'",0,0,0,0,0,0,0, 267 0,0,0,0,0,0,"'='",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 268 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,"'|'",0,0,0,0,0,0, 269 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 270 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 271 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 272 0,0,0,0,0,0,"OP_ADD","\"ADD\"","OP_SUB","\"SUB\"","OP_MUL","\"MUL\"","OP_DIV", 273 "\"DIV\"","OP_MOD","\"MOD\"","OP_AND","\"AND\"","DIGIT","LETTER","UMINUS",0,0,0, 274 0,0,"illegal-symbol", 275 }; 276 static const char *const quote_calc_rule[] = { 277 "$accept : list", 278 "list :", 279 "list : list stat '\\n'", 280 "list : list error '\\n'", 281 "stat : expr", 282 "stat : LETTER '=' expr", 283 "expr : '(' expr ')'", 284 "expr : expr OP_ADD expr", 285 "expr : expr OP_SUB expr", 286 "expr : expr OP_MUL expr", 287 "expr : expr OP_DIV expr", 288 "expr : expr OP_MOD expr", 289 "expr : expr OP_AND expr", 290 "expr : expr '|' expr", 291 "expr : OP_SUB expr", 292 "expr : LETTER", 293 "expr : number", 294 "number : DIGIT", 295 "number : number DIGIT", 296 297 }; 298 #endif 299 300 #if YYDEBUG 301 int yydebug; 302 #endif 303 304 int yyerrflag; 305 int yychar; 306 YYSTYPE yyval; 307 YYSTYPE yylval; 308 int yynerrs; 309 310 /* define the initial stack-sizes */ 311 #ifdef YYSTACKSIZE 312 #undef YYMAXDEPTH 313 #define YYMAXDEPTH YYSTACKSIZE 314 #else 315 #ifdef YYMAXDEPTH 316 #define YYSTACKSIZE YYMAXDEPTH 317 #else 318 #define YYSTACKSIZE 10000 319 #define YYMAXDEPTH 10000 320 #endif 321 #endif 322 323 #define YYINITSTACKSIZE 200 324 325 typedef struct { 326 unsigned stacksize; 327 YYINT *s_base; 328 YYINT *s_mark; 329 YYINT *s_last; 330 YYSTYPE *l_base; 331 YYSTYPE *l_mark; 332 } YYSTACKDATA; 333 /* variables for the parser stack */ 334 static YYSTACKDATA yystack; 335 #line 73 "quote_calc.y" 336 /* start of programs */ 337 338 int 339 main (void) 340 { 341 while(!feof(stdin)) { 342 yyparse(); 343 } 344 return 0; 345 } 346 347 static void 348 yyerror(const char *s) 349 { 350 fprintf(stderr, "%s\n", s); 351 } 352 353 int 354 yylex(void) { 355 /* lexical analysis routine */ 356 /* returns LETTER for a lower case letter, yylval = 0 through 25 */ 357 /* return DIGIT for a digit, yylval = 0 through 9 */ 358 /* all other characters are returned immediately */ 359 360 int c; 361 362 while( (c=getchar()) == ' ' ) { /* skip blanks */ } 363 364 /* c is now nonblank */ 365 366 if( islower( c )) { 367 yylval = c - 'a'; 368 return ( LETTER ); 369 } 370 if( isdigit( c )) { 371 yylval = c - '0'; 372 return ( DIGIT ); 373 } 374 return( c ); 375 } 376 #line 377 "quote_calc.tab.c" 377 378 #if YYDEBUG 379 #include <stdio.h> /* needed for printf */ 380 #endif 381 382 #include <stdlib.h> /* needed for malloc, etc */ 383 #include <string.h> /* needed for memset */ 384 385 /* allocate initial stack or double stack size, up to YYMAXDEPTH */ 386 static int yygrowstack(YYSTACKDATA *data) 387 { 388 int i; 389 unsigned newsize; 390 YYINT *newss; 391 YYSTYPE *newvs; 392 393 if ((newsize = data->stacksize) == 0) 394 newsize = YYINITSTACKSIZE; 395 else if (newsize >= YYMAXDEPTH) 396 return YYENOMEM; 397 else if ((newsize *= 2) > YYMAXDEPTH) 398 newsize = YYMAXDEPTH; 399 400 i = (int) (data->s_mark - data->s_base); 401 newss = (YYINT *)realloc(data->s_base, newsize * sizeof(*newss)); 402 if (newss == NULL) 403 return YYENOMEM; 404 405 data->s_base = newss; 406 data->s_mark = newss + i; 407 408 newvs = (YYSTYPE *)realloc(data->l_base, newsize * sizeof(*newvs)); 409 if (newvs == NULL) 410 return YYENOMEM; 411 412 data->l_base = newvs; 413 data->l_mark = newvs + i; 414 415 data->stacksize = newsize; 416 data->s_last = data->s_base + newsize - 1; 417 return 0; 418 } 419 420 #if YYPURE || defined(YY_NO_LEAKS) 421 static void yyfreestack(YYSTACKDATA *data) 422 { 423 free(data->s_base); 424 free(data->l_base); 425 memset(data, 0, sizeof(*data)); 426 } 427 #else 428 #define yyfreestack(data) /* nothing */ 429 #endif 430 431 #define YYABORT goto yyabort 432 #define YYREJECT goto yyabort 433 #define YYACCEPT goto yyaccept 434 #define YYERROR goto yyerrlab 435 436 int 437 YYPARSE_DECL() 438 { 439 int yym, yyn, yystate; 440 #if YYDEBUG 441 const char *yys; 442 443 if ((yys = getenv("YYDEBUG")) != NULL) 444 { 445 yyn = *yys; 446 if (yyn >= '0' && yyn <= '9') 447 yydebug = yyn - '0'; 448 } 449 #endif 450 451 yym = 0; 452 yyn = 0; 453 yynerrs = 0; 454 yyerrflag = 0; 455 yychar = YYEMPTY; 456 yystate = 0; 457 458 #if YYPURE 459 memset(&yystack, 0, sizeof(yystack)); 460 #endif 461 462 if (yystack.s_base == NULL && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow; 463 yystack.s_mark = yystack.s_base; 464 yystack.l_mark = yystack.l_base; 465 yystate = 0; 466 *yystack.s_mark = 0; 467 468 yyloop: 469 if ((yyn = yydefred[yystate]) != 0) goto yyreduce; 470 if (yychar < 0) 471 { 472 yychar = YYLEX; 473 if (yychar < 0) yychar = YYEOF; 474 #if YYDEBUG 475 if (yydebug) 476 { 477 if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN]; 478 printf("%sdebug: state %d, reading %d (%s)\n", 479 YYPREFIX, yystate, yychar, yys); 480 } 481 #endif 482 } 483 if (((yyn = yysindex[yystate]) != 0) && (yyn += yychar) >= 0 && 484 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar) 485 { 486 #if YYDEBUG 487 if (yydebug) 488 printf("%sdebug: state %d, shifting to state %d\n", 489 YYPREFIX, yystate, yytable[yyn]); 490 #endif 491 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow; 492 yystate = yytable[yyn]; 493 *++yystack.s_mark = yytable[yyn]; 494 *++yystack.l_mark = yylval; 495 yychar = YYEMPTY; 496 if (yyerrflag > 0) --yyerrflag; 497 goto yyloop; 498 } 499 if (((yyn = yyrindex[yystate]) != 0) && (yyn += yychar) >= 0 && 500 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar) 501 { 502 yyn = yytable[yyn]; 503 goto yyreduce; 504 } 505 if (yyerrflag != 0) goto yyinrecovery; 506 507 YYERROR_CALL("syntax error"); 508 509 goto yyerrlab; /* redundant goto avoids 'unused label' warning */ 510 yyerrlab: 511 ++yynerrs; 512 513 yyinrecovery: 514 if (yyerrflag < 3) 515 { 516 yyerrflag = 3; 517 for (;;) 518 { 519 if (((yyn = yysindex[*yystack.s_mark]) != 0) && (yyn += YYERRCODE) >= 0 && 520 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) YYERRCODE) 521 { 522 #if YYDEBUG 523 if (yydebug) 524 printf("%sdebug: state %d, error recovery shifting\ 525 to state %d\n", YYPREFIX, *yystack.s_mark, yytable[yyn]); 526 #endif 527 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow; 528 yystate = yytable[yyn]; 529 *++yystack.s_mark = yytable[yyn]; 530 *++yystack.l_mark = yylval; 531 goto yyloop; 532 } 533 else 534 { 535 #if YYDEBUG 536 if (yydebug) 537 printf("%sdebug: error recovery discarding state %d\n", 538 YYPREFIX, *yystack.s_mark); 539 #endif 540 if (yystack.s_mark <= yystack.s_base) goto yyabort; 541 --yystack.s_mark; 542 --yystack.l_mark; 543 } 544 } 545 } 546 else 547 { 548 if (yychar == YYEOF) goto yyabort; 549 #if YYDEBUG 550 if (yydebug) 551 { 552 if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN]; 553 printf("%sdebug: state %d, error recovery discards token %d (%s)\n", 554 YYPREFIX, yystate, yychar, yys); 555 } 556 #endif 557 yychar = YYEMPTY; 558 goto yyloop; 559 } 560 561 yyreduce: 562 #if YYDEBUG 563 if (yydebug) 564 printf("%sdebug: state %d, reducing by rule %d (%s)\n", 565 YYPREFIX, yystate, yyn, yyrule[yyn]); 566 #endif 567 yym = yylen[yyn]; 568 if (yym > 0) 569 yyval = yystack.l_mark[1-yym]; 570 else 571 memset(&yyval, 0, sizeof yyval); 572 573 switch (yyn) 574 { 575 case 3: 576 #line 35 "quote_calc.y" 577 { yyerrok ; } 578 break; 579 case 4: 580 #line 39 "quote_calc.y" 581 { printf("%d\n",yystack.l_mark[0]);} 582 break; 583 case 5: 584 #line 41 "quote_calc.y" 585 { regs[yystack.l_mark[-2]] = yystack.l_mark[0]; } 586 break; 587 case 6: 588 #line 45 "quote_calc.y" 589 { yyval = yystack.l_mark[-1]; } 590 break; 591 case 7: 592 #line 47 "quote_calc.y" 593 { yyval = yystack.l_mark[-2] + yystack.l_mark[0]; } 594 break; 595 case 8: 596 #line 49 "quote_calc.y" 597 { yyval = yystack.l_mark[-2] - yystack.l_mark[0]; } 598 break; 599 case 9: 600 #line 51 "quote_calc.y" 601 { yyval = yystack.l_mark[-2] * yystack.l_mark[0]; } 602 break; 603 case 10: 604 #line 53 "quote_calc.y" 605 { yyval = yystack.l_mark[-2] / yystack.l_mark[0]; } 606 break; 607 case 11: 608 #line 55 "quote_calc.y" 609 { yyval = yystack.l_mark[-2] % yystack.l_mark[0]; } 610 break; 611 case 12: 612 #line 57 "quote_calc.y" 613 { yyval = yystack.l_mark[-2] & yystack.l_mark[0]; } 614 break; 615 case 13: 616 #line 59 "quote_calc.y" 617 { yyval = yystack.l_mark[-2] | yystack.l_mark[0]; } 618 break; 619 case 14: 620 #line 61 "quote_calc.y" 621 { yyval = - yystack.l_mark[0]; } 622 break; 623 case 15: 624 #line 63 "quote_calc.y" 625 { yyval = regs[yystack.l_mark[0]]; } 626 break; 627 case 17: 628 #line 68 "quote_calc.y" 629 { yyval = yystack.l_mark[0]; base = (yystack.l_mark[0]==0) ? 8 : 10; } 630 break; 631 case 18: 632 #line 70 "quote_calc.y" 633 { yyval = base * yystack.l_mark[-1] + yystack.l_mark[0]; } 634 break; 635 #line 636 "quote_calc.tab.c" 636 } 637 yystack.s_mark -= yym; 638 yystate = *yystack.s_mark; 639 yystack.l_mark -= yym; 640 yym = yylhs[yyn]; 641 if (yystate == 0 && yym == 0) 642 { 643 #if YYDEBUG 644 if (yydebug) 645 printf("%sdebug: after reduction, shifting from state 0 to\ 646 state %d\n", YYPREFIX, YYFINAL); 647 #endif 648 yystate = YYFINAL; 649 *++yystack.s_mark = YYFINAL; 650 *++yystack.l_mark = yyval; 651 if (yychar < 0) 652 { 653 yychar = YYLEX; 654 if (yychar < 0) yychar = YYEOF; 655 #if YYDEBUG 656 if (yydebug) 657 { 658 if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN]; 659 printf("%sdebug: state %d, reading %d (%s)\n", 660 YYPREFIX, YYFINAL, yychar, yys); 661 } 662 #endif 663 } 664 if (yychar == YYEOF) goto yyaccept; 665 goto yyloop; 666 } 667 if (((yyn = yygindex[yym]) != 0) && (yyn += yystate) >= 0 && 668 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yystate) 669 yystate = yytable[yyn]; 670 else 671 yystate = yydgoto[yym]; 672 #if YYDEBUG 673 if (yydebug) 674 printf("%sdebug: after reduction, shifting from state %d \ 675 to state %d\n", YYPREFIX, *yystack.s_mark, yystate); 676 #endif 677 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow; 678 *++yystack.s_mark = (YYINT) yystate; 679 *++yystack.l_mark = yyval; 680 goto yyloop; 681 682 yyoverflow: 683 YYERROR_CALL("yacc stack overflow"); 684 685 yyabort: 686 yyfreestack(&yystack); 687 return (1); 688 689 yyaccept: 690 yyfreestack(&yystack); 691 return (0); 692 } 693