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