1 /* $NetBSD: grammar.tab.c,v 1.5 2021/02/20 22:57:57 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 short 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 = 0; 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 break; 2028 case 11: 2029 #line 382 "grammar.y" 2030 { 2031 yyerrok; 2032 } 2033 break; 2034 case 13: 2035 #line 393 "grammar.y" 2036 { 2037 /* Provide an empty action here so bison will not complain about 2038 * incompatible types in the default action it normally would 2039 * have generated. 2040 */ 2041 } 2042 break; 2043 case 14: 2044 #line 400 "grammar.y" 2045 { 2046 /* empty */ 2047 } 2048 break; 2049 case 15: 2050 #line 407 "grammar.y" 2051 { 2052 #if OPT_LINTLIBRARY 2053 if (types_out && want_typedef()) { 2054 gen_declarations(&yystack.l_mark[-1].decl_spec, (DeclaratorList *)0); 2055 flush_varargs(); 2056 } 2057 #endif 2058 free_decl_spec(&yystack.l_mark[-1].decl_spec); 2059 end_typedef(); 2060 } 2061 break; 2062 case 16: 2063 #line 418 "grammar.y" 2064 { 2065 if (func_params != NULL) { 2066 set_param_types(func_params, &yystack.l_mark[-2].decl_spec, &yystack.l_mark[-1].decl_list); 2067 } else { 2068 gen_declarations(&yystack.l_mark[-2].decl_spec, &yystack.l_mark[-1].decl_list); 2069 #if OPT_LINTLIBRARY 2070 flush_varargs(); 2071 #endif 2072 free_decl_list(&yystack.l_mark[-1].decl_list); 2073 } 2074 free_decl_spec(&yystack.l_mark[-2].decl_spec); 2075 end_typedef(); 2076 } 2077 break; 2078 case 17: 2079 #line 432 "grammar.y" 2080 { 2081 cur_decl_spec_flags = yystack.l_mark[0].decl_spec.flags; 2082 free_decl_spec(&yystack.l_mark[0].decl_spec); 2083 } 2084 break; 2085 case 18: 2086 #line 437 "grammar.y" 2087 { 2088 end_typedef(); 2089 } 2090 break; 2091 case 19: 2092 #line 444 "grammar.y" 2093 { 2094 begin_typedef(); 2095 } 2096 break; 2097 case 20: 2098 #line 448 "grammar.y" 2099 { 2100 begin_typedef(); 2101 } 2102 break; 2103 case 23: 2104 #line 460 "grammar.y" 2105 { 2106 int flags = cur_decl_spec_flags; 2107 2108 /* If the typedef is a pointer type, then reset the short type 2109 * flags so it does not get promoted. 2110 */ 2111 if (strcmp(yystack.l_mark[0].declarator->text, yystack.l_mark[0].declarator->name) != 0) 2112 flags &= ~(DS_CHAR | DS_SHORT | DS_FLOAT); 2113 new_symbol(typedef_names, yystack.l_mark[0].declarator->name, NULL, flags); 2114 free_declarator(yystack.l_mark[0].declarator); 2115 } 2116 break; 2117 case 24: 2118 #line 472 "grammar.y" 2119 { 2120 int flags = cur_decl_spec_flags; 2121 2122 if (strcmp(yystack.l_mark[0].declarator->text, yystack.l_mark[0].declarator->name) != 0) 2123 flags &= ~(DS_CHAR | DS_SHORT | DS_FLOAT); 2124 new_symbol(typedef_names, yystack.l_mark[0].declarator->name, NULL, flags); 2125 free_declarator(yystack.l_mark[0].declarator); 2126 } 2127 break; 2128 case 25: 2129 #line 484 "grammar.y" 2130 { 2131 check_untagged(&yystack.l_mark[-1].decl_spec); 2132 if (yystack.l_mark[0].declarator->func_def == FUNC_NONE) { 2133 yyerror("syntax error"); 2134 YYERROR; 2135 } 2136 func_params = &(yystack.l_mark[0].declarator->head->params); 2137 func_params->begin_comment = cur_file->begin_comment; 2138 func_params->end_comment = cur_file->end_comment; 2139 } 2140 break; 2141 case 26: 2142 #line 495 "grammar.y" 2143 { 2144 /* If we're converting to K&R and we've got a nominally K&R 2145 * function which has a parameter which is ANSI (i.e., a prototyped 2146 * function pointer), then we must override the deciphered value of 2147 * 'func_def' so that the parameter will be converted. 2148 */ 2149 if (func_style == FUNC_TRADITIONAL 2150 && haveAnsiParam() 2151 && yystack.l_mark[-3].declarator->head->func_def == func_style) { 2152 yystack.l_mark[-3].declarator->head->func_def = FUNC_BOTH; 2153 } 2154 2155 func_params = NULL; 2156 2157 if (cur_file->convert) 2158 gen_func_definition(&yystack.l_mark[-4].decl_spec, yystack.l_mark[-3].declarator); 2159 gen_prototype(&yystack.l_mark[-4].decl_spec, yystack.l_mark[-3].declarator); 2160 #if OPT_LINTLIBRARY 2161 flush_varargs(); 2162 #endif 2163 free_decl_spec(&yystack.l_mark[-4].decl_spec); 2164 free_declarator(yystack.l_mark[-3].declarator); 2165 } 2166 break; 2167 case 28: 2168 #line 520 "grammar.y" 2169 { 2170 if (yystack.l_mark[0].declarator->func_def == FUNC_NONE) { 2171 yyerror("syntax error"); 2172 YYERROR; 2173 } 2174 func_params = &(yystack.l_mark[0].declarator->head->params); 2175 func_params->begin_comment = cur_file->begin_comment; 2176 func_params->end_comment = cur_file->end_comment; 2177 } 2178 break; 2179 case 29: 2180 #line 530 "grammar.y" 2181 { 2182 DeclSpec decl_spec; 2183 2184 func_params = NULL; 2185 2186 new_decl_spec(&decl_spec, dft_decl_spec(), yystack.l_mark[-4].declarator->begin, DS_NONE); 2187 if (cur_file->convert) 2188 gen_func_definition(&decl_spec, yystack.l_mark[-4].declarator); 2189 gen_prototype(&decl_spec, yystack.l_mark[-4].declarator); 2190 #if OPT_LINTLIBRARY 2191 flush_varargs(); 2192 #endif 2193 free_decl_spec(&decl_spec); 2194 free_declarator(yystack.l_mark[-4].declarator); 2195 } 2196 break; 2197 case 36: 2198 #line 561 "grammar.y" 2199 { 2200 join_decl_specs(&yyval.decl_spec, &yystack.l_mark[-1].decl_spec, &yystack.l_mark[0].decl_spec); 2201 free(yystack.l_mark[-1].decl_spec.text); 2202 free(yystack.l_mark[0].decl_spec.text); 2203 } 2204 break; 2205 case 40: 2206 #line 576 "grammar.y" 2207 { 2208 new_decl_spec(&yyval.decl_spec, yystack.l_mark[0].text.text, yystack.l_mark[0].text.begin, DS_NONE); 2209 } 2210 break; 2211 case 41: 2212 #line 580 "grammar.y" 2213 { 2214 new_decl_spec(&yyval.decl_spec, yystack.l_mark[0].text.text, yystack.l_mark[0].text.begin, DS_EXTERN); 2215 } 2216 break; 2217 case 42: 2218 #line 584 "grammar.y" 2219 { 2220 new_decl_spec(&yyval.decl_spec, yystack.l_mark[0].text.text, yystack.l_mark[0].text.begin, DS_NONE); 2221 } 2222 break; 2223 case 43: 2224 #line 588 "grammar.y" 2225 { 2226 new_decl_spec(&yyval.decl_spec, yystack.l_mark[0].text.text, yystack.l_mark[0].text.begin, DS_STATIC); 2227 } 2228 break; 2229 case 44: 2230 #line 592 "grammar.y" 2231 { 2232 new_decl_spec(&yyval.decl_spec, yystack.l_mark[0].text.text, yystack.l_mark[0].text.begin, DS_INLINE); 2233 } 2234 break; 2235 case 45: 2236 #line 596 "grammar.y" 2237 { 2238 new_decl_spec(&yyval.decl_spec, yystack.l_mark[0].text.text, yystack.l_mark[0].text.begin, DS_JUNK); 2239 } 2240 break; 2241 case 46: 2242 #line 603 "grammar.y" 2243 { 2244 new_decl_spec(&yyval.decl_spec, yystack.l_mark[0].text.text, yystack.l_mark[0].text.begin, DS_CHAR); 2245 } 2246 break; 2247 case 47: 2248 #line 607 "grammar.y" 2249 { 2250 new_decl_spec(&yyval.decl_spec, yystack.l_mark[0].text.text, yystack.l_mark[0].text.begin, DS_NONE); 2251 } 2252 break; 2253 case 48: 2254 #line 611 "grammar.y" 2255 { 2256 new_decl_spec(&yyval.decl_spec, yystack.l_mark[0].text.text, yystack.l_mark[0].text.begin, DS_FLOAT); 2257 } 2258 break; 2259 case 49: 2260 #line 615 "grammar.y" 2261 { 2262 new_decl_spec(&yyval.decl_spec, yystack.l_mark[0].text.text, yystack.l_mark[0].text.begin, DS_NONE); 2263 } 2264 break; 2265 case 50: 2266 #line 619 "grammar.y" 2267 { 2268 new_decl_spec(&yyval.decl_spec, yystack.l_mark[0].text.text, yystack.l_mark[0].text.begin, DS_NONE); 2269 } 2270 break; 2271 case 51: 2272 #line 623 "grammar.y" 2273 { 2274 new_decl_spec(&yyval.decl_spec, yystack.l_mark[0].text.text, yystack.l_mark[0].text.begin, DS_SHORT); 2275 } 2276 break; 2277 case 52: 2278 #line 627 "grammar.y" 2279 { 2280 new_decl_spec(&yyval.decl_spec, yystack.l_mark[0].text.text, yystack.l_mark[0].text.begin, DS_NONE); 2281 } 2282 break; 2283 case 53: 2284 #line 631 "grammar.y" 2285 { 2286 new_decl_spec(&yyval.decl_spec, yystack.l_mark[0].text.text, yystack.l_mark[0].text.begin, DS_NONE); 2287 } 2288 break; 2289 case 54: 2290 #line 635 "grammar.y" 2291 { 2292 new_decl_spec(&yyval.decl_spec, yystack.l_mark[0].text.text, yystack.l_mark[0].text.begin, DS_NONE); 2293 } 2294 break; 2295 case 55: 2296 #line 639 "grammar.y" 2297 { 2298 new_decl_spec(&yyval.decl_spec, yystack.l_mark[0].text.text, yystack.l_mark[0].text.begin, DS_CHAR); 2299 } 2300 break; 2301 case 56: 2302 #line 643 "grammar.y" 2303 { 2304 new_decl_spec(&yyval.decl_spec, yystack.l_mark[0].text.text, yystack.l_mark[0].text.begin, DS_NONE); 2305 } 2306 break; 2307 case 57: 2308 #line 647 "grammar.y" 2309 { 2310 new_decl_spec(&yyval.decl_spec, yystack.l_mark[0].text.text, yystack.l_mark[0].text.begin, DS_NONE); 2311 } 2312 break; 2313 case 58: 2314 #line 651 "grammar.y" 2315 { 2316 Symbol *s; 2317 s = find_symbol(typedef_names, yystack.l_mark[0].text.text); 2318 if (s != NULL) 2319 new_decl_spec(&yyval.decl_spec, yystack.l_mark[0].text.text, yystack.l_mark[0].text.begin, s->flags); 2320 } 2321 break; 2322 case 61: 2323 #line 663 "grammar.y" 2324 { 2325 new_decl_spec(&yyval.decl_spec, yystack.l_mark[0].text.text, yystack.l_mark[0].text.begin, DS_NONE); 2326 } 2327 break; 2328 case 62: 2329 #line 667 "grammar.y" 2330 { 2331 /* This rule allows the <pointer> nonterminal to scan #define 2332 * names as if they were type modifiers. 2333 */ 2334 Symbol *s; 2335 s = find_symbol(define_names, yystack.l_mark[0].text.text); 2336 if (s != NULL) 2337 new_decl_spec(&yyval.decl_spec, yystack.l_mark[0].text.text, yystack.l_mark[0].text.begin, s->flags); 2338 } 2339 break; 2340 case 63: 2341 #line 680 "grammar.y" 2342 { 2343 char *s; 2344 if ((s = implied_typedef()) == 0) 2345 (void)sprintf(s = buf, "%.*s %.*s", TEXT_LEN, yystack.l_mark[-2].text.text, TEXT_LEN, yystack.l_mark[-1].text.text); 2346 new_decl_spec(&yyval.decl_spec, s, yystack.l_mark[-2].text.begin, DS_NONE); 2347 } 2348 break; 2349 case 64: 2350 #line 687 "grammar.y" 2351 { 2352 char *s; 2353 if ((s = implied_typedef()) == 0) 2354 (void)sprintf(s = buf, "%.*s {}", TEXT_LEN, yystack.l_mark[-1].text.text); 2355 new_decl_spec(&yyval.decl_spec, s, yystack.l_mark[-1].text.begin, DS_NONE); 2356 } 2357 break; 2358 case 65: 2359 #line 694 "grammar.y" 2360 { 2361 (void)sprintf(buf, "%.*s %.*s", TEXT_LEN, yystack.l_mark[-1].text.text, TEXT_LEN, yystack.l_mark[0].text.text); 2362 new_decl_spec(&yyval.decl_spec, buf, yystack.l_mark[-1].text.begin, DS_NONE); 2363 } 2364 break; 2365 case 66: 2366 #line 702 "grammar.y" 2367 { 2368 imply_typedef(yyval.text.text); 2369 } 2370 break; 2371 case 67: 2372 #line 706 "grammar.y" 2373 { 2374 imply_typedef(yyval.text.text); 2375 } 2376 break; 2377 case 68: 2378 #line 713 "grammar.y" 2379 { 2380 new_decl_list(&yyval.decl_list, yystack.l_mark[0].declarator); 2381 } 2382 break; 2383 case 69: 2384 #line 717 "grammar.y" 2385 { 2386 add_decl_list(&yyval.decl_list, &yystack.l_mark[-2].decl_list, yystack.l_mark[0].declarator); 2387 } 2388 break; 2389 case 70: 2390 #line 724 "grammar.y" 2391 { 2392 if (yystack.l_mark[0].declarator->func_def != FUNC_NONE && func_params == NULL && 2393 func_style == FUNC_TRADITIONAL && cur_file->convert) { 2394 gen_func_declarator(yystack.l_mark[0].declarator); 2395 fputs(cur_text(), cur_file->tmp_file); 2396 } 2397 cur_declarator = yyval.declarator; 2398 } 2399 break; 2400 case 71: 2401 #line 733 "grammar.y" 2402 { 2403 if (yystack.l_mark[-1].declarator->func_def != FUNC_NONE && func_params == NULL && 2404 func_style == FUNC_TRADITIONAL && cur_file->convert) { 2405 gen_func_declarator(yystack.l_mark[-1].declarator); 2406 fputs(" =", cur_file->tmp_file); 2407 } 2408 } 2409 break; 2410 case 73: 2411 #line 745 "grammar.y" 2412 { 2413 char *s; 2414 if ((s = implied_typedef()) == 0) 2415 (void)sprintf(s = buf, "enum %.*s", TEXT_LEN, yystack.l_mark[-1].text.text); 2416 new_decl_spec(&yyval.decl_spec, s, yystack.l_mark[-2].text.begin, DS_NONE); 2417 } 2418 break; 2419 case 74: 2420 #line 752 "grammar.y" 2421 { 2422 char *s; 2423 if ((s = implied_typedef()) == 0) 2424 (void)sprintf(s = buf, "%.*s {}", TEXT_LEN, yystack.l_mark[-1].text.text); 2425 new_decl_spec(&yyval.decl_spec, s, yystack.l_mark[-1].text.begin, DS_NONE); 2426 } 2427 break; 2428 case 75: 2429 #line 759 "grammar.y" 2430 { 2431 (void)sprintf(buf, "enum %.*s", TEXT_LEN, yystack.l_mark[0].text.text); 2432 new_decl_spec(&yyval.decl_spec, buf, yystack.l_mark[-1].text.begin, DS_NONE); 2433 } 2434 break; 2435 case 76: 2436 #line 767 "grammar.y" 2437 { 2438 imply_typedef("enum"); 2439 yyval.text = yystack.l_mark[0].text; 2440 } 2441 break; 2442 case 79: 2443 #line 780 "grammar.y" 2444 { 2445 yyval.declarator = yystack.l_mark[0].declarator; 2446 (void)sprintf(buf, "%.*s%.*s", TEXT_LEN, yystack.l_mark[-1].text.text, TEXT_LEN, yyval.declarator->text); 2447 free(yyval.declarator->text); 2448 yyval.declarator->text = xstrdup(buf); 2449 yyval.declarator->begin = yystack.l_mark[-1].text.begin; 2450 yyval.declarator->pointer = TRUE; 2451 } 2452 break; 2453 case 81: 2454 #line 793 "grammar.y" 2455 { 2456 yyval.declarator = new_declarator(yystack.l_mark[0].text.text, yystack.l_mark[0].text.text, yystack.l_mark[0].text.begin); 2457 } 2458 break; 2459 case 82: 2460 #line 797 "grammar.y" 2461 { 2462 yyval.declarator = yystack.l_mark[-1].declarator; 2463 (void)sprintf(buf, "(%.*s)", TEXT_LEN, yyval.declarator->text); 2464 free(yyval.declarator->text); 2465 yyval.declarator->text = xstrdup(buf); 2466 yyval.declarator->begin = yystack.l_mark[-2].text.begin; 2467 } 2468 break; 2469 case 83: 2470 #line 805 "grammar.y" 2471 { 2472 yyval.declarator = yystack.l_mark[-1].declarator; 2473 (void)sprintf(buf, "%.*s%.*s", TEXT_LEN, yyval.declarator->text, TEXT_LEN, yystack.l_mark[0].text.text); 2474 free(yyval.declarator->text); 2475 yyval.declarator->text = xstrdup(buf); 2476 } 2477 break; 2478 case 84: 2479 #line 812 "grammar.y" 2480 { 2481 yyval.declarator = new_declarator("%s()", yystack.l_mark[-3].declarator->name, yystack.l_mark[-3].declarator->begin); 2482 yyval.declarator->params = yystack.l_mark[-1].param_list; 2483 yyval.declarator->func_stack = yystack.l_mark[-3].declarator; 2484 yyval.declarator->head = (yystack.l_mark[-3].declarator->func_stack == NULL) ? yyval.declarator : yystack.l_mark[-3].declarator->head; 2485 yyval.declarator->func_def = FUNC_ANSI; 2486 } 2487 break; 2488 case 85: 2489 #line 820 "grammar.y" 2490 { 2491 yyval.declarator = new_declarator("%s()", yystack.l_mark[-3].declarator->name, yystack.l_mark[-3].declarator->begin); 2492 yyval.declarator->params = yystack.l_mark[-1].param_list; 2493 yyval.declarator->func_stack = yystack.l_mark[-3].declarator; 2494 yyval.declarator->head = (yystack.l_mark[-3].declarator->func_stack == NULL) ? yyval.declarator : yystack.l_mark[-3].declarator->head; 2495 yyval.declarator->func_def = FUNC_TRADITIONAL; 2496 } 2497 break; 2498 case 86: 2499 #line 831 "grammar.y" 2500 { 2501 (void)sprintf(yyval.text.text, "*%.*s", TEXT_LEN, yystack.l_mark[0].text.text); 2502 yyval.text.begin = yystack.l_mark[-1].text.begin; 2503 } 2504 break; 2505 case 87: 2506 #line 836 "grammar.y" 2507 { 2508 (void)sprintf(yyval.text.text, "*%.*s%.*s", TEXT_LEN, yystack.l_mark[-1].text.text, TEXT_LEN, yystack.l_mark[0].text.text); 2509 yyval.text.begin = yystack.l_mark[-2].text.begin; 2510 } 2511 break; 2512 case 88: 2513 #line 844 "grammar.y" 2514 { 2515 strcpy(yyval.text.text, ""); 2516 yyval.text.begin = 0L; 2517 } 2518 break; 2519 case 90: 2520 #line 853 "grammar.y" 2521 { 2522 (void)sprintf(yyval.text.text, "%s ", yystack.l_mark[0].decl_spec.text); 2523 yyval.text.begin = yystack.l_mark[0].decl_spec.begin; 2524 free(yystack.l_mark[0].decl_spec.text); 2525 } 2526 break; 2527 case 91: 2528 #line 859 "grammar.y" 2529 { 2530 (void)sprintf(yyval.text.text, "%.*s%.*s ", TEXT_LEN, yystack.l_mark[-1].text.text, TEXT_LEN, yystack.l_mark[0].decl_spec.text); 2531 yyval.text.begin = yystack.l_mark[-1].text.begin; 2532 free(yystack.l_mark[0].decl_spec.text); 2533 } 2534 break; 2535 case 93: 2536 #line 869 "grammar.y" 2537 { 2538 add_ident_list(&yyval.param_list, &yystack.l_mark[-2].param_list, "..."); 2539 } 2540 break; 2541 case 94: 2542 #line 876 "grammar.y" 2543 { 2544 new_param_list(&yyval.param_list, yystack.l_mark[0].parameter); 2545 } 2546 break; 2547 case 95: 2548 #line 880 "grammar.y" 2549 { 2550 add_param_list(&yyval.param_list, &yystack.l_mark[-2].param_list, yystack.l_mark[0].parameter); 2551 } 2552 break; 2553 case 96: 2554 #line 887 "grammar.y" 2555 { 2556 check_untagged(&yystack.l_mark[-1].decl_spec); 2557 yyval.parameter = new_parameter(&yystack.l_mark[-1].decl_spec, yystack.l_mark[0].declarator); 2558 } 2559 break; 2560 case 97: 2561 #line 892 "grammar.y" 2562 { 2563 check_untagged(&yystack.l_mark[-1].decl_spec); 2564 yyval.parameter = new_parameter(&yystack.l_mark[-1].decl_spec, yystack.l_mark[0].declarator); 2565 } 2566 break; 2567 case 98: 2568 #line 897 "grammar.y" 2569 { 2570 check_untagged(&yystack.l_mark[0].decl_spec); 2571 yyval.parameter = new_parameter(&yystack.l_mark[0].decl_spec, (Declarator *)0); 2572 } 2573 break; 2574 case 99: 2575 #line 905 "grammar.y" 2576 { 2577 new_ident_list(&yyval.param_list); 2578 } 2579 break; 2580 case 101: 2581 #line 913 "grammar.y" 2582 { 2583 new_ident_list(&yyval.param_list); 2584 add_ident_list(&yyval.param_list, &yyval.param_list, yystack.l_mark[0].text.text); 2585 } 2586 break; 2587 case 102: 2588 #line 918 "grammar.y" 2589 { 2590 add_ident_list(&yyval.param_list, &yystack.l_mark[-2].param_list, yystack.l_mark[0].text.text); 2591 } 2592 break; 2593 case 103: 2594 #line 925 "grammar.y" 2595 { 2596 yyval.text = yystack.l_mark[0].text; 2597 } 2598 break; 2599 case 104: 2600 #line 929 "grammar.y" 2601 { 2602 #if OPT_LINTLIBRARY 2603 if (lintLibrary()) { /* Lint doesn't grok C++ ref variables */ 2604 yyval.text = yystack.l_mark[0].text; 2605 } else 2606 #endif 2607 (void)sprintf(yyval.text.text, "&%.*s", TEXT_LEN, yystack.l_mark[0].text.text); 2608 yyval.text.begin = yystack.l_mark[-1].text.begin; 2609 } 2610 break; 2611 case 105: 2612 #line 942 "grammar.y" 2613 { 2614 yyval.declarator = new_declarator(yystack.l_mark[0].text.text, "", yystack.l_mark[0].text.begin); 2615 } 2616 break; 2617 case 106: 2618 #line 946 "grammar.y" 2619 { 2620 yyval.declarator = yystack.l_mark[0].declarator; 2621 (void)sprintf(buf, "%.*s%.*s", TEXT_LEN, yystack.l_mark[-1].text.text, TEXT_LEN, yyval.declarator->text); 2622 free(yyval.declarator->text); 2623 yyval.declarator->text = xstrdup(buf); 2624 yyval.declarator->begin = yystack.l_mark[-1].text.begin; 2625 } 2626 break; 2627 case 108: 2628 #line 958 "grammar.y" 2629 { 2630 yyval.declarator = yystack.l_mark[-1].declarator; 2631 (void)sprintf(buf, "(%.*s)", TEXT_LEN, yyval.declarator->text); 2632 free(yyval.declarator->text); 2633 yyval.declarator->text = xstrdup(buf); 2634 yyval.declarator->begin = yystack.l_mark[-2].text.begin; 2635 } 2636 break; 2637 case 109: 2638 #line 966 "grammar.y" 2639 { 2640 yyval.declarator = yystack.l_mark[-1].declarator; 2641 (void)sprintf(buf, "%.*s%.*s", TEXT_LEN, yyval.declarator->text, TEXT_LEN, yystack.l_mark[0].text.text); 2642 free(yyval.declarator->text); 2643 yyval.declarator->text = xstrdup(buf); 2644 } 2645 break; 2646 case 110: 2647 #line 973 "grammar.y" 2648 { 2649 yyval.declarator = new_declarator(yystack.l_mark[0].text.text, "", yystack.l_mark[0].text.begin); 2650 } 2651 break; 2652 case 111: 2653 #line 977 "grammar.y" 2654 { 2655 yyval.declarator = new_declarator("%s()", "", yystack.l_mark[-3].declarator->begin); 2656 yyval.declarator->params = yystack.l_mark[-1].param_list; 2657 yyval.declarator->func_stack = yystack.l_mark[-3].declarator; 2658 yyval.declarator->head = (yystack.l_mark[-3].declarator->func_stack == NULL) ? yyval.declarator : yystack.l_mark[-3].declarator->head; 2659 yyval.declarator->func_def = FUNC_ANSI; 2660 } 2661 break; 2662 case 112: 2663 #line 985 "grammar.y" 2664 { 2665 yyval.declarator = new_declarator("%s()", "", yystack.l_mark[-2].declarator->begin); 2666 yyval.declarator->func_stack = yystack.l_mark[-2].declarator; 2667 yyval.declarator->head = (yystack.l_mark[-2].declarator->func_stack == NULL) ? yyval.declarator : yystack.l_mark[-2].declarator->head; 2668 yyval.declarator->func_def = FUNC_ANSI; 2669 } 2670 break; 2671 case 113: 2672 #line 992 "grammar.y" 2673 { 2674 Declarator *d; 2675 2676 d = new_declarator("", "", yystack.l_mark[-2].text.begin); 2677 yyval.declarator = new_declarator("%s()", "", yystack.l_mark[-2].text.begin); 2678 yyval.declarator->params = yystack.l_mark[-1].param_list; 2679 yyval.declarator->func_stack = d; 2680 yyval.declarator->head = yyval.declarator; 2681 yyval.declarator->func_def = FUNC_ANSI; 2682 } 2683 break; 2684 case 114: 2685 #line 1003 "grammar.y" 2686 { 2687 Declarator *d; 2688 2689 d = new_declarator("", "", yystack.l_mark[-1].text.begin); 2690 yyval.declarator = new_declarator("%s()", "", yystack.l_mark[-1].text.begin); 2691 yyval.declarator->func_stack = d; 2692 yyval.declarator->head = yyval.declarator; 2693 yyval.declarator->func_def = FUNC_ANSI; 2694 } 2695 break; 2696 #line 2695 "grammar.tab.c" 2697 default: 2698 break; 2699 } 2700 yystack.s_mark -= yym; 2701 yystate = *yystack.s_mark; 2702 yystack.l_mark -= yym; 2703 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 2704 yystack.p_mark -= yym; 2705 #endif 2706 yym = yylhs[yyn]; 2707 if (yystate == 0 && yym == 0) 2708 { 2709 #if YYDEBUG 2710 if (yydebug) 2711 { 2712 fprintf(stderr, "%s[%d]: after reduction, ", YYDEBUGSTR, yydepth); 2713 #ifdef YYSTYPE_TOSTRING 2714 #if YYBTYACC 2715 if (!yytrial) 2716 #endif /* YYBTYACC */ 2717 fprintf(stderr, "result is <%s>, ", YYSTYPE_TOSTRING(yystos[YYFINAL], yyval)); 2718 #endif 2719 fprintf(stderr, "shifting from state 0 to final state %d\n", YYFINAL); 2720 } 2721 #endif 2722 yystate = YYFINAL; 2723 *++yystack.s_mark = YYFINAL; 2724 *++yystack.l_mark = yyval; 2725 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 2726 *++yystack.p_mark = yyloc; 2727 #endif 2728 if (yychar < 0) 2729 { 2730 #if YYBTYACC 2731 do { 2732 if (yylvp < yylve) 2733 { 2734 /* we're currently re-reading tokens */ 2735 yylval = *yylvp++; 2736 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 2737 yylloc = *yylpp++; 2738 #endif 2739 yychar = *yylexp++; 2740 break; 2741 } 2742 if (yyps->save) 2743 { 2744 /* in trial mode; save scanner results for future parse attempts */ 2745 if (yylvp == yylvlim) 2746 { /* Enlarge lexical value queue */ 2747 size_t p = (size_t) (yylvp - yylvals); 2748 size_t s = (size_t) (yylvlim - yylvals); 2749 2750 s += YYLVQUEUEGROWTH; 2751 if ((yylexemes = (YYINT *)realloc(yylexemes, s * sizeof(YYINT))) == NULL) 2752 goto yyenomem; 2753 if ((yylvals = (YYSTYPE *)realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) 2754 goto yyenomem; 2755 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 2756 if ((yylpsns = (YYLTYPE *)realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) 2757 goto yyenomem; 2758 #endif 2759 yylvp = yylve = yylvals + p; 2760 yylvlim = yylvals + s; 2761 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 2762 yylpp = yylpe = yylpsns + p; 2763 yylplim = yylpsns + s; 2764 #endif 2765 yylexp = yylexemes + p; 2766 } 2767 *yylexp = (YYINT) YYLEX; 2768 *yylvp++ = yylval; 2769 yylve++; 2770 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 2771 *yylpp++ = yylloc; 2772 yylpe++; 2773 #endif 2774 yychar = *yylexp++; 2775 break; 2776 } 2777 /* normal operation, no conflict encountered */ 2778 #endif /* YYBTYACC */ 2779 yychar = YYLEX; 2780 #if YYBTYACC 2781 } while (0); 2782 #endif /* YYBTYACC */ 2783 if (yychar < 0) yychar = YYEOF; 2784 #if YYDEBUG 2785 if (yydebug) 2786 { 2787 if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN]; 2788 fprintf(stderr, "%s[%d]: state %d, reading token %d (%s)\n", 2789 YYDEBUGSTR, yydepth, YYFINAL, yychar, yys); 2790 } 2791 #endif 2792 } 2793 if (yychar == YYEOF) goto yyaccept; 2794 goto yyloop; 2795 } 2796 if (((yyn = yygindex[yym]) != 0) && (yyn += yystate) >= 0 && 2797 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yystate) 2798 yystate = yytable[yyn]; 2799 else 2800 yystate = yydgoto[yym]; 2801 #if YYDEBUG 2802 if (yydebug) 2803 { 2804 fprintf(stderr, "%s[%d]: after reduction, ", YYDEBUGSTR, yydepth); 2805 #ifdef YYSTYPE_TOSTRING 2806 #if YYBTYACC 2807 if (!yytrial) 2808 #endif /* YYBTYACC */ 2809 fprintf(stderr, "result is <%s>, ", YYSTYPE_TOSTRING(yystos[yystate], yyval)); 2810 #endif 2811 fprintf(stderr, "shifting from state %d to state %d\n", *yystack.s_mark, yystate); 2812 } 2813 #endif 2814 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow; 2815 *++yystack.s_mark = (YYINT) yystate; 2816 *++yystack.l_mark = yyval; 2817 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 2818 *++yystack.p_mark = yyloc; 2819 #endif 2820 goto yyloop; 2821 #if YYBTYACC 2822 2823 /* Reduction declares that this path is valid. Set yypath and do a full parse */ 2824 yyvalid: 2825 if (yypath) YYABORT; 2826 while (yyps->save) 2827 { 2828 YYParseState *save = yyps->save; 2829 yyps->save = save->save; 2830 save->save = yypath; 2831 yypath = save; 2832 } 2833 #if YYDEBUG 2834 if (yydebug) 2835 fprintf(stderr, "%s[%d]: state %d, CONFLICT trial successful, backtracking to state %d, %d tokens\n", 2836 YYDEBUGSTR, yydepth, yystate, yypath->state, (int)(yylvp - yylvals - yypath->lexeme)); 2837 #endif 2838 if (yyerrctx) 2839 { 2840 yyFreeState(yyerrctx); 2841 yyerrctx = NULL; 2842 } 2843 yylvp = yylvals + yypath->lexeme; 2844 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 2845 yylpp = yylpsns + yypath->lexeme; 2846 #endif 2847 yylexp = yylexemes + yypath->lexeme; 2848 yychar = YYEMPTY; 2849 yystack.s_mark = yystack.s_base + (yypath->yystack.s_mark - yypath->yystack.s_base); 2850 memcpy (yystack.s_base, yypath->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(YYINT)); 2851 yystack.l_mark = yystack.l_base + (yypath->yystack.l_mark - yypath->yystack.l_base); 2852 memcpy (yystack.l_base, yypath->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); 2853 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 2854 yystack.p_mark = yystack.p_base + (yypath->yystack.p_mark - yypath->yystack.p_base); 2855 memcpy (yystack.p_base, yypath->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); 2856 #endif 2857 yystate = yypath->state; 2858 goto yyloop; 2859 #endif /* YYBTYACC */ 2860 2861 yyoverflow: 2862 YYERROR_CALL("yacc stack overflow"); 2863 #if YYBTYACC 2864 goto yyabort_nomem; 2865 yyenomem: 2866 YYERROR_CALL("memory exhausted"); 2867 yyabort_nomem: 2868 #endif /* YYBTYACC */ 2869 yyresult = 2; 2870 goto yyreturn; 2871 2872 yyabort: 2873 yyresult = 1; 2874 goto yyreturn; 2875 2876 yyaccept: 2877 #if YYBTYACC 2878 if (yyps->save) goto yyvalid; 2879 #endif /* YYBTYACC */ 2880 yyresult = 0; 2881 2882 yyreturn: 2883 #if defined(YYDESTRUCT_CALL) 2884 if (yychar != YYEOF && yychar != YYEMPTY) 2885 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 2886 YYDESTRUCT_CALL("cleanup: discarding token", yychar, &yylval, &yylloc); 2887 #else 2888 YYDESTRUCT_CALL("cleanup: discarding token", yychar, &yylval); 2889 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */ 2890 2891 { 2892 YYSTYPE *pv; 2893 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 2894 YYLTYPE *pp; 2895 2896 for (pv = yystack.l_base, pp = yystack.p_base; pv <= yystack.l_mark; ++pv, ++pp) 2897 YYDESTRUCT_CALL("cleanup: discarding state", 2898 yystos[*(yystack.s_base + (pv - yystack.l_base))], pv, pp); 2899 #else 2900 for (pv = yystack.l_base; pv <= yystack.l_mark; ++pv) 2901 YYDESTRUCT_CALL("cleanup: discarding state", 2902 yystos[*(yystack.s_base + (pv - yystack.l_base))], pv); 2903 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */ 2904 } 2905 #endif /* defined(YYDESTRUCT_CALL) */ 2906 2907 #if YYBTYACC 2908 if (yyerrctx) 2909 { 2910 yyFreeState(yyerrctx); 2911 yyerrctx = NULL; 2912 } 2913 while (yyps) 2914 { 2915 YYParseState *save = yyps; 2916 yyps = save->save; 2917 save->save = NULL; 2918 yyFreeState(save); 2919 } 2920 while (yypath) 2921 { 2922 YYParseState *save = yypath; 2923 yypath = save->save; 2924 save->save = NULL; 2925 yyFreeState(save); 2926 } 2927 #endif /* YYBTYACC */ 2928 yyfreestack(&yystack); 2929 return (yyresult); 2930 } 2931