1 2 # line 2 "../common/m4y.y" 3 /* 4 * CDDL HEADER START 5 * 6 * The contents of this file are subject to the terms of the 7 * Common Development and Distribution License, Version 1.0 only 8 * (the "License"). You may not use this file except in compliance 9 * with the License. 10 * 11 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 12 * or http://www.opensolaris.org/os/licensing. 13 * See the License for the specific language governing permissions 14 * and limitations under the License. 15 * 16 * When distributing Covered Code, include this CDDL HEADER in each 17 * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 18 * If applicable, add the following below this CDDL HEADER, with the 19 * fields enclosed by brackets "[]" replaced with your own identifying 20 * information: Portions Copyright [yyyy] [name of copyright owner] 21 * 22 * CDDL HEADER END 23 */ 24 25 # line 34 "../common/m4y.y" 26 #pragma ident "%Z%%M% %I% %E% SMI" 27 extern long evalval; 28 #define YYSTYPE long 29 # define DIGITS 257 30 # define OROR 258 31 # define ANDAND 259 32 # define GT 260 33 # define GE 261 34 # define LT 262 35 # define LE 263 36 # define NE 264 37 # define EQ 265 38 # define POWER 266 39 # define UMINUS 267 40 41 #include <inttypes.h> 42 43 #ifdef __STDC__ 44 #include <stdlib.h> 45 #include <string.h> 46 #define YYCONST const 47 #else 48 #include <malloc.h> 49 #include <memory.h> 50 #define YYCONST 51 #endif 52 53 #include <values.h> 54 55 #if defined(__cplusplus) || defined(__STDC__) 56 57 #if defined(__cplusplus) && defined(__EXTERN_C__) 58 extern "C" { 59 #endif 60 #ifndef yyerror 61 #if defined(__cplusplus) 62 void yyerror(YYCONST char *); 63 #endif 64 #endif 65 #ifndef yylex 66 int yylex(void); 67 #endif 68 int yyparse(void); 69 #if defined(__cplusplus) && defined(__EXTERN_C__) 70 } 71 #endif 72 73 #endif 74 75 #define yyclearin yychar = -1 76 #define yyerrok yyerrflag = 0 77 extern int yychar; 78 extern int yyerrflag; 79 #ifndef YYSTYPE 80 #define YYSTYPE int 81 #endif 82 YYSTYPE yylval; 83 YYSTYPE yyval; 84 typedef int yytabelem; 85 #ifndef YYMAXDEPTH 86 #define YYMAXDEPTH 150 87 #endif 88 #if YYMAXDEPTH > 0 89 int yy_yys[YYMAXDEPTH], *yys = yy_yys; 90 YYSTYPE yy_yyv[YYMAXDEPTH], *yyv = yy_yyv; 91 #else /* user does initial allocation */ 92 int *yys; 93 YYSTYPE *yyv; 94 #endif 95 static int yymaxdepth = YYMAXDEPTH; 96 # define YYERRCODE 256 97 98 # line 81 "../common/m4y.y" 99 100 101 #include "m4.h" 102 extern wchar_t *pe; 103 static int peek(int c, int r1, int r2); 104 105 int 106 yylex(void) 107 { 108 while (*pe == ' ' || *pe == '\t' || *pe == '\n') 109 pe++; 110 switch (*pe) { 111 case '\0': 112 case '+': 113 case '-': 114 case '/': 115 case '%': 116 case '^': 117 case '~': 118 case '(': 119 case ')': 120 return (*pe++); 121 case '*': 122 return (peek('*', POWER, '*')); 123 case '>': 124 return (peek('=', GE, GT)); 125 case '<': 126 return (peek('=', LE, LT)); 127 case '=': 128 return (peek('=', EQ, EQ)); 129 case '|': 130 return (peek('|', OROR, '|')); 131 case '&': 132 return (peek('&', ANDAND, '&')); 133 case '!': 134 return (peek('=', NE, '!')); 135 default: { 136 int base; 137 138 evalval = 0; 139 140 if (*pe == '0') { 141 if (*++pe == 'x' || *pe == 'X') { 142 base = 16; 143 ++pe; 144 } else 145 base = 8; 146 } else 147 base = 10; 148 149 for (;;) { 150 int c, dig; 151 152 c = *pe; 153 154 if (is_digit(c)) 155 dig = c - '0'; 156 else if (c >= 'a' && c <= 'f') 157 dig = c - 'a' + 10; 158 else if (c >= 'A' && c <= 'F') 159 dig = c - 'A' + 10; 160 else 161 break; 162 163 evalval = evalval*base + dig; 164 ++pe; 165 } 166 return (DIGITS); 167 } 168 } 169 } 170 171 static int 172 peek(int c, int r1, int r2) 173 { 174 if (*++pe != c) 175 return (r2); 176 ++pe; 177 return (r1); 178 } 179 180 /*ARGSUSED*/ 181 static void 182 yyerror(YYCONST char *msg) 183 { 184 } 185 static YYCONST yytabelem yyexca[] ={ 186 -1, 1, 187 0, -1, 188 -2, 0, 189 -1, 33, 190 260, 0, 191 261, 0, 192 262, 0, 193 263, 0, 194 264, 0, 195 265, 0, 196 -2, 7, 197 -1, 34, 198 260, 0, 199 261, 0, 200 262, 0, 201 263, 0, 202 264, 0, 203 265, 0, 204 -2, 8, 205 -1, 35, 206 260, 0, 207 261, 0, 208 262, 0, 209 263, 0, 210 264, 0, 211 265, 0, 212 -2, 9, 213 -1, 36, 214 260, 0, 215 261, 0, 216 262, 0, 217 263, 0, 218 264, 0, 219 265, 0, 220 -2, 10, 221 -1, 37, 222 260, 0, 223 261, 0, 224 262, 0, 225 263, 0, 226 264, 0, 227 265, 0, 228 -2, 11, 229 -1, 38, 230 260, 0, 231 261, 0, 232 262, 0, 233 263, 0, 234 264, 0, 235 265, 0, 236 -2, 12, 237 }; 238 # define YYNPROD 26 239 # define YYLAST 294 240 static YYCONST yytabelem yyact[]={ 241 242 24, 18, 25, 1, 48, 22, 20, 0, 21, 0, 243 23, 24, 18, 0, 0, 0, 22, 20, 0, 21, 244 0, 23, 24, 18, 0, 0, 24, 22, 20, 0, 245 21, 22, 23, 24, 18, 0, 23, 0, 22, 20, 246 0, 21, 0, 23, 24, 18, 0, 0, 0, 22, 247 20, 0, 21, 24, 23, 0, 0, 19, 22, 20, 248 0, 21, 0, 23, 24, 0, 3, 0, 19, 22, 249 20, 0, 21, 5, 23, 0, 7, 0, 6, 19, 250 0, 0, 0, 0, 0, 0, 0, 17, 0, 0, 251 19, 0, 0, 0, 0, 0, 0, 0, 17, 0, 252 0, 0, 0, 0, 0, 0, 0, 0, 0, 17, 253 0, 2, 0, 0, 0, 26, 27, 28, 29, 30, 254 17, 31, 32, 33, 34, 35, 36, 37, 38, 39, 255 40, 41, 42, 43, 44, 45, 46, 47, 0, 0, 256 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 257 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 258 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 259 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 260 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 261 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 262 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 263 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 264 0, 9, 10, 13, 14, 15, 16, 12, 11, 25, 265 0, 0, 9, 10, 13, 14, 15, 16, 12, 11, 266 25, 0, 0, 0, 10, 13, 14, 15, 16, 12, 267 11, 25, 0, 0, 0, 25, 13, 14, 15, 16, 268 12, 11, 25, 0, 0, 0, 0, 13, 14, 15, 269 16, 12, 11, 25, 0, 0, 13, 14, 15, 16, 270 12, 11, 25, 0, 0, 0, 0, 0, 0, 0, 271 8, 0, 0, 25 }; 272 static YYCONST yytabelem yypact[]={ 273 274 33,-10000000, -26, 33, 33, 33, 33, 33,-10000000, 33, 275 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 276 33, 33, 33, 33, 33, 33, 16, 16, -37,-10000000, 277 -10000000, -15, -4, 27, 27, 27, 27, 27, 27, 7, 278 16, 7, -11, -11, -264, -264, -264, -264,-10000000 }; 279 static YYCONST yytabelem yypgo[]={ 280 281 0, 3, 111 }; 282 static YYCONST yytabelem yyr1[]={ 283 284 0, 1, 1, 2, 2, 2, 2, 2, 2, 2, 285 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 286 2, 2, 2, 2, 2, 2 }; 287 static YYCONST yytabelem yyr2[]={ 288 289 0, 3, 1, 7, 7, 5, 5, 7, 7, 7, 290 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 291 7, 7, 7, 5, 5, 3 }; 292 static YYCONST yytabelem yychk[]={ 293 294 -10000000, -1, -2, 33, 126, 40, 45, 43, 257, 258, 295 259, 265, 264, 260, 261, 262, 263, 124, 38, 94, 296 43, 45, 42, 47, 37, 266, -2, -2, -2, -2, 297 -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, 298 -2, -2, -2, -2, -2, -2, -2, -2, 41 }; 299 static YYCONST yytabelem yydef[]={ 300 301 2, -2, 1, 0, 0, 0, 0, 0, 25, 0, 302 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 303 0, 0, 0, 0, 0, 0, 5, 6, 0, 23, 304 24, 3, 4, -2, -2, -2, -2, -2, -2, 13, 305 14, 15, 16, 17, 18, 19, 20, 22, 21 }; 306 typedef struct 307 #ifdef __cplusplus 308 yytoktype 309 #endif 310 { 311 #ifdef __cplusplus 312 const 313 #endif 314 char *t_name; int t_val; } yytoktype; 315 #ifndef YYDEBUG 316 # define YYDEBUG 0 /* don't allow debugging */ 317 #endif 318 319 #if YYDEBUG 320 321 yytoktype yytoks[] = 322 { 323 "DIGITS", 257, 324 "OROR", 258, 325 "ANDAND", 259, 326 "|", 124, 327 "^", 94, 328 "&", 38, 329 "!", 33, 330 "~", 126, 331 "GT", 260, 332 "GE", 261, 333 "LT", 262, 334 "LE", 263, 335 "NE", 264, 336 "EQ", 265, 337 "+", 43, 338 "-", 45, 339 "*", 42, 340 "/", 47, 341 "%", 37, 342 "POWER", 266, 343 "UMINUS", 267, 344 "-unknown-", -1 /* ends search */ 345 }; 346 347 #ifdef __cplusplus 348 const 349 #endif 350 char * yyreds[] = 351 { 352 "-no such reduction-", 353 "s : e", 354 "s : /* empty */", 355 "e : e OROR e", 356 "e : e ANDAND e", 357 "e : '!' e", 358 "e : '~' e", 359 "e : e EQ e", 360 "e : e NE e", 361 "e : e GT e", 362 "e : e GE e", 363 "e : e LT e", 364 "e : e LE e", 365 "e : e '|' e", 366 "e : e '&' e", 367 "e : e '^' e", 368 "e : e '+' e", 369 "e : e '-' e", 370 "e : e '*' e", 371 "e : e '/' e", 372 "e : e '%' e", 373 "e : '(' e ')'", 374 "e : e POWER e", 375 "e : '-' e", 376 "e : '+' e", 377 "e : DIGITS", 378 }; 379 #endif /* YYDEBUG */ 380 # line 1 "/usr/share/lib/ccs/yaccpar" 381 /* 382 * CDDL HEADER START 383 * 384 * The contents of this file are subject to the terms of the 385 * Common Development and Distribution License, Version 1.0 only 386 * (the "License"). You may not use this file except in compliance 387 * with the License. 388 * 389 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 390 * or http://www.opensolaris.org/os/licensing. 391 * See the License for the specific language governing permissions 392 * and limitations under the License. 393 * 394 * When distributing Covered Code, include this CDDL HEADER in each 395 * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 396 * If applicable, add the following below this CDDL HEADER, with the 397 * fields enclosed by brackets "[]" replaced with your own identifying 398 * information: Portions Copyright [yyyy] [name of copyright owner] 399 * 400 * CDDL HEADER END 401 */ 402 /* 403 * Copyright 1993 Sun Microsystems, Inc. All rights reserved. 404 * Use is subject to license terms. 405 */ 406 407 /* Copyright (c) 1988 AT&T */ 408 /* All Rights Reserved */ 409 410 #pragma ident "%Z%%M% %I% %E% SMI" 411 412 /* 413 ** Skeleton parser driver for yacc output 414 */ 415 416 /* 417 ** yacc user known macros and defines 418 */ 419 #define YYERROR goto yyerrlab 420 #define YYACCEPT return(0) 421 #define YYABORT return(1) 422 #define YYBACKUP( newtoken, newvalue )\ 423 {\ 424 if ( yychar >= 0 || ( yyr2[ yytmp ] >> 1 ) != 1 )\ 425 {\ 426 yyerror( "syntax error - cannot backup" );\ 427 goto yyerrlab;\ 428 }\ 429 yychar = newtoken;\ 430 yystate = *yyps;\ 431 yylval = newvalue;\ 432 goto yynewstate;\ 433 } 434 #define YYRECOVERING() (!!yyerrflag) 435 #define YYNEW(type) malloc(sizeof(type) * yynewmax) 436 #define YYCOPY(to, from, type) \ 437 (type *) memcpy(to, (char *) from, yymaxdepth * sizeof (type)) 438 #define YYENLARGE( from, type) \ 439 (type *) realloc((char *) from, yynewmax * sizeof(type)) 440 #ifndef YYDEBUG 441 # define YYDEBUG 1 /* make debugging available */ 442 #endif 443 444 /* 445 ** user known globals 446 */ 447 int yydebug; /* set to 1 to get debugging */ 448 449 /* 450 ** driver internal defines 451 */ 452 #define YYFLAG (-10000000) 453 454 /* 455 ** global variables used by the parser 456 */ 457 YYSTYPE *yypv; /* top of value stack */ 458 int *yyps; /* top of state stack */ 459 460 int yystate; /* current state */ 461 int yytmp; /* extra var (lasts between blocks) */ 462 463 int yynerrs; /* number of errors */ 464 int yyerrflag; /* error recovery flag */ 465 int yychar; /* current input token number */ 466 467 468 469 #ifdef YYNMBCHARS 470 #define YYLEX() yycvtok(yylex()) 471 /* 472 ** yycvtok - return a token if i is a wchar_t value that exceeds 255. 473 ** If i<255, i itself is the token. If i>255 but the neither 474 ** of the 30th or 31st bit is on, i is already a token. 475 */ 476 #if defined(__STDC__) || defined(__cplusplus) 477 int yycvtok(int i) 478 #else 479 int yycvtok(i) int i; 480 #endif 481 { 482 int first = 0; 483 int last = YYNMBCHARS - 1; 484 int mid; 485 wchar_t j; 486 487 if(i&0x60000000){/*Must convert to a token. */ 488 if( yymbchars[last].character < i ){ 489 return i;/*Giving up*/ 490 } 491 while ((last>=first)&&(first>=0)) {/*Binary search loop*/ 492 mid = (first+last)/2; 493 j = yymbchars[mid].character; 494 if( j==i ){/*Found*/ 495 return yymbchars[mid].tvalue; 496 }else if( j<i ){ 497 first = mid + 1; 498 }else{ 499 last = mid -1; 500 } 501 } 502 /*No entry in the table.*/ 503 return i;/* Giving up.*/ 504 }else{/* i is already a token. */ 505 return i; 506 } 507 } 508 #else/*!YYNMBCHARS*/ 509 #define YYLEX() yylex() 510 #endif/*!YYNMBCHARS*/ 511 512 /* 513 ** yyparse - return 0 if worked, 1 if syntax error not recovered from 514 */ 515 #if defined(__STDC__) || defined(__cplusplus) 516 int yyparse(void) 517 #else 518 int yyparse() 519 #endif 520 { 521 register YYSTYPE *yypvt = 0; /* top of value stack for $vars */ 522 523 #if defined(__cplusplus) || defined(lint) 524 /* 525 hacks to please C++ and lint - goto's inside 526 switch should never be executed 527 */ 528 static int __yaccpar_lint_hack__ = 0; 529 switch (__yaccpar_lint_hack__) 530 { 531 case 1: goto yyerrlab; 532 case 2: goto yynewstate; 533 } 534 #endif 535 536 /* 537 ** Initialize externals - yyparse may be called more than once 538 */ 539 yypv = &yyv[-1]; 540 yyps = &yys[-1]; 541 yystate = 0; 542 yytmp = 0; 543 yynerrs = 0; 544 yyerrflag = 0; 545 yychar = -1; 546 547 #if YYMAXDEPTH <= 0 548 if (yymaxdepth <= 0) 549 { 550 if ((yymaxdepth = YYEXPAND(0)) <= 0) 551 { 552 yyerror("yacc initialization error"); 553 YYABORT; 554 } 555 } 556 #endif 557 558 { 559 register YYSTYPE *yy_pv; /* top of value stack */ 560 register int *yy_ps; /* top of state stack */ 561 register int yy_state; /* current state */ 562 register int yy_n; /* internal state number info */ 563 goto yystack; /* moved from 6 lines above to here to please C++ */ 564 565 /* 566 ** get globals into registers. 567 ** branch to here only if YYBACKUP was called. 568 */ 569 yynewstate: 570 yy_pv = yypv; 571 yy_ps = yyps; 572 yy_state = yystate; 573 goto yy_newstate; 574 575 /* 576 ** get globals into registers. 577 ** either we just started, or we just finished a reduction 578 */ 579 yystack: 580 yy_pv = yypv; 581 yy_ps = yyps; 582 yy_state = yystate; 583 584 /* 585 ** top of for (;;) loop while no reductions done 586 */ 587 yy_stack: 588 /* 589 ** put a state and value onto the stacks 590 */ 591 #if YYDEBUG 592 /* 593 ** if debugging, look up token value in list of value vs. 594 ** name pairs. 0 and negative (-1) are special values. 595 ** Note: linear search is used since time is not a real 596 ** consideration while debugging. 597 */ 598 if ( yydebug ) 599 { 600 register int yy_i; 601 602 printf( "State %d, token ", yy_state ); 603 if ( yychar == 0 ) 604 printf( "end-of-file\n" ); 605 else if ( yychar < 0 ) 606 printf( "-none-\n" ); 607 else 608 { 609 for ( yy_i = 0; yytoks[yy_i].t_val >= 0; 610 yy_i++ ) 611 { 612 if ( yytoks[yy_i].t_val == yychar ) 613 break; 614 } 615 printf( "%s\n", yytoks[yy_i].t_name ); 616 } 617 } 618 #endif /* YYDEBUG */ 619 if ( ++yy_ps >= &yys[ yymaxdepth ] ) /* room on stack? */ 620 { 621 /* 622 ** reallocate and recover. Note that pointers 623 ** have to be reset, or bad things will happen 624 */ 625 long yyps_index = (yy_ps - yys); 626 long yypv_index = (yy_pv - yyv); 627 long yypvt_index = (yypvt - yyv); 628 int yynewmax; 629 #ifdef YYEXPAND 630 yynewmax = YYEXPAND(yymaxdepth); 631 #else 632 yynewmax = 2 * yymaxdepth; /* double table size */ 633 if (yymaxdepth == YYMAXDEPTH) /* first time growth */ 634 { 635 char *newyys = (char *)YYNEW(int); 636 char *newyyv = (char *)YYNEW(YYSTYPE); 637 if (newyys != 0 && newyyv != 0) 638 { 639 yys = YYCOPY(newyys, yys, int); 640 yyv = YYCOPY(newyyv, yyv, YYSTYPE); 641 } 642 else 643 yynewmax = 0; /* failed */ 644 } 645 else /* not first time */ 646 { 647 yys = YYENLARGE(yys, int); 648 yyv = YYENLARGE(yyv, YYSTYPE); 649 if (yys == 0 || yyv == 0) 650 yynewmax = 0; /* failed */ 651 } 652 #endif 653 if (yynewmax <= yymaxdepth) /* tables not expanded */ 654 { 655 yyerror( "yacc stack overflow" ); 656 YYABORT; 657 } 658 yymaxdepth = yynewmax; 659 660 yy_ps = yys + yyps_index; 661 yy_pv = yyv + yypv_index; 662 yypvt = yyv + yypvt_index; 663 } 664 *yy_ps = yy_state; 665 *++yy_pv = yyval; 666 667 /* 668 ** we have a new state - find out what to do 669 */ 670 yy_newstate: 671 if ( ( yy_n = yypact[ yy_state ] ) <= YYFLAG ) 672 goto yydefault; /* simple state */ 673 #if YYDEBUG 674 /* 675 ** if debugging, need to mark whether new token grabbed 676 */ 677 yytmp = yychar < 0; 678 #endif 679 if ( ( yychar < 0 ) && ( ( yychar = YYLEX() ) < 0 ) ) 680 yychar = 0; /* reached EOF */ 681 #if YYDEBUG 682 if ( yydebug && yytmp ) 683 { 684 register int yy_i; 685 686 printf( "Received token " ); 687 if ( yychar == 0 ) 688 printf( "end-of-file\n" ); 689 else if ( yychar < 0 ) 690 printf( "-none-\n" ); 691 else 692 { 693 for ( yy_i = 0; yytoks[yy_i].t_val >= 0; 694 yy_i++ ) 695 { 696 if ( yytoks[yy_i].t_val == yychar ) 697 break; 698 } 699 printf( "%s\n", yytoks[yy_i].t_name ); 700 } 701 } 702 #endif /* YYDEBUG */ 703 if ( ( ( yy_n += yychar ) < 0 ) || ( yy_n >= YYLAST ) ) 704 goto yydefault; 705 if ( yychk[ yy_n = yyact[ yy_n ] ] == yychar ) /*valid shift*/ 706 { 707 yychar = -1; 708 yyval = yylval; 709 yy_state = yy_n; 710 if ( yyerrflag > 0 ) 711 yyerrflag--; 712 goto yy_stack; 713 } 714 715 yydefault: 716 if ( ( yy_n = yydef[ yy_state ] ) == -2 ) 717 { 718 #if YYDEBUG 719 yytmp = yychar < 0; 720 #endif 721 if ( ( yychar < 0 ) && ( ( yychar = YYLEX() ) < 0 ) ) 722 yychar = 0; /* reached EOF */ 723 #if YYDEBUG 724 if ( yydebug && yytmp ) 725 { 726 register int yy_i; 727 728 printf( "Received token " ); 729 if ( yychar == 0 ) 730 printf( "end-of-file\n" ); 731 else if ( yychar < 0 ) 732 printf( "-none-\n" ); 733 else 734 { 735 for ( yy_i = 0; 736 yytoks[yy_i].t_val >= 0; 737 yy_i++ ) 738 { 739 if ( yytoks[yy_i].t_val 740 == yychar ) 741 { 742 break; 743 } 744 } 745 printf( "%s\n", yytoks[yy_i].t_name ); 746 } 747 } 748 #endif /* YYDEBUG */ 749 /* 750 ** look through exception table 751 */ 752 { 753 register YYCONST int *yyxi = yyexca; 754 755 while ( ( *yyxi != -1 ) || 756 ( yyxi[1] != yy_state ) ) 757 { 758 yyxi += 2; 759 } 760 while ( ( *(yyxi += 2) >= 0 ) && 761 ( *yyxi != yychar ) ) 762 ; 763 if ( ( yy_n = yyxi[1] ) < 0 ) 764 YYACCEPT; 765 } 766 } 767 768 /* 769 ** check for syntax error 770 */ 771 if ( yy_n == 0 ) /* have an error */ 772 { 773 /* no worry about speed here! */ 774 switch ( yyerrflag ) 775 { 776 case 0: /* new error */ 777 yyerror( "syntax error" ); 778 goto skip_init; 779 yyerrlab: 780 /* 781 ** get globals into registers. 782 ** we have a user generated syntax type error 783 */ 784 yy_pv = yypv; 785 yy_ps = yyps; 786 yy_state = yystate; 787 skip_init: 788 yynerrs++; 789 /* FALLTHRU */ 790 case 1: 791 case 2: /* incompletely recovered error */ 792 /* try again... */ 793 yyerrflag = 3; 794 /* 795 ** find state where "error" is a legal 796 ** shift action 797 */ 798 while ( yy_ps >= yys ) 799 { 800 yy_n = yypact[ *yy_ps ] + YYERRCODE; 801 if ( yy_n >= 0 && yy_n < YYLAST && 802 yychk[yyact[yy_n]] == YYERRCODE) { 803 /* 804 ** simulate shift of "error" 805 */ 806 yy_state = yyact[ yy_n ]; 807 goto yy_stack; 808 } 809 /* 810 ** current state has no shift on 811 ** "error", pop stack 812 */ 813 #if YYDEBUG 814 # define _POP_ "Error recovery pops state %d, uncovers state %d\n" 815 if ( yydebug ) 816 printf( _POP_, *yy_ps, 817 yy_ps[-1] ); 818 # undef _POP_ 819 #endif 820 yy_ps--; 821 yy_pv--; 822 } 823 /* 824 ** there is no state on stack with "error" as 825 ** a valid shift. give up. 826 */ 827 YYABORT; 828 case 3: /* no shift yet; eat a token */ 829 #if YYDEBUG 830 /* 831 ** if debugging, look up token in list of 832 ** pairs. 0 and negative shouldn't occur, 833 ** but since timing doesn't matter when 834 ** debugging, it doesn't hurt to leave the 835 ** tests here. 836 */ 837 if ( yydebug ) 838 { 839 register int yy_i; 840 841 printf( "Error recovery discards " ); 842 if ( yychar == 0 ) 843 printf( "token end-of-file\n" ); 844 else if ( yychar < 0 ) 845 printf( "token -none-\n" ); 846 else 847 { 848 for ( yy_i = 0; 849 yytoks[yy_i].t_val >= 0; 850 yy_i++ ) 851 { 852 if ( yytoks[yy_i].t_val 853 == yychar ) 854 { 855 break; 856 } 857 } 858 printf( "token %s\n", 859 yytoks[yy_i].t_name ); 860 } 861 } 862 #endif /* YYDEBUG */ 863 if ( yychar == 0 ) /* reached EOF. quit */ 864 YYABORT; 865 yychar = -1; 866 goto yy_newstate; 867 } 868 }/* end if ( yy_n == 0 ) */ 869 /* 870 ** reduction by production yy_n 871 ** put stack tops, etc. so things right after switch 872 */ 873 #if YYDEBUG 874 /* 875 ** if debugging, print the string that is the user's 876 ** specification of the reduction which is just about 877 ** to be done. 878 */ 879 if ( yydebug ) 880 printf( "Reduce by (%d) \"%s\"\n", 881 yy_n, yyreds[ yy_n ] ); 882 #endif 883 yytmp = yy_n; /* value to switch over */ 884 yypvt = yy_pv; /* $vars top of value stack */ 885 /* 886 ** Look in goto table for next state 887 ** Sorry about using yy_state here as temporary 888 ** register variable, but why not, if it works... 889 ** If yyr2[ yy_n ] doesn't have the low order bit 890 ** set, then there is no action to be done for 891 ** this reduction. So, no saving & unsaving of 892 ** registers done. The only difference between the 893 ** code just after the if and the body of the if is 894 ** the goto yy_stack in the body. This way the test 895 ** can be made before the choice of what to do is needed. 896 */ 897 { 898 /* length of production doubled with extra bit */ 899 register int yy_len = yyr2[ yy_n ]; 900 901 if ( !( yy_len & 01 ) ) 902 { 903 yy_len >>= 1; 904 yyval = ( yy_pv -= yy_len )[1]; /* $$ = $1 */ 905 yy_state = yypgo[ yy_n = yyr1[ yy_n ] ] + 906 *( yy_ps -= yy_len ) + 1; 907 if ( yy_state >= YYLAST || 908 yychk[ yy_state = 909 yyact[ yy_state ] ] != -yy_n ) 910 { 911 yy_state = yyact[ yypgo[ yy_n ] ]; 912 } 913 goto yy_stack; 914 } 915 yy_len >>= 1; 916 yyval = ( yy_pv -= yy_len )[1]; /* $$ = $1 */ 917 yy_state = yypgo[ yy_n = yyr1[ yy_n ] ] + 918 *( yy_ps -= yy_len ) + 1; 919 if ( yy_state >= YYLAST || 920 yychk[ yy_state = yyact[ yy_state ] ] != -yy_n ) 921 { 922 yy_state = yyact[ yypgo[ yy_n ] ]; 923 } 924 } 925 /* save until reenter driver code */ 926 yystate = yy_state; 927 yyps = yy_ps; 928 yypv = yy_pv; 929 } 930 /* 931 ** code supplied by user is placed in this switch 932 */ 933 switch( yytmp ) 934 { 935 936 case 1: 937 # line 52 "../common/m4y.y" 938 { evalval = yypvt[-0]; } break; 939 case 2: 940 # line 53 "../common/m4y.y" 941 { evalval = 0; } break; 942 case 3: 943 # line 56 "../common/m4y.y" 944 { yyval = (yypvt[-2] != 0 || yypvt[-0] != 0) ? 1 : 0; } break; 945 case 4: 946 # line 57 "../common/m4y.y" 947 { yyval = (yypvt[-2] != 0 && yypvt[-0] != 0) ? 1 : 0; } break; 948 case 5: 949 # line 58 "../common/m4y.y" 950 { yyval = yypvt[-0] == 0; } break; 951 case 6: 952 # line 59 "../common/m4y.y" 953 { yyval = ~yypvt[-0]; } break; 954 case 7: 955 # line 60 "../common/m4y.y" 956 { yyval = yypvt[-2] == yypvt[-0]; } break; 957 case 8: 958 # line 61 "../common/m4y.y" 959 { yyval = yypvt[-2] != yypvt[-0]; } break; 960 case 9: 961 # line 62 "../common/m4y.y" 962 { yyval = yypvt[-2] > yypvt[-0]; } break; 963 case 10: 964 # line 63 "../common/m4y.y" 965 { yyval = yypvt[-2] >= yypvt[-0]; } break; 966 case 11: 967 # line 64 "../common/m4y.y" 968 { yyval = yypvt[-2] < yypvt[-0]; } break; 969 case 12: 970 # line 65 "../common/m4y.y" 971 { yyval = yypvt[-2] <= yypvt[-0]; } break; 972 case 13: 973 # line 66 "../common/m4y.y" 974 { yyval = (yypvt[-2] | yypvt[-0]); } break; 975 case 14: 976 # line 67 "../common/m4y.y" 977 { yyval = (yypvt[-2] & yypvt[-0]); } break; 978 case 15: 979 # line 68 "../common/m4y.y" 980 { yyval = (yypvt[-2] ^ yypvt[-0]); } break; 981 case 16: 982 # line 69 "../common/m4y.y" 983 { yyval = (yypvt[-2] + yypvt[-0]); } break; 984 case 17: 985 # line 70 "../common/m4y.y" 986 { yyval = (yypvt[-2] - yypvt[-0]); } break; 987 case 18: 988 # line 71 "../common/m4y.y" 989 { yyval = (yypvt[-2] * yypvt[-0]); } break; 990 case 19: 991 # line 72 "../common/m4y.y" 992 { yyval = (yypvt[-2] / yypvt[-0]); } break; 993 case 20: 994 # line 73 "../common/m4y.y" 995 { yyval = (yypvt[-2] % yypvt[-0]); } break; 996 case 21: 997 # line 74 "../common/m4y.y" 998 { yyval = (yypvt[-1]); } break; 999 case 22: 1000 # line 75 "../common/m4y.y" 1001 { for (yyval = 1; yypvt[-0]-- > 0; yyval *= yypvt[-2]); } break; 1002 case 23: 1003 # line 76 "../common/m4y.y" 1004 { yyval = yypvt[-0]-1; yyval = -yypvt[-0]; } break; 1005 case 24: 1006 # line 77 "../common/m4y.y" 1007 { yyval = yypvt[-0]-1; yyval = yypvt[-0]; } break; 1008 case 25: 1009 # line 78 "../common/m4y.y" 1010 { yyval = evalval; } break; 1011 # line 556 "/usr/share/lib/ccs/yaccpar" 1012 } 1013 goto yystack; /* reset registers in driver code */ 1014 } 1015 1016