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