1 /* original parser id follows */ 2 /* yysccsid[] = "@(#)yaccpar 1.9 (Berkeley) 02/21/93" */ 3 /* (use YYMAJOR/YYMINOR for ifdefs dependent of 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 #undef YYBTYACC 17 #define YYBTYACC 0 18 #define YYDEBUGSTR YYPREFIX "debug" 19 20 #ifndef yyparse 21 #define yyparse grammar_parse 22 #endif /* yyparse */ 23 24 #ifndef yylex 25 #define yylex grammar_lex 26 #endif /* yylex */ 27 28 #ifndef yyerror 29 #define yyerror grammar_error 30 #endif /* yyerror */ 31 32 #ifndef yychar 33 #define yychar grammar_char 34 #endif /* yychar */ 35 36 #ifndef yyval 37 #define yyval grammar_val 38 #endif /* yyval */ 39 40 #ifndef yylval 41 #define yylval grammar_lval 42 #endif /* yylval */ 43 44 #ifndef yydebug 45 #define yydebug grammar_debug 46 #endif /* yydebug */ 47 48 #ifndef yynerrs 49 #define yynerrs grammar_nerrs 50 #endif /* yynerrs */ 51 52 #ifndef yyerrflag 53 #define yyerrflag grammar_errflag 54 #endif /* yyerrflag */ 55 56 #ifndef yylhs 57 #define yylhs grammar_lhs 58 #endif /* yylhs */ 59 60 #ifndef yylen 61 #define yylen grammar_len 62 #endif /* yylen */ 63 64 #ifndef yydefred 65 #define yydefred grammar_defred 66 #endif /* yydefred */ 67 68 #ifndef yystos 69 #define yystos grammar_stos 70 #endif /* yystos */ 71 72 #ifndef yydgoto 73 #define yydgoto grammar_dgoto 74 #endif /* yydgoto */ 75 76 #ifndef yysindex 77 #define yysindex grammar_sindex 78 #endif /* yysindex */ 79 80 #ifndef yyrindex 81 #define yyrindex grammar_rindex 82 #endif /* yyrindex */ 83 84 #ifndef yygindex 85 #define yygindex grammar_gindex 86 #endif /* yygindex */ 87 88 #ifndef yytable 89 #define yytable grammar_table 90 #endif /* yytable */ 91 92 #ifndef yycheck 93 #define yycheck grammar_check 94 #endif /* yycheck */ 95 96 #ifndef yyname 97 #define yyname grammar_name 98 #endif /* yyname */ 99 100 #ifndef yyrule 101 #define yyrule grammar_rule 102 #endif /* yyrule */ 103 104 #if YYBTYACC 105 106 #ifndef yycindex 107 #define yycindex grammar_cindex 108 #endif /* yycindex */ 109 110 #ifndef yyctable 111 #define yyctable grammar_ctable 112 #endif /* yyctable */ 113 114 #endif /* YYBTYACC */ 115 116 #define YYPREFIX "grammar_" 117 118 #define YYPURE 0 119 120 #line 9 "grammar.y" 121 #ifdef YYBISON 122 #include <stdlib.h> 123 #define YYSTYPE_IS_DECLARED 124 #define yyerror yaccError 125 #endif 126 127 #if defined(YYBISON) || !defined(YYBYACC) 128 static void yyerror(const char *s); 129 #endif 130 #line 81 "grammar.y" 131 #include <stdio.h> 132 #include <ctype.h> 133 #include <string.h> 134 135 #define OPT_LINTLIBRARY 1 136 137 #ifndef TRUE 138 #define TRUE (1) 139 #endif 140 141 #ifndef FALSE 142 #define FALSE (0) 143 #endif 144 145 /* #include "cproto.h" */ 146 #define MAX_TEXT_SIZE 1024 147 148 /* Prototype styles */ 149 #if OPT_LINTLIBRARY 150 #define PROTO_ANSI_LLIB -2 /* form ANSI lint-library source */ 151 #define PROTO_LINTLIBRARY -1 /* form lint-library source */ 152 #endif 153 #define PROTO_NONE 0 /* do not output any prototypes */ 154 #define PROTO_TRADITIONAL 1 /* comment out parameters */ 155 #define PROTO_ABSTRACT 2 /* comment out parameter names */ 156 #define PROTO_ANSI 3 /* ANSI C prototype */ 157 158 typedef int PrototypeStyle; 159 160 typedef char boolean; 161 162 extern boolean types_out; 163 extern PrototypeStyle proto_style; 164 165 #define ansiLintLibrary() (proto_style == PROTO_ANSI_LLIB) 166 #define knrLintLibrary() (proto_style == PROTO_LINTLIBRARY) 167 #define lintLibrary() (knrLintLibrary() || ansiLintLibrary()) 168 169 #if OPT_LINTLIBRARY 170 #define FUNC_UNKNOWN -1 /* unspecified */ 171 #else 172 #define FUNC_UNKNOWN 0 /* unspecified (same as FUNC_NONE) */ 173 #endif 174 #define FUNC_NONE 0 /* not a function definition */ 175 #define FUNC_TRADITIONAL 1 /* traditional style */ 176 #define FUNC_ANSI 2 /* ANSI style */ 177 #define FUNC_BOTH 3 /* both styles */ 178 179 typedef int FuncDefStyle; 180 181 /* Source file text */ 182 typedef struct text { 183 char text[MAX_TEXT_SIZE]; /* source text */ 184 long begin; /* offset in temporary file */ 185 } Text; 186 187 /* Declaration specifier flags */ 188 #define DS_NONE 0 /* default */ 189 #define DS_EXTERN 1 /* contains "extern" specifier */ 190 #define DS_STATIC 2 /* contains "static" specifier */ 191 #define DS_CHAR 4 /* contains "char" type specifier */ 192 #define DS_SHORT 8 /* contains "short" type specifier */ 193 #define DS_FLOAT 16 /* contains "float" type specifier */ 194 #define DS_INLINE 32 /* contains "inline" specifier */ 195 #define DS_JUNK 64 /* we're not interested in this declaration */ 196 197 /* This structure stores information about a declaration specifier. */ 198 typedef struct decl_spec { 199 unsigned short flags; /* flags defined above */ 200 char *text; /* source text */ 201 long begin; /* offset in temporary file */ 202 } DeclSpec; 203 204 /* This is a list of function parameters. */ 205 typedef struct _ParameterList { 206 struct parameter *first; /* pointer to first parameter in list */ 207 struct parameter *last; /* pointer to last parameter in list */ 208 long begin_comment; /* begin offset of comment */ 209 long end_comment; /* end offset of comment */ 210 char *comment; /* comment at start of parameter list */ 211 } ParameterList; 212 213 /* This structure stores information about a declarator. */ 214 typedef struct _Declarator { 215 char *name; /* name of variable or function */ 216 char *text; /* source text */ 217 long begin; /* offset in temporary file */ 218 long begin_comment; /* begin offset of comment */ 219 long end_comment; /* end offset of comment */ 220 FuncDefStyle func_def; /* style of function definition */ 221 ParameterList params; /* function parameters */ 222 boolean pointer; /* TRUE if it declares a pointer */ 223 struct _Declarator *head; /* head function declarator */ 224 struct _Declarator *func_stack; /* stack of function declarators */ 225 struct _Declarator *next; /* next declarator in list */ 226 } Declarator; 227 228 /* This structure stores information about a function parameter. */ 229 typedef struct parameter { 230 struct parameter *next; /* next parameter in list */ 231 DeclSpec decl_spec; 232 Declarator *declarator; 233 char *comment; /* comment following the parameter */ 234 } Parameter; 235 236 /* This is a list of declarators. */ 237 typedef struct declarator_list { 238 Declarator *first; /* pointer to first declarator in list */ 239 Declarator *last; /* pointer to last declarator in list */ 240 } DeclaratorList; 241 242 /* #include "symbol.h" */ 243 typedef struct symbol { 244 struct symbol *next; /* next symbol in list */ 245 char *name; /* name of symbol */ 246 char *value; /* value of symbol (for defines) */ 247 short flags; /* symbol attributes */ 248 } Symbol; 249 250 /* parser stack entry type */ 251 typedef union { 252 Text text; 253 DeclSpec decl_spec; 254 Parameter *parameter; 255 ParameterList param_list; 256 Declarator *declarator; 257 DeclaratorList decl_list; 258 } YYSTYPE; 259 260 /* The hash table length should be a prime number. */ 261 #define SYM_MAX_HASH 251 262 263 typedef struct symbol_table { 264 Symbol *bucket[SYM_MAX_HASH]; /* hash buckets */ 265 } SymbolTable; 266 267 extern SymbolTable *new_symbol_table /* Create symbol table */ 268 (void); 269 extern void free_symbol_table /* Destroy symbol table */ 270 (SymbolTable *s); 271 extern Symbol *find_symbol /* Lookup symbol name */ 272 (SymbolTable *s, const char *n); 273 extern Symbol *new_symbol /* Define new symbol */ 274 (SymbolTable *s, const char *n, const char *v, int f); 275 276 /* #include "semantic.h" */ 277 extern void new_decl_spec (DeclSpec *, const char *, long, int); 278 extern void free_decl_spec (DeclSpec *); 279 extern void join_decl_specs (DeclSpec *, DeclSpec *, DeclSpec *); 280 extern void check_untagged (DeclSpec *); 281 extern Declarator *new_declarator (const char *, const char *, long); 282 extern void free_declarator (Declarator *); 283 extern void new_decl_list (DeclaratorList *, Declarator *); 284 extern void free_decl_list (DeclaratorList *); 285 extern void add_decl_list (DeclaratorList *, DeclaratorList *, Declarator *); 286 extern Parameter *new_parameter (DeclSpec *, Declarator *); 287 extern void free_parameter (Parameter *); 288 extern void new_param_list (ParameterList *, Parameter *); 289 extern void free_param_list (ParameterList *); 290 extern void add_param_list (ParameterList *, ParameterList *, Parameter *); 291 extern void new_ident_list (ParameterList *); 292 extern void add_ident_list (ParameterList *, ParameterList *, const char *); 293 extern void set_param_types (ParameterList *, DeclSpec *, DeclaratorList *); 294 extern void gen_declarations (DeclSpec *, DeclaratorList *); 295 extern void gen_prototype (DeclSpec *, Declarator *); 296 extern void gen_func_declarator (Declarator *); 297 extern void gen_func_definition (DeclSpec *, Declarator *); 298 299 extern void init_parser (void); 300 extern void process_file (FILE *infile, char *name); 301 extern char *cur_text (void); 302 extern char *cur_file_name (void); 303 extern char *implied_typedef (void); 304 extern void include_file (char *name, int convert); 305 extern char *supply_parm (int count); 306 extern char *xstrdup (const char *); 307 extern int already_declared (char *name); 308 extern int is_actual_func (Declarator *d); 309 extern int lint_ellipsis (Parameter *p); 310 extern int want_typedef (void); 311 extern void begin_tracking (void); 312 extern void begin_typedef (void); 313 extern void copy_typedef (char *s); 314 extern void ellipsis_varargs (Declarator *d); 315 extern void end_typedef (void); 316 extern void flush_varargs (void); 317 extern void fmt_library (int code); 318 extern void imply_typedef (const char *s); 319 extern void indent (FILE *outf); 320 extern void put_blankline (FILE *outf); 321 extern void put_body (FILE *outf, DeclSpec *decl_spec, Declarator *declarator); 322 extern void put_char (FILE *outf, int c); 323 extern void put_error (void); 324 extern void put_newline (FILE *outf); 325 extern void put_padded (FILE *outf, const char *s); 326 extern void put_string (FILE *outf, const char *s); 327 extern void track_in (void); 328 329 extern boolean file_comments; 330 extern FuncDefStyle func_style; 331 extern char base_file[]; 332 333 extern int yylex (void); 334 335 /* declaration specifier attributes for the typedef statement currently being 336 * scanned 337 */ 338 static int cur_decl_spec_flags; 339 340 /* pointer to parameter list for the current function definition */ 341 static ParameterList *func_params; 342 343 /* A parser semantic action sets this pointer to the current declarator in 344 * a function parameter declaration in order to catch any comments following 345 * the parameter declaration on the same line. If the lexer scans a comment 346 * and <cur_declarator> is not NULL, then the comment is attached to the 347 * declarator. To ignore subsequent comments, the lexer sets this to NULL 348 * after scanning a comment or end of line. 349 */ 350 static Declarator *cur_declarator; 351 352 /* temporary string buffer */ 353 static char buf[MAX_TEXT_SIZE]; 354 355 /* table of typedef names */ 356 static SymbolTable *typedef_names; 357 358 /* table of define names */ 359 static SymbolTable *define_names; 360 361 /* table of type qualifiers */ 362 static SymbolTable *type_qualifiers; 363 364 /* information about the current input file */ 365 typedef struct { 366 char *base_name; /* base input file name */ 367 char *file_name; /* current file name */ 368 FILE *file; /* input file */ 369 unsigned line_num; /* current line number in input file */ 370 FILE *tmp_file; /* temporary file */ 371 long begin_comment; /* tmp file offset after last written ) or ; */ 372 long end_comment; /* tmp file offset after last comment */ 373 boolean convert; /* if TRUE, convert function definitions */ 374 boolean changed; /* TRUE if conversion done in this file */ 375 } IncludeStack; 376 377 static IncludeStack *cur_file; /* current input file */ 378 379 /* #include "yyerror.c" */ 380 381 static int haveAnsiParam (void); 382 383 384 /* Flags to enable us to find if a procedure returns a value. 385 */ 386 static int return_val; /* nonzero on BRACES iff return-expression found */ 387 388 static const char * 389 dft_decl_spec (void) 390 { 391 return (lintLibrary() && !return_val) ? "void" : "int"; 392 } 393 394 static int 395 haveAnsiParam (void) 396 { 397 Parameter *p; 398 if (func_params != 0) { 399 for (p = func_params->first; p != 0; p = p->next) { 400 if (p->declarator->func_def == FUNC_ANSI) { 401 return TRUE; 402 } 403 } 404 } 405 return FALSE; 406 } 407 #line 408 "grammar.tab.c" 408 409 /* compatibility with bison */ 410 #ifdef YYPARSE_PARAM 411 /* compatibility with FreeBSD */ 412 # ifdef YYPARSE_PARAM_TYPE 413 # define YYPARSE_DECL() yyparse(YYPARSE_PARAM_TYPE YYPARSE_PARAM) 414 # else 415 # define YYPARSE_DECL() yyparse(void *YYPARSE_PARAM) 416 # endif 417 #else 418 # define YYPARSE_DECL() yyparse(void) 419 #endif 420 421 /* Parameters sent to lex. */ 422 #ifdef YYLEX_PARAM 423 # define YYLEX_DECL() yylex(void *YYLEX_PARAM) 424 # define YYLEX yylex(YYLEX_PARAM) 425 #else 426 # define YYLEX_DECL() yylex(void) 427 # define YYLEX yylex() 428 #endif 429 430 /* Parameters sent to yyerror. */ 431 #ifndef YYERROR_DECL 432 #define YYERROR_DECL() yyerror(const char *s) 433 #endif 434 #ifndef YYERROR_CALL 435 #define YYERROR_CALL(msg) yyerror(msg) 436 #endif 437 438 extern int YYPARSE_DECL(); 439 440 #define T_IDENTIFIER 257 441 #define T_TYPEDEF_NAME 258 442 #define T_DEFINE_NAME 259 443 #define T_AUTO 260 444 #define T_EXTERN 261 445 #define T_REGISTER 262 446 #define T_STATIC 263 447 #define T_TYPEDEF 264 448 #define T_INLINE 265 449 #define T_EXTENSION 266 450 #define T_CHAR 267 451 #define T_DOUBLE 268 452 #define T_FLOAT 269 453 #define T_INT 270 454 #define T_VOID 271 455 #define T_LONG 272 456 #define T_SHORT 273 457 #define T_SIGNED 274 458 #define T_UNSIGNED 275 459 #define T_ENUM 276 460 #define T_STRUCT 277 461 #define T_UNION 278 462 #define T_Bool 279 463 #define T_Complex 280 464 #define T_Imaginary 281 465 #define T_TYPE_QUALIFIER 282 466 #define T_BRACKETS 283 467 #define T_LBRACE 284 468 #define T_MATCHRBRACE 285 469 #define T_ELLIPSIS 286 470 #define T_INITIALIZER 287 471 #define T_STRING_LITERAL 288 472 #define T_ASM 289 473 #define T_ASMARG 290 474 #define T_VA_DCL 291 475 #define YYERRCODE 256 476 typedef short YYINT; 477 static const YYINT grammar_lhs[] = { -1, 478 0, 0, 26, 26, 27, 27, 27, 27, 27, 27, 479 27, 31, 30, 30, 28, 28, 34, 28, 32, 32, 480 33, 33, 35, 35, 37, 38, 29, 39, 29, 36, 481 36, 36, 40, 40, 1, 1, 2, 2, 2, 3, 482 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 483 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 484 5, 5, 6, 6, 6, 19, 19, 8, 8, 9, 485 41, 9, 7, 7, 7, 25, 23, 23, 10, 10, 486 11, 11, 11, 11, 11, 20, 20, 21, 21, 22, 487 22, 14, 14, 15, 15, 16, 16, 16, 17, 17, 488 18, 18, 24, 24, 12, 12, 12, 13, 13, 13, 489 13, 13, 13, 13, 490 }; 491 static const YYINT grammar_len[] = { 2, 492 0, 1, 1, 2, 1, 1, 1, 1, 3, 2, 493 2, 2, 3, 3, 2, 3, 0, 5, 2, 1, 494 0, 1, 1, 3, 0, 0, 7, 0, 5, 0, 495 1, 1, 1, 2, 1, 2, 1, 1, 1, 1, 496 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 497 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 498 1, 1, 3, 2, 2, 1, 1, 1, 3, 1, 499 0, 4, 3, 2, 2, 1, 1, 1, 2, 1, 500 1, 3, 2, 4, 4, 2, 3, 0, 1, 1, 501 2, 1, 3, 1, 3, 2, 2, 1, 0, 1, 502 1, 3, 1, 2, 1, 2, 1, 3, 2, 1, 503 4, 3, 3, 2, 504 }; 505 static const YYINT grammar_defred[] = { 0, 506 0, 0, 0, 0, 77, 0, 62, 40, 0, 42, 507 43, 20, 44, 0, 46, 47, 48, 49, 54, 50, 508 51, 52, 53, 76, 66, 67, 55, 56, 57, 61, 509 0, 7, 0, 0, 35, 37, 38, 39, 59, 60, 510 28, 0, 0, 0, 103, 81, 0, 0, 3, 5, 511 6, 8, 0, 10, 11, 78, 0, 90, 0, 0, 512 104, 0, 19, 0, 41, 45, 15, 36, 0, 68, 513 0, 0, 0, 83, 0, 0, 64, 0, 0, 74, 514 4, 58, 0, 82, 87, 91, 0, 14, 13, 9, 515 16, 0, 71, 0, 31, 33, 0, 0, 0, 0, 516 0, 94, 0, 0, 101, 12, 63, 73, 0, 0, 517 69, 0, 0, 0, 34, 0, 110, 96, 97, 0, 518 0, 84, 0, 85, 0, 23, 0, 0, 72, 26, 519 29, 114, 0, 0, 0, 109, 0, 93, 95, 102, 520 18, 0, 0, 108, 113, 112, 0, 24, 27, 111, 521 }; 522 static const YYINT grammar_stos[] = { 0, 523 256, 40, 42, 38, 257, 258, 259, 260, 261, 262, 524 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 525 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 526 289, 59, 293, 294, 295, 296, 297, 298, 299, 300, 527 303, 304, 312, 313, 316, 317, 318, 319, 320, 321, 528 322, 323, 325, 285, 59, 258, 303, 298, 314, 315, 529 316, 288, 264, 290, 261, 266, 59, 295, 301, 302, 530 303, 332, 40, 283, 284, 316, 324, 304, 316, 324, 531 320, 258, 294, 41, 313, 298, 294, 321, 324, 59, 532 59, 44, 61, 330, 291, 321, 329, 333, 294, 307, 533 308, 309, 310, 311, 316, 285, 324, 324, 327, 303, 534 302, 334, 329, 284, 321, 40, 283, 303, 305, 306, 535 313, 41, 44, 41, 44, 303, 326, 328, 287, 284, 536 285, 41, 305, 307, 40, 283, 306, 286, 309, 316, 537 59, 44, 331, 41, 41, 41, 307, 303, 285, 41, 538 }; 539 static const YYINT grammar_dgoto[] = { 33, 540 87, 35, 36, 37, 38, 39, 40, 69, 70, 41, 541 42, 119, 120, 100, 101, 102, 103, 104, 43, 44, 542 59, 60, 45, 46, 47, 48, 49, 50, 51, 52, 543 77, 53, 127, 109, 128, 97, 94, 143, 72, 98, 544 112, 545 }; 546 static const YYINT grammar_sindex[] = { -2, 547 -3, 27, -239, -177, 0, 0, 0, 0, -274, 0, 548 0, 0, 0, -246, 0, 0, 0, 0, 0, 0, 549 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 550 -266, 0, 0, 455, 0, 0, 0, 0, 0, 0, 551 0, -35, -245, 128, 0, 0, -245, -2, 0, 0, 552 0, 0, 642, 0, 0, 0, -15, 0, -12, -239, 553 0, 590, 0, -27, 0, 0, 0, 0, -10, 0, 554 -11, 534, -72, 0, -237, -232, 0, -35, -232, 0, 555 0, 0, 642, 0, 0, 0, 455, 0, 0, 0, 556 0, 27, 0, 534, 0, 0, -222, 617, 209, 34, 557 39, 0, 44, 42, 0, 0, 0, 0, 27, -11, 558 0, -200, -196, -195, 0, 174, 0, 0, 0, -33, 559 243, 0, 561, 0, -177, 0, 33, 49, 0, 0, 560 0, 0, 53, 55, 417, 0, -33, 0, 0, 0, 561 0, 27, -188, 0, 0, 0, 57, 0, 0, 0, 562 }; 563 static const YYINT grammar_rindex[] = { 99, 564 0, 0, 275, 0, 0, -38, 0, 0, 481, 0, 565 0, 0, 0, 509, 0, 0, 0, 0, 0, 0, 566 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 567 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 568 0, 30, 0, 0, 0, 0, 0, 101, 0, 0, 569 0, 0, 0, 0, 0, 0, 0, 0, 343, 309, 570 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 571 98, -182, 62, 0, 0, 133, 0, 64, 379, 0, 572 0, 0, -5, 0, 0, 0, 0, 0, 0, 0, 573 0, 0, 0, -182, 0, 0, 0, -180, -19, 0, 574 65, 0, 0, 68, 0, 0, 0, 0, 51, 9, 575 0, 0, 0, 0, 0, 0, 0, 0, 0, -13, 576 19, 0, 0, 0, 0, 0, 0, 52, 0, 0, 577 0, 0, 0, 0, 0, 0, 35, 0, 0, 0, 578 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 579 }; 580 #if YYBTYACC 581 static const YYINT grammar_cindex[] = { 0, 582 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 583 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 584 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 585 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 586 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 587 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 588 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 589 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 590 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 591 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 592 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 593 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 594 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 595 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 596 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 597 }; 598 #endif 599 static const YYINT grammar_gindex[] = { 0, 600 11, -17, 0, 0, 13, 0, 0, 0, 20, 8, 601 -43, -1, -8, -89, 0, -9, 0, 0, 0, -44, 602 0, 0, 4, 0, 0, 0, 70, -53, 0, 0, 603 -18, 0, 0, 0, 0, 22, 0, 0, 0, 0, 604 0, 605 }; 606 #define YYTABLESIZE 924 607 static const YYINT grammar_table[] = { 58, 608 78, 58, 58, 58, 73, 58, 135, 61, 88, 57, 609 34, 5, 56, 62, 85, 58, 68, 63, 96, 7, 610 58, 98, 78, 64, 98, 84, 134, 107, 80, 3, 611 107, 90, 17, 92, 17, 4, 17, 2, 75, 3, 612 96, 71, 30, 89, 115, 147, 76, 106, 91, 93, 613 79, 75, 70, 17, 121, 55, 32, 107, 34, 105, 614 108, 114, 105, 83, 4, 68, 2, 70, 3, 68, 615 80, 121, 86, 80, 122, 106, 105, 78, 106, 5, 616 56, 68, 123, 99, 124, 125, 129, 130, 80, 131, 617 80, 141, 142, 144, 110, 145, 149, 150, 1, 110, 618 2, 30, 99, 32, 79, 92, 118, 79, 100, 21, 619 22, 111, 137, 139, 133, 113, 126, 81, 0, 0, 620 0, 0, 79, 57, 79, 0, 99, 0, 140, 0, 621 0, 0, 0, 99, 0, 0, 0, 0, 0, 0, 622 0, 70, 0, 0, 0, 99, 0, 0, 0, 148, 623 0, 0, 0, 0, 0, 0, 70, 0, 0, 0, 624 0, 0, 0, 0, 0, 4, 0, 2, 0, 0, 625 65, 0, 65, 65, 65, 0, 65, 0, 0, 0, 626 0, 0, 0, 0, 5, 6, 7, 8, 65, 10, 627 11, 65, 13, 66, 15, 16, 17, 18, 19, 20, 628 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 629 0, 4, 0, 116, 132, 3, 0, 0, 58, 58, 630 58, 58, 58, 58, 58, 78, 58, 58, 58, 58, 631 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 632 58, 58, 58, 58, 58, 78, 4, 74, 116, 136, 633 3, 17, 78, 1, 5, 6, 7, 8, 9, 10, 634 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 635 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 636 4, 54, 116, 5, 56, 0, 31, 80, 80, 80, 637 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 638 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 639 80, 80, 88, 80, 88, 88, 88, 0, 88, 0, 640 80, 79, 79, 79, 79, 79, 79, 79, 79, 79, 641 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 642 79, 79, 79, 79, 79, 79, 89, 79, 89, 89, 643 89, 0, 89, 0, 79, 25, 25, 25, 25, 25, 644 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 645 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 646 86, 25, 86, 86, 5, 56, 86, 0, 25, 65, 647 65, 65, 65, 65, 65, 65, 0, 65, 65, 65, 648 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 649 65, 65, 65, 65, 65, 65, 75, 0, 75, 75, 650 75, 0, 75, 0, 0, 0, 0, 0, 0, 0, 651 5, 6, 7, 8, 65, 10, 11, 75, 13, 66, 652 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 653 25, 26, 27, 28, 29, 30, 117, 146, 0, 0, 654 0, 0, 0, 0, 0, 5, 6, 7, 8, 65, 655 10, 11, 0, 13, 66, 15, 16, 17, 18, 19, 656 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 657 30, 117, 4, 0, 2, 0, 3, 0, 0, 5, 658 56, 0, 0, 0, 0, 0, 0, 0, 0, 0, 659 0, 0, 0, 67, 0, 0, 0, 0, 41, 0, 660 41, 0, 41, 0, 0, 117, 0, 0, 0, 0, 661 0, 88, 88, 0, 0, 0, 0, 0, 0, 41, 662 0, 0, 0, 0, 0, 0, 45, 0, 45, 0, 663 45, 0, 0, 0, 0, 0, 0, 88, 0, 0, 664 0, 0, 0, 0, 0, 89, 89, 45, 0, 0, 665 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 666 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 667 0, 89, 0, 0, 0, 0, 0, 0, 0, 86, 668 86, 0, 0, 0, 0, 0, 0, 0, 0, 0, 669 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 670 0, 0, 0, 0, 0, 86, 0, 0, 0, 0, 671 0, 0, 0, 0, 0, 75, 75, 75, 75, 75, 672 75, 75, 0, 75, 75, 75, 75, 75, 75, 75, 673 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 674 75, 75, 0, 0, 0, 0, 0, 0, 0, 0, 675 0, 0, 0, 0, 82, 7, 8, 65, 10, 11, 676 0, 13, 66, 15, 16, 17, 18, 19, 20, 21, 677 22, 23, 24, 25, 26, 27, 28, 29, 30, 0, 678 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 679 0, 5, 6, 7, 8, 65, 10, 11, 0, 13, 680 66, 15, 16, 17, 18, 19, 20, 21, 22, 23, 681 24, 25, 26, 27, 28, 29, 30, 41, 41, 41, 682 41, 41, 41, 41, 0, 41, 41, 41, 41, 41, 683 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 684 41, 41, 41, 0, 0, 45, 45, 45, 45, 45, 685 45, 45, 0, 45, 45, 45, 45, 45, 45, 45, 686 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 687 45, 82, 7, 8, 65, 10, 11, 12, 13, 14, 688 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 689 25, 26, 27, 28, 29, 30, 0, 0, 82, 7, 690 8, 65, 10, 11, 95, 13, 66, 15, 16, 17, 691 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 692 28, 29, 30, 0, 0, 0, 138, 82, 7, 8, 693 65, 10, 11, 12, 13, 14, 15, 16, 17, 18, 694 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 695 29, 30, 0, 75, 82, 7, 8, 65, 10, 11, 696 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 697 22, 23, 24, 25, 26, 27, 28, 29, 30, 82, 698 7, 8, 65, 10, 11, 0, 13, 66, 15, 16, 699 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 700 27, 28, 29, 30, 701 }; 702 static const YYINT grammar_check[] = { 38, 703 44, 40, 41, 42, 40, 44, 40, 4, 62, 2, 704 0, 257, 258, 288, 59, 3, 34, 264, 72, 259, 705 59, 41, 61, 290, 44, 41, 116, 41, 47, 42, 706 44, 59, 38, 44, 40, 38, 42, 40, 284, 42, 707 94, 34, 282, 62, 98, 135, 43, 285, 59, 61, 708 47, 284, 44, 59, 99, 59, 59, 76, 48, 41, 709 79, 284, 44, 53, 38, 83, 40, 59, 42, 87, 710 41, 116, 60, 44, 41, 41, 73, 121, 44, 257, 711 258, 99, 44, 73, 41, 44, 287, 284, 59, 285, 712 61, 59, 44, 41, 87, 41, 285, 41, 0, 92, 713 0, 284, 41, 284, 41, 41, 99, 44, 41, 59, 714 59, 92, 121, 123, 116, 94, 109, 48, -1, -1, 715 -1, -1, 59, 116, 61, -1, 116, -1, 125, -1, 716 -1, -1, -1, 123, -1, -1, -1, -1, -1, -1, 717 -1, 44, -1, -1, -1, 135, -1, -1, -1, 142, 718 -1, -1, -1, -1, -1, -1, 59, -1, -1, -1, 719 -1, -1, -1, -1, -1, 38, -1, 40, -1, -1, 720 38, -1, 40, 41, 42, -1, 44, -1, -1, -1, 721 -1, -1, -1, -1, 257, 258, 259, 260, 261, 262, 722 263, 59, 265, 266, 267, 268, 269, 270, 271, 272, 723 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 724 -1, 38, -1, 40, 41, 42, -1, -1, 257, 258, 725 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 726 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 727 279, 280, 281, 282, 283, 284, 38, 283, 40, 283, 728 42, 257, 291, 256, 257, 258, 259, 260, 261, 262, 729 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 730 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 731 38, 285, 40, 257, 258, -1, 289, 258, 259, 260, 732 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 733 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 734 281, 282, 38, 284, 40, 41, 42, -1, 44, -1, 735 291, 258, 259, 260, 261, 262, 263, 264, 265, 266, 736 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 737 277, 278, 279, 280, 281, 282, 38, 284, 40, 41, 738 42, -1, 44, -1, 291, 258, 259, 260, 261, 262, 739 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 740 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 741 38, 284, 40, 41, 257, 258, 44, -1, 291, 257, 742 258, 259, 260, 261, 262, 263, -1, 265, 266, 267, 743 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 744 278, 279, 280, 281, 282, 283, 38, -1, 40, 41, 745 42, -1, 44, -1, -1, -1, -1, -1, -1, -1, 746 257, 258, 259, 260, 261, 262, 263, 59, 265, 266, 747 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 748 277, 278, 279, 280, 281, 282, 283, 41, -1, -1, 749 -1, -1, -1, -1, -1, 257, 258, 259, 260, 261, 750 262, 263, -1, 265, 266, 267, 268, 269, 270, 271, 751 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 752 282, 283, 38, -1, 40, -1, 42, -1, -1, 257, 753 258, -1, -1, -1, -1, -1, -1, -1, -1, -1, 754 -1, -1, -1, 59, -1, -1, -1, -1, 38, -1, 755 40, -1, 42, -1, -1, 283, -1, -1, -1, -1, 756 -1, 257, 258, -1, -1, -1, -1, -1, -1, 59, 757 -1, -1, -1, -1, -1, -1, 38, -1, 40, -1, 758 42, -1, -1, -1, -1, -1, -1, 283, -1, -1, 759 -1, -1, -1, -1, -1, 257, 258, 59, -1, -1, 760 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 761 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 762 -1, 283, -1, -1, -1, -1, -1, -1, -1, 257, 763 258, -1, -1, -1, -1, -1, -1, -1, -1, -1, 764 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 765 -1, -1, -1, -1, -1, 283, -1, -1, -1, -1, 766 -1, -1, -1, -1, -1, 257, 258, 259, 260, 261, 767 262, 263, -1, 265, 266, 267, 268, 269, 270, 271, 768 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 769 282, 283, -1, -1, -1, -1, -1, -1, -1, -1, 770 -1, -1, -1, -1, 258, 259, 260, 261, 262, 263, 771 -1, 265, 266, 267, 268, 269, 270, 271, 272, 273, 772 274, 275, 276, 277, 278, 279, 280, 281, 282, -1, 773 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 774 -1, 257, 258, 259, 260, 261, 262, 263, -1, 265, 775 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 776 276, 277, 278, 279, 280, 281, 282, 257, 258, 259, 777 260, 261, 262, 263, -1, 265, 266, 267, 268, 269, 778 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 779 280, 281, 282, -1, -1, 257, 258, 259, 260, 261, 780 262, 263, -1, 265, 266, 267, 268, 269, 270, 271, 781 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 782 282, 258, 259, 260, 261, 262, 263, 264, 265, 266, 783 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 784 277, 278, 279, 280, 281, 282, -1, -1, 258, 259, 785 260, 261, 262, 263, 291, 265, 266, 267, 268, 269, 786 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 787 280, 281, 282, -1, -1, -1, 286, 258, 259, 260, 788 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 789 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 790 281, 282, -1, 284, 258, 259, 260, 261, 262, 263, 791 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 792 274, 275, 276, 277, 278, 279, 280, 281, 282, 258, 793 259, 260, 261, 262, 263, -1, 265, 266, 267, 268, 794 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 795 279, 280, 281, 282, 796 }; 797 #if YYBTYACC 798 static const YYINT grammar_ctable[] = { -1, 799 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 800 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 801 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 802 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 803 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 804 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 805 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 806 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 807 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 808 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 809 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 810 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 811 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 812 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 813 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 814 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 815 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 816 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 817 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 818 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 819 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 820 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 821 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 822 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 823 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 824 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 825 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 826 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 827 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 828 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 829 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 830 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 831 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 832 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 833 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 834 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 835 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 836 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 837 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 838 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 839 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 840 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 841 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 842 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 843 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 844 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 845 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 846 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 847 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 848 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 849 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 850 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 851 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 852 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 853 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 854 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 855 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 856 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 857 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 858 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 859 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 860 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 861 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 862 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 863 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 864 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 865 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 866 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 867 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 868 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 869 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 870 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 871 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 872 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 873 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 874 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 875 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 876 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 877 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 878 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 879 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 880 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 881 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 882 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 883 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 884 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 885 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 886 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 887 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 888 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 889 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 890 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 891 -1, -1, -1, 892 }; 893 #endif 894 #define YYFINAL 33 895 #ifndef YYDEBUG 896 #define YYDEBUG 0 897 #endif 898 #define YYMAXTOKEN 291 899 #define YYUNDFTOKEN 335 900 #define YYTRANSLATE(a) ((a) > YYMAXTOKEN ? YYUNDFTOKEN : (a)) 901 #if YYDEBUG 902 static const char *const grammar_name[] = { 903 904 "$end",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, 905 0,"'&'",0,"'('","')'","'*'",0,"','",0,0,0,0,0,0,0,0,0,0,0,0,0,0,"';'",0,"'='",0, 906 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, 907 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, 908 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, 909 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, 910 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,"error", 911 "T_IDENTIFIER","T_TYPEDEF_NAME","T_DEFINE_NAME","T_AUTO","T_EXTERN", 912 "T_REGISTER","T_STATIC","T_TYPEDEF","T_INLINE","T_EXTENSION","T_CHAR", 913 "T_DOUBLE","T_FLOAT","T_INT","T_VOID","T_LONG","T_SHORT","T_SIGNED", 914 "T_UNSIGNED","T_ENUM","T_STRUCT","T_UNION","T_Bool","T_Complex","T_Imaginary", 915 "T_TYPE_QUALIFIER","T_BRACKETS","T_LBRACE","T_MATCHRBRACE","T_ELLIPSIS", 916 "T_INITIALIZER","T_STRING_LITERAL","T_ASM","T_ASMARG","T_VA_DCL","$accept", 917 "program","decl_specifiers","decl_specifier","storage_class","type_specifier", 918 "type_qualifier","struct_or_union_specifier","enum_specifier", 919 "init_declarator_list","init_declarator","declarator","direct_declarator", 920 "abs_declarator","direct_abs_declarator","parameter_type_list","parameter_list", 921 "parameter_declaration","opt_identifier_list","identifier_list", 922 "struct_or_union","pointer","opt_type_qualifiers","type_qualifier_list", 923 "any_id","identifier_or_ref","enumeration","translation_unit", 924 "external_declaration","declaration","function_definition", 925 "linkage_specification","braces","any_typedef","opt_declarator_list","$$1", 926 "declarator_list","opt_declaration_list","$$2","$$3","$$4","declaration_list", 927 "$$5","illegal-symbol", 928 }; 929 static const char *const grammar_rule[] = { 930 "$accept : program", 931 "program :", 932 "program : translation_unit", 933 "translation_unit : external_declaration", 934 "translation_unit : translation_unit external_declaration", 935 "external_declaration : declaration", 936 "external_declaration : function_definition", 937 "external_declaration : ';'", 938 "external_declaration : linkage_specification", 939 "external_declaration : T_ASM T_ASMARG ';'", 940 "external_declaration : error T_MATCHRBRACE", 941 "external_declaration : error ';'", 942 "braces : T_LBRACE T_MATCHRBRACE", 943 "linkage_specification : T_EXTERN T_STRING_LITERAL braces", 944 "linkage_specification : T_EXTERN T_STRING_LITERAL declaration", 945 "declaration : decl_specifiers ';'", 946 "declaration : decl_specifiers init_declarator_list ';'", 947 "$$1 :", 948 "declaration : any_typedef decl_specifiers $$1 opt_declarator_list ';'", 949 "any_typedef : T_EXTENSION T_TYPEDEF", 950 "any_typedef : T_TYPEDEF", 951 "opt_declarator_list :", 952 "opt_declarator_list : declarator_list", 953 "declarator_list : declarator", 954 "declarator_list : declarator_list ',' declarator", 955 "$$2 :", 956 "$$3 :", 957 "function_definition : decl_specifiers declarator $$2 opt_declaration_list T_LBRACE $$3 T_MATCHRBRACE", 958 "$$4 :", 959 "function_definition : declarator $$4 opt_declaration_list T_LBRACE T_MATCHRBRACE", 960 "opt_declaration_list :", 961 "opt_declaration_list : T_VA_DCL", 962 "opt_declaration_list : declaration_list", 963 "declaration_list : declaration", 964 "declaration_list : declaration_list declaration", 965 "decl_specifiers : decl_specifier", 966 "decl_specifiers : decl_specifiers decl_specifier", 967 "decl_specifier : storage_class", 968 "decl_specifier : type_specifier", 969 "decl_specifier : type_qualifier", 970 "storage_class : T_AUTO", 971 "storage_class : T_EXTERN", 972 "storage_class : T_REGISTER", 973 "storage_class : T_STATIC", 974 "storage_class : T_INLINE", 975 "storage_class : T_EXTENSION", 976 "type_specifier : T_CHAR", 977 "type_specifier : T_DOUBLE", 978 "type_specifier : T_FLOAT", 979 "type_specifier : T_INT", 980 "type_specifier : T_LONG", 981 "type_specifier : T_SHORT", 982 "type_specifier : T_SIGNED", 983 "type_specifier : T_UNSIGNED", 984 "type_specifier : T_VOID", 985 "type_specifier : T_Bool", 986 "type_specifier : T_Complex", 987 "type_specifier : T_Imaginary", 988 "type_specifier : T_TYPEDEF_NAME", 989 "type_specifier : struct_or_union_specifier", 990 "type_specifier : enum_specifier", 991 "type_qualifier : T_TYPE_QUALIFIER", 992 "type_qualifier : T_DEFINE_NAME", 993 "struct_or_union_specifier : struct_or_union any_id braces", 994 "struct_or_union_specifier : struct_or_union braces", 995 "struct_or_union_specifier : struct_or_union any_id", 996 "struct_or_union : T_STRUCT", 997 "struct_or_union : T_UNION", 998 "init_declarator_list : init_declarator", 999 "init_declarator_list : init_declarator_list ',' init_declarator", 1000 "init_declarator : declarator", 1001 "$$5 :", 1002 "init_declarator : declarator '=' $$5 T_INITIALIZER", 1003 "enum_specifier : enumeration any_id braces", 1004 "enum_specifier : enumeration braces", 1005 "enum_specifier : enumeration any_id", 1006 "enumeration : T_ENUM", 1007 "any_id : T_IDENTIFIER", 1008 "any_id : T_TYPEDEF_NAME", 1009 "declarator : pointer direct_declarator", 1010 "declarator : direct_declarator", 1011 "direct_declarator : identifier_or_ref", 1012 "direct_declarator : '(' declarator ')'", 1013 "direct_declarator : direct_declarator T_BRACKETS", 1014 "direct_declarator : direct_declarator '(' parameter_type_list ')'", 1015 "direct_declarator : direct_declarator '(' opt_identifier_list ')'", 1016 "pointer : '*' opt_type_qualifiers", 1017 "pointer : '*' opt_type_qualifiers pointer", 1018 "opt_type_qualifiers :", 1019 "opt_type_qualifiers : type_qualifier_list", 1020 "type_qualifier_list : type_qualifier", 1021 "type_qualifier_list : type_qualifier_list type_qualifier", 1022 "parameter_type_list : parameter_list", 1023 "parameter_type_list : parameter_list ',' T_ELLIPSIS", 1024 "parameter_list : parameter_declaration", 1025 "parameter_list : parameter_list ',' parameter_declaration", 1026 "parameter_declaration : decl_specifiers declarator", 1027 "parameter_declaration : decl_specifiers abs_declarator", 1028 "parameter_declaration : decl_specifiers", 1029 "opt_identifier_list :", 1030 "opt_identifier_list : identifier_list", 1031 "identifier_list : any_id", 1032 "identifier_list : identifier_list ',' any_id", 1033 "identifier_or_ref : any_id", 1034 "identifier_or_ref : '&' any_id", 1035 "abs_declarator : pointer", 1036 "abs_declarator : pointer direct_abs_declarator", 1037 "abs_declarator : direct_abs_declarator", 1038 "direct_abs_declarator : '(' abs_declarator ')'", 1039 "direct_abs_declarator : direct_abs_declarator T_BRACKETS", 1040 "direct_abs_declarator : T_BRACKETS", 1041 "direct_abs_declarator : direct_abs_declarator '(' parameter_type_list ')'", 1042 "direct_abs_declarator : direct_abs_declarator '(' ')'", 1043 "direct_abs_declarator : '(' parameter_type_list ')'", 1044 "direct_abs_declarator : '(' ')'", 1045 1046 }; 1047 #endif 1048 1049 int yydebug; 1050 int yynerrs; 1051 1052 int yyerrflag; 1053 int yychar; 1054 YYSTYPE yyval; 1055 YYSTYPE yylval; 1056 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 1057 YYLTYPE yyloc; /* position returned by actions */ 1058 YYLTYPE yylloc; /* position from the lexer */ 1059 #endif 1060 1061 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 1062 #ifndef YYLLOC_DEFAULT 1063 #define YYLLOC_DEFAULT(loc, rhs, n) \ 1064 do \ 1065 { \ 1066 if (n == 0) \ 1067 { \ 1068 (loc).first_line = ((rhs)[-1]).last_line; \ 1069 (loc).first_column = ((rhs)[-1]).last_column; \ 1070 (loc).last_line = ((rhs)[-1]).last_line; \ 1071 (loc).last_column = ((rhs)[-1]).last_column; \ 1072 } \ 1073 else \ 1074 { \ 1075 (loc).first_line = ((rhs)[ 0 ]).first_line; \ 1076 (loc).first_column = ((rhs)[ 0 ]).first_column; \ 1077 (loc).last_line = ((rhs)[n-1]).last_line; \ 1078 (loc).last_column = ((rhs)[n-1]).last_column; \ 1079 } \ 1080 } while (0) 1081 #endif /* YYLLOC_DEFAULT */ 1082 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */ 1083 #if YYBTYACC 1084 1085 #ifndef YYLVQUEUEGROWTH 1086 #define YYLVQUEUEGROWTH 32 1087 #endif 1088 #endif /* YYBTYACC */ 1089 1090 /* define the initial stack-sizes */ 1091 #ifdef YYSTACKSIZE 1092 #undef YYMAXDEPTH 1093 #define YYMAXDEPTH YYSTACKSIZE 1094 #else 1095 #ifdef YYMAXDEPTH 1096 #define YYSTACKSIZE YYMAXDEPTH 1097 #else 1098 #define YYSTACKSIZE 10000 1099 #define YYMAXDEPTH 10000 1100 #endif 1101 #endif 1102 1103 #ifndef YYINITSTACKSIZE 1104 #define YYINITSTACKSIZE 200 1105 #endif 1106 1107 typedef struct { 1108 unsigned stacksize; 1109 short *s_base; 1110 short *s_mark; 1111 short *s_last; 1112 YYSTYPE *l_base; 1113 YYSTYPE *l_mark; 1114 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 1115 YYLTYPE *p_base; 1116 YYLTYPE *p_mark; 1117 #endif 1118 } YYSTACKDATA; 1119 #if YYBTYACC 1120 1121 struct YYParseState_s 1122 { 1123 struct YYParseState_s *save; /* Previously saved parser state */ 1124 YYSTACKDATA yystack; /* saved parser stack */ 1125 int state; /* saved parser state */ 1126 int errflag; /* saved error recovery status */ 1127 int lexeme; /* saved index of the conflict lexeme in the lexical queue */ 1128 YYINT ctry; /* saved index in yyctable[] for this conflict */ 1129 }; 1130 typedef struct YYParseState_s YYParseState; 1131 #endif /* YYBTYACC */ 1132 /* variables for the parser stack */ 1133 static YYSTACKDATA yystack; 1134 #if YYBTYACC 1135 1136 /* Current parser state */ 1137 static YYParseState *yyps = 0; 1138 1139 /* yypath != NULL: do the full parse, starting at *yypath parser state. */ 1140 static YYParseState *yypath = 0; 1141 1142 /* Base of the lexical value queue */ 1143 static YYSTYPE *yylvals = 0; 1144 1145 /* Current position at lexical value queue */ 1146 static YYSTYPE *yylvp = 0; 1147 1148 /* End position of lexical value queue */ 1149 static YYSTYPE *yylve = 0; 1150 1151 /* The last allocated position at the lexical value queue */ 1152 static YYSTYPE *yylvlim = 0; 1153 1154 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 1155 /* Base of the lexical position queue */ 1156 static YYLTYPE *yylpsns = 0; 1157 1158 /* Current position at lexical position queue */ 1159 static YYLTYPE *yylpp = 0; 1160 1161 /* End position of lexical position queue */ 1162 static YYLTYPE *yylpe = 0; 1163 1164 /* The last allocated position at the lexical position queue */ 1165 static YYLTYPE *yylplim = 0; 1166 #endif 1167 1168 /* Current position at lexical token queue */ 1169 static short *yylexp = 0; 1170 1171 static short *yylexemes = 0; 1172 #endif /* YYBTYACC */ 1173 #line 1014 "grammar.y" 1174 1175 /* lex.yy.c */ 1176 #define BEGIN yy_start = 1 + 2 * 1177 1178 #define CPP1 1 1179 #define INIT1 2 1180 #define INIT2 3 1181 #define CURLY 4 1182 #define LEXYACC 5 1183 #define ASM 6 1184 #define CPP_INLINE 7 1185 1186 extern char *yytext; 1187 extern FILE *yyin, *yyout; 1188 1189 static int curly; /* number of curly brace nesting levels */ 1190 static int ly_count; /* number of occurances of %% */ 1191 static int inc_depth; /* include nesting level */ 1192 static SymbolTable *included_files; /* files already included */ 1193 static int yy_start = 0; /* start state number */ 1194 1195 #define grammar_error(s) yaccError(s) 1196 1197 static void 1198 yaccError (const char *msg) 1199 { 1200 func_params = NULL; 1201 put_error(); /* tell what line we're on, and what file */ 1202 fprintf(stderr, "%s at token '%s'\n", msg, yytext); 1203 } 1204 1205 /* Initialize the table of type qualifier keywords recognized by the lexical 1206 * analyzer. 1207 */ 1208 void 1209 init_parser (void) 1210 { 1211 static const char *keywords[] = { 1212 "const", 1213 "restrict", 1214 "volatile", 1215 "interrupt", 1216 #ifdef vms 1217 "noshare", 1218 "readonly", 1219 #endif 1220 #if defined(MSDOS) || defined(OS2) 1221 "__cdecl", 1222 "__export", 1223 "__far", 1224 "__fastcall", 1225 "__fortran", 1226 "__huge", 1227 "__inline", 1228 "__interrupt", 1229 "__loadds", 1230 "__near", 1231 "__pascal", 1232 "__saveregs", 1233 "__segment", 1234 "__stdcall", 1235 "__syscall", 1236 "_cdecl", 1237 "_cs", 1238 "_ds", 1239 "_es", 1240 "_export", 1241 "_far", 1242 "_fastcall", 1243 "_fortran", 1244 "_huge", 1245 "_interrupt", 1246 "_loadds", 1247 "_near", 1248 "_pascal", 1249 "_saveregs", 1250 "_seg", 1251 "_segment", 1252 "_ss", 1253 "cdecl", 1254 "far", 1255 "huge", 1256 "near", 1257 "pascal", 1258 #ifdef OS2 1259 "__far16", 1260 #endif 1261 #endif 1262 #ifdef __GNUC__ 1263 /* gcc aliases */ 1264 "__builtin_va_arg", 1265 "__builtin_va_list", 1266 "__const", 1267 "__const__", 1268 "__inline", 1269 "__inline__", 1270 "__restrict", 1271 "__restrict__", 1272 "__volatile", 1273 "__volatile__", 1274 #endif 1275 }; 1276 unsigned i; 1277 1278 /* Initialize type qualifier table. */ 1279 type_qualifiers = new_symbol_table(); 1280 for (i = 0; i < sizeof(keywords)/sizeof(keywords[0]); ++i) { 1281 new_symbol(type_qualifiers, keywords[i], NULL, DS_NONE); 1282 } 1283 } 1284 1285 /* Process the C source file. Write function prototypes to the standard 1286 * output. Convert function definitions and write the converted source 1287 * code to a temporary file. 1288 */ 1289 void 1290 process_file (FILE *infile, char *name) 1291 { 1292 char *s; 1293 1294 if (strlen(name) > 2) { 1295 s = name + strlen(name) - 2; 1296 if (*s == '.') { 1297 ++s; 1298 if (*s == 'l' || *s == 'y') 1299 BEGIN LEXYACC; 1300 #if defined(MSDOS) || defined(OS2) 1301 if (*s == 'L' || *s == 'Y') 1302 BEGIN LEXYACC; 1303 #endif 1304 } 1305 } 1306 1307 included_files = new_symbol_table(); 1308 typedef_names = new_symbol_table(); 1309 define_names = new_symbol_table(); 1310 inc_depth = -1; 1311 curly = 0; 1312 ly_count = 0; 1313 func_params = NULL; 1314 yyin = infile; 1315 include_file(strcpy(base_file, name), func_style != FUNC_NONE); 1316 if (file_comments) { 1317 #if OPT_LINTLIBRARY 1318 if (lintLibrary()) { 1319 put_blankline(stdout); 1320 begin_tracking(); 1321 } 1322 #endif 1323 put_string(stdout, "/* "); 1324 put_string(stdout, cur_file_name()); 1325 put_string(stdout, " */\n"); 1326 } 1327 yyparse(); 1328 free_symbol_table(define_names); 1329 free_symbol_table(typedef_names); 1330 free_symbol_table(included_files); 1331 } 1332 1333 #ifdef NO_LEAKS 1334 void 1335 free_parser(void) 1336 { 1337 free_symbol_table (type_qualifiers); 1338 #ifdef FLEX_SCANNER 1339 if (yy_current_buffer != 0) 1340 yy_delete_buffer(yy_current_buffer); 1341 #endif 1342 } 1343 #endif 1344 #line 1345 "grammar.tab.c" 1345 1346 /* For use in generated program */ 1347 #define yydepth (int)(yystack.s_mark - yystack.s_base) 1348 #if YYBTYACC 1349 #define yytrial (yyps->save) 1350 #endif /* YYBTYACC */ 1351 1352 #if YYDEBUG 1353 #include <stdio.h> /* needed for printf */ 1354 #endif 1355 1356 #include <stdlib.h> /* needed for malloc, etc */ 1357 #include <string.h> /* needed for memset */ 1358 1359 /* allocate initial stack or double stack size, up to YYMAXDEPTH */ 1360 static int yygrowstack(YYSTACKDATA *data) 1361 { 1362 int i; 1363 unsigned newsize; 1364 short *newss; 1365 YYSTYPE *newvs; 1366 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 1367 YYLTYPE *newps; 1368 #endif 1369 1370 if ((newsize = data->stacksize) == 0) 1371 newsize = YYINITSTACKSIZE; 1372 else if (newsize >= YYMAXDEPTH) 1373 return YYENOMEM; 1374 else if ((newsize *= 2) > YYMAXDEPTH) 1375 newsize = YYMAXDEPTH; 1376 1377 i = (int) (data->s_mark - data->s_base); 1378 newss = (short *)realloc(data->s_base, newsize * sizeof(*newss)); 1379 if (newss == 0) 1380 return YYENOMEM; 1381 1382 data->s_base = newss; 1383 data->s_mark = newss + i; 1384 1385 newvs = (YYSTYPE *)realloc(data->l_base, newsize * sizeof(*newvs)); 1386 if (newvs == 0) 1387 return YYENOMEM; 1388 1389 data->l_base = newvs; 1390 data->l_mark = newvs + i; 1391 1392 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 1393 newps = (YYLTYPE *)realloc(data->p_base, newsize * sizeof(*newps)); 1394 if (newps == 0) 1395 return YYENOMEM; 1396 1397 data->p_base = newps; 1398 data->p_mark = newps + i; 1399 #endif 1400 1401 data->stacksize = newsize; 1402 data->s_last = data->s_base + newsize - 1; 1403 1404 #if YYDEBUG 1405 if (yydebug) 1406 fprintf(stderr, "%sdebug: stack size increased to %d\n", YYPREFIX, newsize); 1407 #endif 1408 return 0; 1409 } 1410 1411 #if YYPURE || defined(YY_NO_LEAKS) 1412 static void yyfreestack(YYSTACKDATA *data) 1413 { 1414 free(data->s_base); 1415 free(data->l_base); 1416 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 1417 free(data->p_base); 1418 #endif 1419 memset(data, 0, sizeof(*data)); 1420 } 1421 #else 1422 #define yyfreestack(data) /* nothing */ 1423 #endif /* YYPURE || defined(YY_NO_LEAKS) */ 1424 #if YYBTYACC 1425 1426 static YYParseState * 1427 yyNewState(unsigned size) 1428 { 1429 YYParseState *p = (YYParseState *) malloc(sizeof(YYParseState)); 1430 if (p == NULL) return NULL; 1431 1432 p->yystack.stacksize = size; 1433 if (size == 0) 1434 { 1435 p->yystack.s_base = NULL; 1436 p->yystack.l_base = NULL; 1437 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 1438 p->yystack.p_base = NULL; 1439 #endif 1440 return p; 1441 } 1442 p->yystack.s_base = (short *) malloc(size * sizeof(short)); 1443 if (p->yystack.s_base == NULL) return NULL; 1444 p->yystack.l_base = (YYSTYPE *) malloc(size * sizeof(YYSTYPE)); 1445 if (p->yystack.l_base == NULL) return NULL; 1446 memset(p->yystack.l_base, 0, size * sizeof(YYSTYPE)); 1447 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 1448 p->yystack.p_base = (YYLTYPE *) malloc(size * sizeof(YYLTYPE)); 1449 if (p->yystack.p_base == NULL) return NULL; 1450 memset(p->yystack.p_base, 0, size * sizeof(YYLTYPE)); 1451 #endif 1452 1453 return p; 1454 } 1455 1456 static void 1457 yyFreeState(YYParseState *p) 1458 { 1459 yyfreestack(&p->yystack); 1460 free(p); 1461 } 1462 #endif /* YYBTYACC */ 1463 1464 #define YYABORT goto yyabort 1465 #define YYREJECT goto yyabort 1466 #define YYACCEPT goto yyaccept 1467 #define YYERROR goto yyerrlab 1468 #if YYBTYACC 1469 #define YYVALID do { if (yyps->save) goto yyvalid; } while(0) 1470 #define YYVALID_NESTED do { if (yyps->save && \ 1471 yyps->save->save == 0) goto yyvalid; } while(0) 1472 #endif /* YYBTYACC */ 1473 1474 int 1475 YYPARSE_DECL() 1476 { 1477 int yym, yyn, yystate, yyresult; 1478 #if YYBTYACC 1479 int yynewerrflag; 1480 YYParseState *yyerrctx = NULL; 1481 #endif /* YYBTYACC */ 1482 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 1483 YYLTYPE yyerror_loc_range[2]; /* position of error start & end */ 1484 #endif 1485 #if YYDEBUG 1486 const char *yys; 1487 1488 if ((yys = getenv("YYDEBUG")) != 0) 1489 { 1490 yyn = *yys; 1491 if (yyn >= '0' && yyn <= '9') 1492 yydebug = yyn - '0'; 1493 } 1494 if (yydebug) 1495 fprintf(stderr, "%sdebug[<# of symbols on state stack>]\n", YYPREFIX); 1496 #endif 1497 1498 #if YYBTYACC 1499 yyps = yyNewState(0); if (yyps == 0) goto yyenomem; 1500 yyps->save = 0; 1501 #endif /* YYBTYACC */ 1502 yynerrs = 0; 1503 yyerrflag = 0; 1504 yychar = YYEMPTY; 1505 yystate = 0; 1506 1507 #if YYPURE 1508 memset(&yystack, 0, sizeof(yystack)); 1509 #endif 1510 1511 if (yystack.s_base == NULL && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow; 1512 yystack.s_mark = yystack.s_base; 1513 yystack.l_mark = yystack.l_base; 1514 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 1515 yystack.p_mark = yystack.p_base; 1516 #endif 1517 yystate = 0; 1518 *yystack.s_mark = 0; 1519 1520 yyloop: 1521 if ((yyn = yydefred[yystate]) != 0) goto yyreduce; 1522 if (yychar < 0) 1523 { 1524 #if YYBTYACC 1525 do { 1526 if (yylvp < yylve) 1527 { 1528 /* we're currently re-reading tokens */ 1529 yylval = *yylvp++; 1530 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 1531 yylloc = *yylpp++; 1532 #endif 1533 yychar = *yylexp++; 1534 break; 1535 } 1536 if (yyps->save) 1537 { 1538 /* in trial mode; save scanner results for future parse attempts */ 1539 if (yylvp == yylvlim) 1540 { /* Enlarge lexical value queue */ 1541 size_t p = (size_t) (yylvp - yylvals); 1542 size_t s = (size_t) (yylvlim - yylvals); 1543 1544 s += YYLVQUEUEGROWTH; 1545 if ((yylexemes = (short *) realloc(yylexemes, s * sizeof(short))) == NULL) goto yyenomem; 1546 if ((yylvals = (YYSTYPE *) realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) goto yyenomem; 1547 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 1548 if ((yylpsns = (YYLTYPE *) realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) goto yyenomem; 1549 #endif 1550 yylvp = yylve = yylvals + p; 1551 yylvlim = yylvals + s; 1552 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 1553 yylpp = yylpe = yylpsns + p; 1554 yylplim = yylpsns + s; 1555 #endif 1556 yylexp = yylexemes + p; 1557 } 1558 *yylexp = (short) YYLEX; 1559 *yylvp++ = yylval; 1560 yylve++; 1561 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 1562 *yylpp++ = yylloc; 1563 yylpe++; 1564 #endif 1565 yychar = *yylexp++; 1566 break; 1567 } 1568 /* normal operation, no conflict encountered */ 1569 #endif /* YYBTYACC */ 1570 yychar = YYLEX; 1571 #if YYBTYACC 1572 } while (0); 1573 #endif /* YYBTYACC */ 1574 if (yychar < 0) yychar = YYEOF; 1575 /* if ((yychar = YYLEX) < 0) yychar = YYEOF; */ 1576 #if YYDEBUG 1577 if (yydebug) 1578 { 1579 yys = yyname[YYTRANSLATE(yychar)]; 1580 fprintf(stderr, "%s[%d]: state %d, reading token %d (%s)", 1581 YYDEBUGSTR, yydepth, yystate, yychar, yys); 1582 #ifdef YYSTYPE_TOSTRING 1583 #if YYBTYACC 1584 if (!yytrial) 1585 #endif /* YYBTYACC */ 1586 fprintf(stderr, " <%s>", YYSTYPE_TOSTRING(yychar, yylval)); 1587 #endif 1588 fputc('\n', stderr); 1589 } 1590 #endif 1591 } 1592 #if YYBTYACC 1593 1594 /* Do we have a conflict? */ 1595 if (((yyn = yycindex[yystate]) != 0) && (yyn += yychar) >= 0 && 1596 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar) 1597 { 1598 YYINT ctry; 1599 1600 if (yypath) 1601 { 1602 YYParseState *save; 1603 #if YYDEBUG 1604 if (yydebug) 1605 fprintf(stderr, "%s[%d]: CONFLICT in state %d: following successful trial parse\n", 1606 YYDEBUGSTR, yydepth, yystate); 1607 #endif 1608 /* Switch to the next conflict context */ 1609 save = yypath; 1610 yypath = save->save; 1611 save->save = NULL; 1612 ctry = save->ctry; 1613 if (save->state != yystate) YYABORT; 1614 yyFreeState(save); 1615 1616 } 1617 else 1618 { 1619 1620 /* Unresolved conflict - start/continue trial parse */ 1621 YYParseState *save; 1622 #if YYDEBUG 1623 if (yydebug) 1624 { 1625 fprintf(stderr, "%s[%d]: CONFLICT in state %d. ", YYDEBUGSTR, yydepth, yystate); 1626 if (yyps->save) 1627 fputs("ALREADY in conflict, continuing trial parse.\n", stderr); 1628 else 1629 fputs("Starting trial parse.\n", stderr); 1630 } 1631 #endif 1632 save = yyNewState((unsigned)(yystack.s_mark - yystack.s_base + 1)); 1633 if (save == NULL) goto yyenomem; 1634 save->save = yyps->save; 1635 save->state = yystate; 1636 save->errflag = yyerrflag; 1637 save->yystack.s_mark = save->yystack.s_base + (yystack.s_mark - yystack.s_base); 1638 memcpy (save->yystack.s_base, yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); 1639 save->yystack.l_mark = save->yystack.l_base + (yystack.l_mark - yystack.l_base); 1640 memcpy (save->yystack.l_base, yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); 1641 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 1642 save->yystack.p_mark = save->yystack.p_base + (yystack.p_mark - yystack.p_base); 1643 memcpy (save->yystack.p_base, yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); 1644 #endif 1645 ctry = yytable[yyn]; 1646 if (yyctable[ctry] == -1) 1647 { 1648 #if YYDEBUG 1649 if (yydebug && yychar >= YYEOF) 1650 fprintf(stderr, "%s[%d]: backtracking 1 token\n", YYDEBUGSTR, yydepth); 1651 #endif 1652 ctry++; 1653 } 1654 save->ctry = ctry; 1655 if (yyps->save == NULL) 1656 { 1657 /* If this is a first conflict in the stack, start saving lexemes */ 1658 if (!yylexemes) 1659 { 1660 yylexemes = (short *) malloc((YYLVQUEUEGROWTH) * sizeof(short)); 1661 if (yylexemes == NULL) goto yyenomem; 1662 yylvals = (YYSTYPE *) malloc((YYLVQUEUEGROWTH) * sizeof(YYSTYPE)); 1663 if (yylvals == NULL) goto yyenomem; 1664 yylvlim = yylvals + YYLVQUEUEGROWTH; 1665 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 1666 yylpsns = (YYLTYPE *) malloc((YYLVQUEUEGROWTH) * sizeof(YYLTYPE)); 1667 if (yylpsns == NULL) goto yyenomem; 1668 yylplim = yylpsns + YYLVQUEUEGROWTH; 1669 #endif 1670 } 1671 if (yylvp == yylve) 1672 { 1673 yylvp = yylve = yylvals; 1674 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 1675 yylpp = yylpe = yylpsns; 1676 #endif 1677 yylexp = yylexemes; 1678 if (yychar >= YYEOF) 1679 { 1680 *yylve++ = yylval; 1681 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 1682 *yylpe++ = yylloc; 1683 #endif 1684 *yylexp = (short) yychar; 1685 yychar = YYEMPTY; 1686 } 1687 } 1688 } 1689 if (yychar >= YYEOF) 1690 { 1691 yylvp--; 1692 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 1693 yylpp--; 1694 #endif 1695 yylexp--; 1696 yychar = YYEMPTY; 1697 } 1698 save->lexeme = (int) (yylvp - yylvals); 1699 yyps->save = save; 1700 } 1701 if (yytable[yyn] == ctry) 1702 { 1703 #if YYDEBUG 1704 if (yydebug) 1705 fprintf(stderr, "%s[%d]: state %d, shifting to state %d\n", 1706 YYDEBUGSTR, yydepth, yystate, yyctable[ctry]); 1707 #endif 1708 if (yychar < 0) 1709 { 1710 yylvp++; 1711 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 1712 yylpp++; 1713 #endif 1714 yylexp++; 1715 } 1716 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) 1717 goto yyoverflow; 1718 yystate = yyctable[ctry]; 1719 *++yystack.s_mark = (short) yystate; 1720 *++yystack.l_mark = yylval; 1721 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 1722 *++yystack.p_mark = yylloc; 1723 #endif 1724 yychar = YYEMPTY; 1725 if (yyerrflag > 0) --yyerrflag; 1726 goto yyloop; 1727 } 1728 else 1729 { 1730 yyn = yyctable[ctry]; 1731 goto yyreduce; 1732 } 1733 } /* End of code dealing with conflicts */ 1734 #endif /* YYBTYACC */ 1735 if (((yyn = yysindex[yystate]) != 0) && (yyn += yychar) >= 0 && 1736 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar) 1737 { 1738 #if YYDEBUG 1739 if (yydebug) 1740 fprintf(stderr, "%s[%d]: state %d, shifting to state %d\n", 1741 YYDEBUGSTR, yydepth, yystate, yytable[yyn]); 1742 #endif 1743 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow; 1744 yystate = yytable[yyn]; 1745 *++yystack.s_mark = yytable[yyn]; 1746 *++yystack.l_mark = yylval; 1747 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 1748 *++yystack.p_mark = yylloc; 1749 #endif 1750 yychar = YYEMPTY; 1751 if (yyerrflag > 0) --yyerrflag; 1752 goto yyloop; 1753 } 1754 if (((yyn = yyrindex[yystate]) != 0) && (yyn += yychar) >= 0 && 1755 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar) 1756 { 1757 yyn = yytable[yyn]; 1758 goto yyreduce; 1759 } 1760 if (yyerrflag != 0) goto yyinrecovery; 1761 #if YYBTYACC 1762 1763 yynewerrflag = 1; 1764 goto yyerrhandler; 1765 goto yyerrlab; 1766 1767 yyerrlab: 1768 yynewerrflag = 0; 1769 yyerrhandler: 1770 while (yyps->save) 1771 { 1772 int ctry; 1773 YYParseState *save = yyps->save; 1774 #if YYDEBUG 1775 if (yydebug) 1776 fprintf(stderr, "%s[%d]: ERROR in state %d, CONFLICT BACKTRACKING to state %d, %d tokens\n", 1777 YYDEBUGSTR, yydepth, yystate, yyps->save->state, 1778 (int)(yylvp - yylvals - yyps->save->lexeme)); 1779 #endif 1780 /* Memorize most forward-looking error state in case it's really an error. */ 1781 if (yyerrctx == NULL || yyerrctx->lexeme < yylvp - yylvals) 1782 { 1783 /* Free old saved error context state */ 1784 if (yyerrctx) yyFreeState(yyerrctx); 1785 /* Create and fill out new saved error context state */ 1786 yyerrctx = yyNewState((unsigned)(yystack.s_mark - yystack.s_base + 1)); 1787 if (yyerrctx == NULL) goto yyenomem; 1788 yyerrctx->save = yyps->save; 1789 yyerrctx->state = yystate; 1790 yyerrctx->errflag = yyerrflag; 1791 yyerrctx->yystack.s_mark = yyerrctx->yystack.s_base + (yystack.s_mark - yystack.s_base); 1792 memcpy (yyerrctx->yystack.s_base, yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); 1793 yyerrctx->yystack.l_mark = yyerrctx->yystack.l_base + (yystack.l_mark - yystack.l_base); 1794 memcpy (yyerrctx->yystack.l_base, yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); 1795 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 1796 yyerrctx->yystack.p_mark = yyerrctx->yystack.p_base + (yystack.p_mark - yystack.p_base); 1797 memcpy (yyerrctx->yystack.p_base, yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); 1798 #endif 1799 yyerrctx->lexeme = (int) (yylvp - yylvals); 1800 } 1801 yylvp = yylvals + save->lexeme; 1802 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 1803 yylpp = yylpsns + save->lexeme; 1804 #endif 1805 yylexp = yylexemes + save->lexeme; 1806 yychar = YYEMPTY; 1807 yystack.s_mark = yystack.s_base + (save->yystack.s_mark - save->yystack.s_base); 1808 memcpy (yystack.s_base, save->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); 1809 yystack.l_mark = yystack.l_base + (save->yystack.l_mark - save->yystack.l_base); 1810 memcpy (yystack.l_base, save->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); 1811 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 1812 yystack.p_mark = yystack.p_base + (save->yystack.p_mark - save->yystack.p_base); 1813 memcpy (yystack.p_base, save->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); 1814 #endif 1815 ctry = ++save->ctry; 1816 yystate = save->state; 1817 /* We tried shift, try reduce now */ 1818 if ((yyn = yyctable[ctry]) >= 0) goto yyreduce; 1819 yyps->save = save->save; 1820 save->save = NULL; 1821 yyFreeState(save); 1822 1823 /* Nothing left on the stack -- error */ 1824 if (!yyps->save) 1825 { 1826 #if YYDEBUG 1827 if (yydebug) 1828 fprintf(stderr, "%sdebug[%d,trial]: trial parse FAILED, entering ERROR mode\n", 1829 YYPREFIX, yydepth); 1830 #endif 1831 /* Restore state as it was in the most forward-advanced error */ 1832 yylvp = yylvals + yyerrctx->lexeme; 1833 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 1834 yylpp = yylpsns + yyerrctx->lexeme; 1835 #endif 1836 yylexp = yylexemes + yyerrctx->lexeme; 1837 yychar = yylexp[-1]; 1838 yylval = yylvp[-1]; 1839 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 1840 yylloc = yylpp[-1]; 1841 #endif 1842 yystack.s_mark = yystack.s_base + (yyerrctx->yystack.s_mark - yyerrctx->yystack.s_base); 1843 memcpy (yystack.s_base, yyerrctx->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); 1844 yystack.l_mark = yystack.l_base + (yyerrctx->yystack.l_mark - yyerrctx->yystack.l_base); 1845 memcpy (yystack.l_base, yyerrctx->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); 1846 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 1847 yystack.p_mark = yystack.p_base + (yyerrctx->yystack.p_mark - yyerrctx->yystack.p_base); 1848 memcpy (yystack.p_base, yyerrctx->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); 1849 #endif 1850 yystate = yyerrctx->state; 1851 yyFreeState(yyerrctx); 1852 yyerrctx = NULL; 1853 } 1854 yynewerrflag = 1; 1855 } 1856 if (yynewerrflag == 0) goto yyinrecovery; 1857 #endif /* YYBTYACC */ 1858 1859 YYERROR_CALL("syntax error"); 1860 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 1861 yyerror_loc_range[0] = yylloc; /* lookahead position is error start position */ 1862 #endif 1863 1864 #if !YYBTYACC 1865 goto yyerrlab; 1866 yyerrlab: 1867 #endif 1868 ++yynerrs; 1869 1870 yyinrecovery: 1871 if (yyerrflag < 3) 1872 { 1873 yyerrflag = 3; 1874 for (;;) 1875 { 1876 if (((yyn = yysindex[*yystack.s_mark]) != 0) && (yyn += YYERRCODE) >= 0 && 1877 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) YYERRCODE) 1878 { 1879 #if YYDEBUG 1880 if (yydebug) 1881 fprintf(stderr, "%s[%d]: state %d, error recovery shifting to state %d\n", 1882 YYDEBUGSTR, yydepth, *yystack.s_mark, yytable[yyn]); 1883 #endif 1884 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow; 1885 yystate = yytable[yyn]; 1886 *++yystack.s_mark = yytable[yyn]; 1887 *++yystack.l_mark = yylval; 1888 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 1889 /* lookahead position is error end position */ 1890 yyerror_loc_range[1] = yylloc; 1891 YYLLOC_DEFAULT(yyloc, yyerror_loc_range, 2); /* position of error span */ 1892 *++yystack.p_mark = yyloc; 1893 #endif 1894 goto yyloop; 1895 } 1896 else 1897 { 1898 #if YYDEBUG 1899 if (yydebug) 1900 fprintf(stderr, "%s[%d]: error recovery discarding state %d\n", 1901 YYDEBUGSTR, yydepth, *yystack.s_mark); 1902 #endif 1903 if (yystack.s_mark <= yystack.s_base) goto yyabort; 1904 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 1905 /* the current TOS position is the error start position */ 1906 yyerror_loc_range[0] = *yystack.p_mark; 1907 #endif 1908 #if defined(YYDESTRUCT_CALL) 1909 #if YYBTYACC 1910 if (!yytrial) 1911 #endif /* YYBTYACC */ 1912 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 1913 YYDESTRUCT_CALL("error: discarding state", 1914 yystos[*yystack.s_mark], yystack.l_mark, yystack.p_mark); 1915 #else 1916 YYDESTRUCT_CALL("error: discarding state", 1917 yystos[*yystack.s_mark], yystack.l_mark); 1918 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */ 1919 #endif /* defined(YYDESTRUCT_CALL) */ 1920 --yystack.s_mark; 1921 --yystack.l_mark; 1922 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 1923 --yystack.p_mark; 1924 #endif 1925 } 1926 } 1927 } 1928 else 1929 { 1930 if (yychar == YYEOF) goto yyabort; 1931 #if YYDEBUG 1932 if (yydebug) 1933 { 1934 yys = yyname[YYTRANSLATE(yychar)]; 1935 fprintf(stderr, "%s[%d]: state %d, error recovery discarding token %d (%s)\n", 1936 YYDEBUGSTR, yydepth, yystate, yychar, yys); 1937 } 1938 #endif 1939 #if defined(YYDESTRUCT_CALL) 1940 #if YYBTYACC 1941 if (!yytrial) 1942 #endif /* YYBTYACC */ 1943 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 1944 YYDESTRUCT_CALL("error: discarding token", yychar, &yylval, &yylloc); 1945 #else 1946 YYDESTRUCT_CALL("error: discarding token", yychar, &yylval); 1947 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */ 1948 #endif /* defined(YYDESTRUCT_CALL) */ 1949 yychar = YYEMPTY; 1950 goto yyloop; 1951 } 1952 1953 yyreduce: 1954 yym = yylen[yyn]; 1955 #if YYDEBUG 1956 if (yydebug) 1957 { 1958 fprintf(stderr, "%s[%d]: state %d, reducing by rule %d (%s)", 1959 YYDEBUGSTR, yydepth, yystate, yyn, yyrule[yyn]); 1960 #ifdef YYSTYPE_TOSTRING 1961 #if YYBTYACC 1962 if (!yytrial) 1963 #endif /* YYBTYACC */ 1964 if (yym > 0) 1965 { 1966 int i; 1967 fputc('<', stderr); 1968 for (i = yym; i > 0; i--) 1969 { 1970 if (i != yym) fputs(", ", stderr); 1971 fputs(YYSTYPE_TOSTRING(yystos[yystack.s_mark[1-i]], 1972 yystack.l_mark[1-i]), stderr); 1973 } 1974 fputc('>', stderr); 1975 } 1976 #endif 1977 fputc('\n', stderr); 1978 } 1979 #endif 1980 if (yym > 0) 1981 yyval = yystack.l_mark[1-yym]; 1982 else 1983 memset(&yyval, 0, sizeof yyval); 1984 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 1985 1986 /* Perform position reduction */ 1987 memset(&yyloc, 0, sizeof(yyloc)); 1988 #if YYBTYACC 1989 if (!yytrial) 1990 #endif /* YYBTYACC */ 1991 { 1992 YYLLOC_DEFAULT(yyloc, &yystack.p_mark[1-yym], yym); 1993 /* just in case YYERROR is invoked within the action, save 1994 the start of the rhs as the error start position */ 1995 yyerror_loc_range[0] = yystack.p_mark[1-yym]; 1996 } 1997 #endif 1998 1999 switch (yyn) 2000 { 2001 case 10: 2002 #line 377 "grammar.y" 2003 { 2004 yyerrok; 2005 } 2006 break; 2007 case 11: 2008 #line 381 "grammar.y" 2009 { 2010 yyerrok; 2011 } 2012 break; 2013 case 13: 2014 #line 392 "grammar.y" 2015 { 2016 /* Provide an empty action here so bison will not complain about 2017 * incompatible types in the default action it normally would 2018 * have generated. 2019 */ 2020 } 2021 break; 2022 case 14: 2023 #line 399 "grammar.y" 2024 { 2025 /* empty */ 2026 } 2027 break; 2028 case 15: 2029 #line 406 "grammar.y" 2030 { 2031 #if OPT_LINTLIBRARY 2032 if (types_out && want_typedef()) { 2033 gen_declarations(&yystack.l_mark[-1].decl_spec, (DeclaratorList *)0); 2034 flush_varargs(); 2035 } 2036 #endif 2037 free_decl_spec(&yystack.l_mark[-1].decl_spec); 2038 end_typedef(); 2039 } 2040 break; 2041 case 16: 2042 #line 417 "grammar.y" 2043 { 2044 if (func_params != NULL) { 2045 set_param_types(func_params, &yystack.l_mark[-2].decl_spec, &yystack.l_mark[-1].decl_list); 2046 } else { 2047 gen_declarations(&yystack.l_mark[-2].decl_spec, &yystack.l_mark[-1].decl_list); 2048 #if OPT_LINTLIBRARY 2049 flush_varargs(); 2050 #endif 2051 free_decl_list(&yystack.l_mark[-1].decl_list); 2052 } 2053 free_decl_spec(&yystack.l_mark[-2].decl_spec); 2054 end_typedef(); 2055 } 2056 break; 2057 case 17: 2058 #line 431 "grammar.y" 2059 { 2060 cur_decl_spec_flags = yystack.l_mark[0].decl_spec.flags; 2061 free_decl_spec(&yystack.l_mark[0].decl_spec); 2062 } 2063 break; 2064 case 18: 2065 #line 436 "grammar.y" 2066 { 2067 end_typedef(); 2068 } 2069 break; 2070 case 19: 2071 #line 443 "grammar.y" 2072 { 2073 begin_typedef(); 2074 } 2075 break; 2076 case 20: 2077 #line 447 "grammar.y" 2078 { 2079 begin_typedef(); 2080 } 2081 break; 2082 case 23: 2083 #line 459 "grammar.y" 2084 { 2085 int flags = cur_decl_spec_flags; 2086 2087 /* If the typedef is a pointer type, then reset the short type 2088 * flags so it does not get promoted. 2089 */ 2090 if (strcmp(yystack.l_mark[0].declarator->text, yystack.l_mark[0].declarator->name) != 0) 2091 flags &= ~(DS_CHAR | DS_SHORT | DS_FLOAT); 2092 new_symbol(typedef_names, yystack.l_mark[0].declarator->name, NULL, flags); 2093 free_declarator(yystack.l_mark[0].declarator); 2094 } 2095 break; 2096 case 24: 2097 #line 471 "grammar.y" 2098 { 2099 int flags = cur_decl_spec_flags; 2100 2101 if (strcmp(yystack.l_mark[0].declarator->text, yystack.l_mark[0].declarator->name) != 0) 2102 flags &= ~(DS_CHAR | DS_SHORT | DS_FLOAT); 2103 new_symbol(typedef_names, yystack.l_mark[0].declarator->name, NULL, flags); 2104 free_declarator(yystack.l_mark[0].declarator); 2105 } 2106 break; 2107 case 25: 2108 #line 483 "grammar.y" 2109 { 2110 check_untagged(&yystack.l_mark[-1].decl_spec); 2111 if (yystack.l_mark[0].declarator->func_def == FUNC_NONE) { 2112 yyerror("syntax error"); 2113 YYERROR; 2114 } 2115 func_params = &(yystack.l_mark[0].declarator->head->params); 2116 func_params->begin_comment = cur_file->begin_comment; 2117 func_params->end_comment = cur_file->end_comment; 2118 } 2119 break; 2120 case 26: 2121 #line 494 "grammar.y" 2122 { 2123 /* If we're converting to K&R and we've got a nominally K&R 2124 * function which has a parameter which is ANSI (i.e., a prototyped 2125 * function pointer), then we must override the deciphered value of 2126 * 'func_def' so that the parameter will be converted. 2127 */ 2128 if (func_style == FUNC_TRADITIONAL 2129 && haveAnsiParam() 2130 && yystack.l_mark[-3].declarator->head->func_def == func_style) { 2131 yystack.l_mark[-3].declarator->head->func_def = FUNC_BOTH; 2132 } 2133 2134 func_params = NULL; 2135 2136 if (cur_file->convert) 2137 gen_func_definition(&yystack.l_mark[-4].decl_spec, yystack.l_mark[-3].declarator); 2138 gen_prototype(&yystack.l_mark[-4].decl_spec, yystack.l_mark[-3].declarator); 2139 #if OPT_LINTLIBRARY 2140 flush_varargs(); 2141 #endif 2142 free_decl_spec(&yystack.l_mark[-4].decl_spec); 2143 free_declarator(yystack.l_mark[-3].declarator); 2144 } 2145 break; 2146 case 28: 2147 #line 519 "grammar.y" 2148 { 2149 if (yystack.l_mark[0].declarator->func_def == FUNC_NONE) { 2150 yyerror("syntax error"); 2151 YYERROR; 2152 } 2153 func_params = &(yystack.l_mark[0].declarator->head->params); 2154 func_params->begin_comment = cur_file->begin_comment; 2155 func_params->end_comment = cur_file->end_comment; 2156 } 2157 break; 2158 case 29: 2159 #line 529 "grammar.y" 2160 { 2161 DeclSpec decl_spec; 2162 2163 func_params = NULL; 2164 2165 new_decl_spec(&decl_spec, dft_decl_spec(), yystack.l_mark[-4].declarator->begin, DS_NONE); 2166 if (cur_file->convert) 2167 gen_func_definition(&decl_spec, yystack.l_mark[-4].declarator); 2168 gen_prototype(&decl_spec, yystack.l_mark[-4].declarator); 2169 #if OPT_LINTLIBRARY 2170 flush_varargs(); 2171 #endif 2172 free_decl_spec(&decl_spec); 2173 free_declarator(yystack.l_mark[-4].declarator); 2174 } 2175 break; 2176 case 36: 2177 #line 560 "grammar.y" 2178 { 2179 join_decl_specs(&yyval.decl_spec, &yystack.l_mark[-1].decl_spec, &yystack.l_mark[0].decl_spec); 2180 free(yystack.l_mark[-1].decl_spec.text); 2181 free(yystack.l_mark[0].decl_spec.text); 2182 } 2183 break; 2184 case 40: 2185 #line 575 "grammar.y" 2186 { 2187 new_decl_spec(&yyval.decl_spec, yystack.l_mark[0].text.text, yystack.l_mark[0].text.begin, DS_NONE); 2188 } 2189 break; 2190 case 41: 2191 #line 579 "grammar.y" 2192 { 2193 new_decl_spec(&yyval.decl_spec, yystack.l_mark[0].text.text, yystack.l_mark[0].text.begin, DS_EXTERN); 2194 } 2195 break; 2196 case 42: 2197 #line 583 "grammar.y" 2198 { 2199 new_decl_spec(&yyval.decl_spec, yystack.l_mark[0].text.text, yystack.l_mark[0].text.begin, DS_NONE); 2200 } 2201 break; 2202 case 43: 2203 #line 587 "grammar.y" 2204 { 2205 new_decl_spec(&yyval.decl_spec, yystack.l_mark[0].text.text, yystack.l_mark[0].text.begin, DS_STATIC); 2206 } 2207 break; 2208 case 44: 2209 #line 591 "grammar.y" 2210 { 2211 new_decl_spec(&yyval.decl_spec, yystack.l_mark[0].text.text, yystack.l_mark[0].text.begin, DS_INLINE); 2212 } 2213 break; 2214 case 45: 2215 #line 595 "grammar.y" 2216 { 2217 new_decl_spec(&yyval.decl_spec, yystack.l_mark[0].text.text, yystack.l_mark[0].text.begin, DS_JUNK); 2218 } 2219 break; 2220 case 46: 2221 #line 602 "grammar.y" 2222 { 2223 new_decl_spec(&yyval.decl_spec, yystack.l_mark[0].text.text, yystack.l_mark[0].text.begin, DS_CHAR); 2224 } 2225 break; 2226 case 47: 2227 #line 606 "grammar.y" 2228 { 2229 new_decl_spec(&yyval.decl_spec, yystack.l_mark[0].text.text, yystack.l_mark[0].text.begin, DS_NONE); 2230 } 2231 break; 2232 case 48: 2233 #line 610 "grammar.y" 2234 { 2235 new_decl_spec(&yyval.decl_spec, yystack.l_mark[0].text.text, yystack.l_mark[0].text.begin, DS_FLOAT); 2236 } 2237 break; 2238 case 49: 2239 #line 614 "grammar.y" 2240 { 2241 new_decl_spec(&yyval.decl_spec, yystack.l_mark[0].text.text, yystack.l_mark[0].text.begin, DS_NONE); 2242 } 2243 break; 2244 case 50: 2245 #line 618 "grammar.y" 2246 { 2247 new_decl_spec(&yyval.decl_spec, yystack.l_mark[0].text.text, yystack.l_mark[0].text.begin, DS_NONE); 2248 } 2249 break; 2250 case 51: 2251 #line 622 "grammar.y" 2252 { 2253 new_decl_spec(&yyval.decl_spec, yystack.l_mark[0].text.text, yystack.l_mark[0].text.begin, DS_SHORT); 2254 } 2255 break; 2256 case 52: 2257 #line 626 "grammar.y" 2258 { 2259 new_decl_spec(&yyval.decl_spec, yystack.l_mark[0].text.text, yystack.l_mark[0].text.begin, DS_NONE); 2260 } 2261 break; 2262 case 53: 2263 #line 630 "grammar.y" 2264 { 2265 new_decl_spec(&yyval.decl_spec, yystack.l_mark[0].text.text, yystack.l_mark[0].text.begin, DS_NONE); 2266 } 2267 break; 2268 case 54: 2269 #line 634 "grammar.y" 2270 { 2271 new_decl_spec(&yyval.decl_spec, yystack.l_mark[0].text.text, yystack.l_mark[0].text.begin, DS_NONE); 2272 } 2273 break; 2274 case 55: 2275 #line 638 "grammar.y" 2276 { 2277 new_decl_spec(&yyval.decl_spec, yystack.l_mark[0].text.text, yystack.l_mark[0].text.begin, DS_CHAR); 2278 } 2279 break; 2280 case 56: 2281 #line 642 "grammar.y" 2282 { 2283 new_decl_spec(&yyval.decl_spec, yystack.l_mark[0].text.text, yystack.l_mark[0].text.begin, DS_NONE); 2284 } 2285 break; 2286 case 57: 2287 #line 646 "grammar.y" 2288 { 2289 new_decl_spec(&yyval.decl_spec, yystack.l_mark[0].text.text, yystack.l_mark[0].text.begin, DS_NONE); 2290 } 2291 break; 2292 case 58: 2293 #line 650 "grammar.y" 2294 { 2295 Symbol *s; 2296 s = find_symbol(typedef_names, yystack.l_mark[0].text.text); 2297 if (s != NULL) 2298 new_decl_spec(&yyval.decl_spec, yystack.l_mark[0].text.text, yystack.l_mark[0].text.begin, s->flags); 2299 } 2300 break; 2301 case 61: 2302 #line 662 "grammar.y" 2303 { 2304 new_decl_spec(&yyval.decl_spec, yystack.l_mark[0].text.text, yystack.l_mark[0].text.begin, DS_NONE); 2305 } 2306 break; 2307 case 62: 2308 #line 666 "grammar.y" 2309 { 2310 /* This rule allows the <pointer> nonterminal to scan #define 2311 * names as if they were type modifiers. 2312 */ 2313 Symbol *s; 2314 s = find_symbol(define_names, yystack.l_mark[0].text.text); 2315 if (s != NULL) 2316 new_decl_spec(&yyval.decl_spec, yystack.l_mark[0].text.text, yystack.l_mark[0].text.begin, s->flags); 2317 } 2318 break; 2319 case 63: 2320 #line 679 "grammar.y" 2321 { 2322 char *s; 2323 if ((s = implied_typedef()) == 0) 2324 (void)sprintf(s = buf, "%s %s", yystack.l_mark[-2].text.text, yystack.l_mark[-1].text.text); 2325 new_decl_spec(&yyval.decl_spec, s, yystack.l_mark[-2].text.begin, DS_NONE); 2326 } 2327 break; 2328 case 64: 2329 #line 686 "grammar.y" 2330 { 2331 char *s; 2332 if ((s = implied_typedef()) == 0) 2333 (void)sprintf(s = buf, "%s {}", yystack.l_mark[-1].text.text); 2334 new_decl_spec(&yyval.decl_spec, s, yystack.l_mark[-1].text.begin, DS_NONE); 2335 } 2336 break; 2337 case 65: 2338 #line 693 "grammar.y" 2339 { 2340 (void)sprintf(buf, "%s %s", yystack.l_mark[-1].text.text, yystack.l_mark[0].text.text); 2341 new_decl_spec(&yyval.decl_spec, buf, yystack.l_mark[-1].text.begin, DS_NONE); 2342 } 2343 break; 2344 case 66: 2345 #line 701 "grammar.y" 2346 { 2347 imply_typedef(yyval.text.text); 2348 } 2349 break; 2350 case 67: 2351 #line 705 "grammar.y" 2352 { 2353 imply_typedef(yyval.text.text); 2354 } 2355 break; 2356 case 68: 2357 #line 712 "grammar.y" 2358 { 2359 new_decl_list(&yyval.decl_list, yystack.l_mark[0].declarator); 2360 } 2361 break; 2362 case 69: 2363 #line 716 "grammar.y" 2364 { 2365 add_decl_list(&yyval.decl_list, &yystack.l_mark[-2].decl_list, yystack.l_mark[0].declarator); 2366 } 2367 break; 2368 case 70: 2369 #line 723 "grammar.y" 2370 { 2371 if (yystack.l_mark[0].declarator->func_def != FUNC_NONE && func_params == NULL && 2372 func_style == FUNC_TRADITIONAL && cur_file->convert) { 2373 gen_func_declarator(yystack.l_mark[0].declarator); 2374 fputs(cur_text(), cur_file->tmp_file); 2375 } 2376 cur_declarator = yyval.declarator; 2377 } 2378 break; 2379 case 71: 2380 #line 732 "grammar.y" 2381 { 2382 if (yystack.l_mark[-1].declarator->func_def != FUNC_NONE && func_params == NULL && 2383 func_style == FUNC_TRADITIONAL && cur_file->convert) { 2384 gen_func_declarator(yystack.l_mark[-1].declarator); 2385 fputs(" =", cur_file->tmp_file); 2386 } 2387 } 2388 break; 2389 case 73: 2390 #line 744 "grammar.y" 2391 { 2392 char *s; 2393 if ((s = implied_typedef()) == 0) 2394 (void)sprintf(s = buf, "enum %s", yystack.l_mark[-1].text.text); 2395 new_decl_spec(&yyval.decl_spec, s, yystack.l_mark[-2].text.begin, DS_NONE); 2396 } 2397 break; 2398 case 74: 2399 #line 751 "grammar.y" 2400 { 2401 char *s; 2402 if ((s = implied_typedef()) == 0) 2403 (void)sprintf(s = buf, "%s {}", yystack.l_mark[-1].text.text); 2404 new_decl_spec(&yyval.decl_spec, s, yystack.l_mark[-1].text.begin, DS_NONE); 2405 } 2406 break; 2407 case 75: 2408 #line 758 "grammar.y" 2409 { 2410 (void)sprintf(buf, "enum %s", yystack.l_mark[0].text.text); 2411 new_decl_spec(&yyval.decl_spec, buf, yystack.l_mark[-1].text.begin, DS_NONE); 2412 } 2413 break; 2414 case 76: 2415 #line 766 "grammar.y" 2416 { 2417 imply_typedef("enum"); 2418 yyval.text = yystack.l_mark[0].text; 2419 } 2420 break; 2421 case 79: 2422 #line 779 "grammar.y" 2423 { 2424 yyval.declarator = yystack.l_mark[0].declarator; 2425 (void)sprintf(buf, "%s%s", yystack.l_mark[-1].text.text, yyval.declarator->text); 2426 free(yyval.declarator->text); 2427 yyval.declarator->text = xstrdup(buf); 2428 yyval.declarator->begin = yystack.l_mark[-1].text.begin; 2429 yyval.declarator->pointer = TRUE; 2430 } 2431 break; 2432 case 81: 2433 #line 792 "grammar.y" 2434 { 2435 yyval.declarator = new_declarator(yystack.l_mark[0].text.text, yystack.l_mark[0].text.text, yystack.l_mark[0].text.begin); 2436 } 2437 break; 2438 case 82: 2439 #line 796 "grammar.y" 2440 { 2441 yyval.declarator = yystack.l_mark[-1].declarator; 2442 (void)sprintf(buf, "(%s)", yyval.declarator->text); 2443 free(yyval.declarator->text); 2444 yyval.declarator->text = xstrdup(buf); 2445 yyval.declarator->begin = yystack.l_mark[-2].text.begin; 2446 } 2447 break; 2448 case 83: 2449 #line 804 "grammar.y" 2450 { 2451 yyval.declarator = yystack.l_mark[-1].declarator; 2452 (void)sprintf(buf, "%s%s", yyval.declarator->text, yystack.l_mark[0].text.text); 2453 free(yyval.declarator->text); 2454 yyval.declarator->text = xstrdup(buf); 2455 } 2456 break; 2457 case 84: 2458 #line 811 "grammar.y" 2459 { 2460 yyval.declarator = new_declarator("%s()", yystack.l_mark[-3].declarator->name, yystack.l_mark[-3].declarator->begin); 2461 yyval.declarator->params = yystack.l_mark[-1].param_list; 2462 yyval.declarator->func_stack = yystack.l_mark[-3].declarator; 2463 yyval.declarator->head = (yystack.l_mark[-3].declarator->func_stack == NULL) ? yyval.declarator : yystack.l_mark[-3].declarator->head; 2464 yyval.declarator->func_def = FUNC_ANSI; 2465 } 2466 break; 2467 case 85: 2468 #line 819 "grammar.y" 2469 { 2470 yyval.declarator = new_declarator("%s()", yystack.l_mark[-3].declarator->name, yystack.l_mark[-3].declarator->begin); 2471 yyval.declarator->params = yystack.l_mark[-1].param_list; 2472 yyval.declarator->func_stack = yystack.l_mark[-3].declarator; 2473 yyval.declarator->head = (yystack.l_mark[-3].declarator->func_stack == NULL) ? yyval.declarator : yystack.l_mark[-3].declarator->head; 2474 yyval.declarator->func_def = FUNC_TRADITIONAL; 2475 } 2476 break; 2477 case 86: 2478 #line 830 "grammar.y" 2479 { 2480 (void)sprintf(yyval.text.text, "*%s", yystack.l_mark[0].text.text); 2481 yyval.text.begin = yystack.l_mark[-1].text.begin; 2482 } 2483 break; 2484 case 87: 2485 #line 835 "grammar.y" 2486 { 2487 (void)sprintf(yyval.text.text, "*%s%s", yystack.l_mark[-1].text.text, yystack.l_mark[0].text.text); 2488 yyval.text.begin = yystack.l_mark[-2].text.begin; 2489 } 2490 break; 2491 case 88: 2492 #line 843 "grammar.y" 2493 { 2494 strcpy(yyval.text.text, ""); 2495 yyval.text.begin = 0L; 2496 } 2497 break; 2498 case 90: 2499 #line 852 "grammar.y" 2500 { 2501 (void)sprintf(yyval.text.text, "%s ", yystack.l_mark[0].decl_spec.text); 2502 yyval.text.begin = yystack.l_mark[0].decl_spec.begin; 2503 free(yystack.l_mark[0].decl_spec.text); 2504 } 2505 break; 2506 case 91: 2507 #line 858 "grammar.y" 2508 { 2509 (void)sprintf(yyval.text.text, "%s%s ", yystack.l_mark[-1].text.text, yystack.l_mark[0].decl_spec.text); 2510 yyval.text.begin = yystack.l_mark[-1].text.begin; 2511 free(yystack.l_mark[0].decl_spec.text); 2512 } 2513 break; 2514 case 93: 2515 #line 868 "grammar.y" 2516 { 2517 add_ident_list(&yyval.param_list, &yystack.l_mark[-2].param_list, "..."); 2518 } 2519 break; 2520 case 94: 2521 #line 875 "grammar.y" 2522 { 2523 new_param_list(&yyval.param_list, yystack.l_mark[0].parameter); 2524 } 2525 break; 2526 case 95: 2527 #line 879 "grammar.y" 2528 { 2529 add_param_list(&yyval.param_list, &yystack.l_mark[-2].param_list, yystack.l_mark[0].parameter); 2530 } 2531 break; 2532 case 96: 2533 #line 886 "grammar.y" 2534 { 2535 check_untagged(&yystack.l_mark[-1].decl_spec); 2536 yyval.parameter = new_parameter(&yystack.l_mark[-1].decl_spec, yystack.l_mark[0].declarator); 2537 } 2538 break; 2539 case 97: 2540 #line 891 "grammar.y" 2541 { 2542 check_untagged(&yystack.l_mark[-1].decl_spec); 2543 yyval.parameter = new_parameter(&yystack.l_mark[-1].decl_spec, yystack.l_mark[0].declarator); 2544 } 2545 break; 2546 case 98: 2547 #line 896 "grammar.y" 2548 { 2549 check_untagged(&yystack.l_mark[0].decl_spec); 2550 yyval.parameter = new_parameter(&yystack.l_mark[0].decl_spec, (Declarator *)0); 2551 } 2552 break; 2553 case 99: 2554 #line 904 "grammar.y" 2555 { 2556 new_ident_list(&yyval.param_list); 2557 } 2558 break; 2559 case 101: 2560 #line 912 "grammar.y" 2561 { 2562 new_ident_list(&yyval.param_list); 2563 add_ident_list(&yyval.param_list, &yyval.param_list, yystack.l_mark[0].text.text); 2564 } 2565 break; 2566 case 102: 2567 #line 917 "grammar.y" 2568 { 2569 add_ident_list(&yyval.param_list, &yystack.l_mark[-2].param_list, yystack.l_mark[0].text.text); 2570 } 2571 break; 2572 case 103: 2573 #line 924 "grammar.y" 2574 { 2575 yyval.text = yystack.l_mark[0].text; 2576 } 2577 break; 2578 case 104: 2579 #line 928 "grammar.y" 2580 { 2581 #if OPT_LINTLIBRARY 2582 if (lintLibrary()) { /* Lint doesn't grok C++ ref variables */ 2583 yyval.text = yystack.l_mark[0].text; 2584 } else 2585 #endif 2586 (void)sprintf(yyval.text.text, "&%s", yystack.l_mark[0].text.text); 2587 yyval.text.begin = yystack.l_mark[-1].text.begin; 2588 } 2589 break; 2590 case 105: 2591 #line 941 "grammar.y" 2592 { 2593 yyval.declarator = new_declarator(yystack.l_mark[0].text.text, "", yystack.l_mark[0].text.begin); 2594 } 2595 break; 2596 case 106: 2597 #line 945 "grammar.y" 2598 { 2599 yyval.declarator = yystack.l_mark[0].declarator; 2600 (void)sprintf(buf, "%s%s", yystack.l_mark[-1].text.text, yyval.declarator->text); 2601 free(yyval.declarator->text); 2602 yyval.declarator->text = xstrdup(buf); 2603 yyval.declarator->begin = yystack.l_mark[-1].text.begin; 2604 } 2605 break; 2606 case 108: 2607 #line 957 "grammar.y" 2608 { 2609 yyval.declarator = yystack.l_mark[-1].declarator; 2610 (void)sprintf(buf, "(%s)", yyval.declarator->text); 2611 free(yyval.declarator->text); 2612 yyval.declarator->text = xstrdup(buf); 2613 yyval.declarator->begin = yystack.l_mark[-2].text.begin; 2614 } 2615 break; 2616 case 109: 2617 #line 965 "grammar.y" 2618 { 2619 yyval.declarator = yystack.l_mark[-1].declarator; 2620 (void)sprintf(buf, "%s%s", yyval.declarator->text, yystack.l_mark[0].text.text); 2621 free(yyval.declarator->text); 2622 yyval.declarator->text = xstrdup(buf); 2623 } 2624 break; 2625 case 110: 2626 #line 972 "grammar.y" 2627 { 2628 yyval.declarator = new_declarator(yystack.l_mark[0].text.text, "", yystack.l_mark[0].text.begin); 2629 } 2630 break; 2631 case 111: 2632 #line 976 "grammar.y" 2633 { 2634 yyval.declarator = new_declarator("%s()", "", yystack.l_mark[-3].declarator->begin); 2635 yyval.declarator->params = yystack.l_mark[-1].param_list; 2636 yyval.declarator->func_stack = yystack.l_mark[-3].declarator; 2637 yyval.declarator->head = (yystack.l_mark[-3].declarator->func_stack == NULL) ? yyval.declarator : yystack.l_mark[-3].declarator->head; 2638 yyval.declarator->func_def = FUNC_ANSI; 2639 } 2640 break; 2641 case 112: 2642 #line 984 "grammar.y" 2643 { 2644 yyval.declarator = new_declarator("%s()", "", yystack.l_mark[-2].declarator->begin); 2645 yyval.declarator->func_stack = yystack.l_mark[-2].declarator; 2646 yyval.declarator->head = (yystack.l_mark[-2].declarator->func_stack == NULL) ? yyval.declarator : yystack.l_mark[-2].declarator->head; 2647 yyval.declarator->func_def = FUNC_ANSI; 2648 } 2649 break; 2650 case 113: 2651 #line 991 "grammar.y" 2652 { 2653 Declarator *d; 2654 2655 d = new_declarator("", "", yystack.l_mark[-2].text.begin); 2656 yyval.declarator = new_declarator("%s()", "", yystack.l_mark[-2].text.begin); 2657 yyval.declarator->params = yystack.l_mark[-1].param_list; 2658 yyval.declarator->func_stack = d; 2659 yyval.declarator->head = yyval.declarator; 2660 yyval.declarator->func_def = FUNC_ANSI; 2661 } 2662 break; 2663 case 114: 2664 #line 1002 "grammar.y" 2665 { 2666 Declarator *d; 2667 2668 d = new_declarator("", "", yystack.l_mark[-1].text.begin); 2669 yyval.declarator = new_declarator("%s()", "", yystack.l_mark[-1].text.begin); 2670 yyval.declarator->func_stack = d; 2671 yyval.declarator->head = yyval.declarator; 2672 yyval.declarator->func_def = FUNC_ANSI; 2673 } 2674 break; 2675 #line 2676 "grammar.tab.c" 2676 default: 2677 break; 2678 } 2679 yystack.s_mark -= yym; 2680 yystate = *yystack.s_mark; 2681 yystack.l_mark -= yym; 2682 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 2683 yystack.p_mark -= yym; 2684 #endif 2685 yym = yylhs[yyn]; 2686 if (yystate == 0 && yym == 0) 2687 { 2688 #if YYDEBUG 2689 if (yydebug) 2690 { 2691 fprintf(stderr, "%s[%d]: after reduction, ", YYDEBUGSTR, yydepth); 2692 #ifdef YYSTYPE_TOSTRING 2693 #if YYBTYACC 2694 if (!yytrial) 2695 #endif /* YYBTYACC */ 2696 fprintf(stderr, "result is <%s>, ", YYSTYPE_TOSTRING(yystos[YYFINAL], yyval)); 2697 #endif 2698 fprintf(stderr, "shifting from state 0 to final state %d\n", YYFINAL); 2699 } 2700 #endif 2701 yystate = YYFINAL; 2702 *++yystack.s_mark = YYFINAL; 2703 *++yystack.l_mark = yyval; 2704 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 2705 *++yystack.p_mark = yyloc; 2706 #endif 2707 if (yychar < 0) 2708 { 2709 #if YYBTYACC 2710 do { 2711 if (yylvp < yylve) 2712 { 2713 /* we're currently re-reading tokens */ 2714 yylval = *yylvp++; 2715 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 2716 yylloc = *yylpp++; 2717 #endif 2718 yychar = *yylexp++; 2719 break; 2720 } 2721 if (yyps->save) 2722 { 2723 /* in trial mode; save scanner results for future parse attempts */ 2724 if (yylvp == yylvlim) 2725 { /* Enlarge lexical value queue */ 2726 size_t p = (size_t) (yylvp - yylvals); 2727 size_t s = (size_t) (yylvlim - yylvals); 2728 2729 s += YYLVQUEUEGROWTH; 2730 if ((yylexemes = (short *) realloc(yylexemes, s * sizeof(short))) == NULL) 2731 goto yyenomem; 2732 if ((yylvals = (YYSTYPE *) realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) 2733 goto yyenomem; 2734 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 2735 if ((yylpsns = (YYLTYPE *) realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) 2736 goto yyenomem; 2737 #endif 2738 yylvp = yylve = yylvals + p; 2739 yylvlim = yylvals + s; 2740 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 2741 yylpp = yylpe = yylpsns + p; 2742 yylplim = yylpsns + s; 2743 #endif 2744 yylexp = yylexemes + p; 2745 } 2746 *yylexp = (short) YYLEX; 2747 *yylvp++ = yylval; 2748 yylve++; 2749 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 2750 *yylpp++ = yylloc; 2751 yylpe++; 2752 #endif 2753 yychar = *yylexp++; 2754 break; 2755 } 2756 /* normal operation, no conflict encountered */ 2757 #endif /* YYBTYACC */ 2758 yychar = YYLEX; 2759 #if YYBTYACC 2760 } while (0); 2761 #endif /* YYBTYACC */ 2762 if (yychar < 0) yychar = YYEOF; 2763 /* if ((yychar = YYLEX) < 0) yychar = YYEOF; */ 2764 #if YYDEBUG 2765 if (yydebug) 2766 { 2767 yys = yyname[YYTRANSLATE(yychar)]; 2768 fprintf(stderr, "%s[%d]: state %d, reading %d (%s)\n", 2769 YYDEBUGSTR, yydepth, YYFINAL, yychar, yys); 2770 } 2771 #endif 2772 } 2773 if (yychar == YYEOF) goto yyaccept; 2774 goto yyloop; 2775 } 2776 if (((yyn = yygindex[yym]) != 0) && (yyn += yystate) >= 0 && 2777 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yystate) 2778 yystate = yytable[yyn]; 2779 else 2780 yystate = yydgoto[yym]; 2781 #if YYDEBUG 2782 if (yydebug) 2783 { 2784 fprintf(stderr, "%s[%d]: after reduction, ", YYDEBUGSTR, yydepth); 2785 #ifdef YYSTYPE_TOSTRING 2786 #if YYBTYACC 2787 if (!yytrial) 2788 #endif /* YYBTYACC */ 2789 fprintf(stderr, "result is <%s>, ", YYSTYPE_TOSTRING(yystos[yystate], yyval)); 2790 #endif 2791 fprintf(stderr, "shifting from state %d to state %d\n", *yystack.s_mark, yystate); 2792 } 2793 #endif 2794 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow; 2795 *++yystack.s_mark = (short) yystate; 2796 *++yystack.l_mark = yyval; 2797 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 2798 *++yystack.p_mark = yyloc; 2799 #endif 2800 goto yyloop; 2801 #if YYBTYACC 2802 2803 /* Reduction declares that this path is valid. Set yypath and do a full parse */ 2804 yyvalid: 2805 if (yypath) YYABORT; 2806 while (yyps->save) 2807 { 2808 YYParseState *save = yyps->save; 2809 yyps->save = save->save; 2810 save->save = yypath; 2811 yypath = save; 2812 } 2813 #if YYDEBUG 2814 if (yydebug) 2815 fprintf(stderr, "%s[%d]: state %d, CONFLICT trial successful, backtracking to state %d, %d tokens\n", 2816 YYDEBUGSTR, yydepth, yystate, yypath->state, (int)(yylvp - yylvals - yypath->lexeme)); 2817 #endif 2818 if (yyerrctx) 2819 { 2820 yyFreeState(yyerrctx); 2821 yyerrctx = NULL; 2822 } 2823 yylvp = yylvals + yypath->lexeme; 2824 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 2825 yylpp = yylpsns + yypath->lexeme; 2826 #endif 2827 yylexp = yylexemes + yypath->lexeme; 2828 yychar = YYEMPTY; 2829 yystack.s_mark = yystack.s_base + (yypath->yystack.s_mark - yypath->yystack.s_base); 2830 memcpy (yystack.s_base, yypath->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(short)); 2831 yystack.l_mark = yystack.l_base + (yypath->yystack.l_mark - yypath->yystack.l_base); 2832 memcpy (yystack.l_base, yypath->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); 2833 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 2834 yystack.p_mark = yystack.p_base + (yypath->yystack.p_mark - yypath->yystack.p_base); 2835 memcpy (yystack.p_base, yypath->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); 2836 #endif 2837 yystate = yypath->state; 2838 goto yyloop; 2839 #endif /* YYBTYACC */ 2840 2841 yyoverflow: 2842 YYERROR_CALL("yacc stack overflow"); 2843 #if YYBTYACC 2844 goto yyabort_nomem; 2845 yyenomem: 2846 YYERROR_CALL("memory exhausted"); 2847 yyabort_nomem: 2848 #endif /* YYBTYACC */ 2849 yyresult = 2; 2850 goto yyreturn; 2851 2852 yyabort: 2853 yyresult = 1; 2854 goto yyreturn; 2855 2856 yyaccept: 2857 #if YYBTYACC 2858 if (yyps->save) goto yyvalid; 2859 #endif /* YYBTYACC */ 2860 yyresult = 0; 2861 2862 yyreturn: 2863 #if defined(YYDESTRUCT_CALL) 2864 if (yychar != YYEOF && yychar != YYEMPTY) 2865 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 2866 YYDESTRUCT_CALL("cleanup: discarding token", yychar, &yylval, &yylloc); 2867 #else 2868 YYDESTRUCT_CALL("cleanup: discarding token", yychar, &yylval); 2869 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */ 2870 2871 { 2872 YYSTYPE *pv; 2873 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 2874 YYLTYPE *pp; 2875 2876 for (pv = yystack.l_base, pp = yystack.p_base; pv <= yystack.l_mark; ++pv, ++pp) 2877 YYDESTRUCT_CALL("cleanup: discarding state", 2878 yystos[*(yystack.s_base + (pv - yystack.l_base))], pv, pp); 2879 #else 2880 for (pv = yystack.l_base; pv <= yystack.l_mark; ++pv) 2881 YYDESTRUCT_CALL("cleanup: discarding state", 2882 yystos[*(yystack.s_base + (pv - yystack.l_base))], pv); 2883 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */ 2884 } 2885 #endif /* defined(YYDESTRUCT_CALL) */ 2886 2887 #if YYBTYACC 2888 if (yyerrctx) 2889 { 2890 yyFreeState(yyerrctx); 2891 yyerrctx = NULL; 2892 } 2893 while (yyps) 2894 { 2895 YYParseState *save = yyps; 2896 yyps = save->save; 2897 save->save = NULL; 2898 yyFreeState(save); 2899 } 2900 while (yypath) 2901 { 2902 YYParseState *save = yypath; 2903 yypath = save->save; 2904 save->save = NULL; 2905 yyFreeState(save); 2906 } 2907 #endif /* YYBTYACC */ 2908 yyfreestack(&yystack); 2909 return (yyresult); 2910 } 2911