1 /* original parser id follows */
2 /* yysccsid[] = "@(#)yaccpar 1.9 (Berkeley) 02/21/93" */
3 /* (use YYMAJOR/YYMINOR for ifdefs dependent on parser version) */
8 #define YYCHECK "yyyymmdd"
11 #define yyclearin (yychar = YYEMPTY)
12 #define yyerrok (yyerrflag = 0)
13 #define YYRECOVERING() (yyerrflag != 0)
18 #define YYDEBUGSTR YYPREFIX "debug"
21 #define yyparse grammar_parse
25 #define yylex grammar_lex
29 #define yyerror grammar_error
33 #define yychar grammar_char
37 #define yyval grammar_val
41 #define yylval grammar_lval
45 #define yydebug grammar_debug
49 #define yynerrs grammar_nerrs
53 #define yyerrflag grammar_errflag
54 #endif /* yyerrflag */
57 #define yylhs grammar_lhs
61 #define yylen grammar_len
65 #define yydefred grammar_defred
69 #define yystos grammar_stos
73 #define yydgoto grammar_dgoto
77 #define yysindex grammar_sindex
81 #define yyrindex grammar_rindex
85 #define yygindex grammar_gindex
89 #define yytable grammar_table
93 #define yycheck grammar_check
97 #define yyname grammar_name
101 #define yyrule grammar_rule
107 #define yycindex grammar_cindex
108 #endif /* yycindex */
111 #define yyctable grammar_ctable
112 #endif /* yyctable */
114 #endif /* YYBTYACC */
116 #define YYPREFIX "grammar_"
123 #define YYSTYPE_IS_DECLARED
124 #define yyerror yaccError
127 #if defined(YYBISON) || !defined(YYBYACC)
128 static void yyerror(const char *s);
135 #define OPT_LINTLIBRARY 1
145 /* #include "cproto.h" */
146 #define MAX_TEXT_SIZE 1024
147 #define TEXT_LEN (MAX_TEXT_SIZE / 2 - 3)
149 /* Prototype styles */
151 #define PROTO_ANSI_LLIB -2 /* form ANSI lint-library source */
152 #define PROTO_LINTLIBRARY -1 /* form lint-library source */
154 #define PROTO_NONE 0 /* do not output any prototypes */
155 #define PROTO_TRADITIONAL 1 /* comment out parameters */
156 #define PROTO_ABSTRACT 2 /* comment out parameter names */
157 #define PROTO_ANSI 3 /* ANSI C prototype */
159 typedef int PrototypeStyle;
161 typedef char boolean;
163 extern boolean types_out;
164 extern PrototypeStyle proto_style;
166 #define ansiLintLibrary() (proto_style == PROTO_ANSI_LLIB)
167 #define knrLintLibrary() (proto_style == PROTO_LINTLIBRARY)
168 #define lintLibrary() (knrLintLibrary() || ansiLintLibrary())
171 #define FUNC_UNKNOWN -1 /* unspecified */
173 #define FUNC_UNKNOWN 0 /* unspecified (same as FUNC_NONE) */
175 #define FUNC_NONE 0 /* not a function definition */
176 #define FUNC_TRADITIONAL 1 /* traditional style */
177 #define FUNC_ANSI 2 /* ANSI style */
178 #define FUNC_BOTH 3 /* both styles */
180 typedef int FuncDefStyle;
182 /* Source file text */
183 typedef struct text {
184 char text[MAX_TEXT_SIZE]; /* source text */
185 long begin; /* offset in temporary file */
188 /* Declaration specifier flags */
189 #define DS_NONE 0 /* default */
190 #define DS_EXTERN 1 /* contains "extern" specifier */
191 #define DS_STATIC 2 /* contains "static" specifier */
192 #define DS_CHAR 4 /* contains "char" type specifier */
193 #define DS_SHORT 8 /* contains "short" type specifier */
194 #define DS_FLOAT 16 /* contains "float" type specifier */
195 #define DS_INLINE 32 /* contains "inline" specifier */
196 #define DS_JUNK 64 /* we're not interested in this declaration */
198 /* This structure stores information about a declaration specifier. */
199 typedef struct decl_spec {
200 unsigned short flags; /* flags defined above */
201 char *text; /* source text */
202 long begin; /* offset in temporary file */
205 /* This is a list of function parameters. */
206 typedef struct _ParameterList {
207 struct parameter *first; /* pointer to first parameter in list */
208 struct parameter *last; /* pointer to last parameter in list */
209 long begin_comment; /* begin offset of comment */
210 long end_comment; /* end offset of comment */
211 char *comment; /* comment at start of parameter list */
214 /* This structure stores information about a declarator. */
215 typedef struct _Declarator {
216 char *name; /* name of variable or function */
217 char *text; /* source text */
218 long begin; /* offset in temporary file */
219 long begin_comment; /* begin offset of comment */
220 long end_comment; /* end offset of comment */
221 FuncDefStyle func_def; /* style of function definition */
222 ParameterList params; /* function parameters */
223 boolean pointer; /* TRUE if it declares a pointer */
224 struct _Declarator *head; /* head function declarator */
225 struct _Declarator *func_stack; /* stack of function declarators */
226 struct _Declarator *next; /* next declarator in list */
229 /* This structure stores information about a function parameter. */
230 typedef struct parameter {
231 struct parameter *next; /* next parameter in list */
233 Declarator *declarator;
234 char *comment; /* comment following the parameter */
237 /* This is a list of declarators. */
238 typedef struct declarator_list {
239 Declarator *first; /* pointer to first declarator in list */
240 Declarator *last; /* pointer to last declarator in list */
243 /* #include "symbol.h" */
244 typedef struct symbol {
245 struct symbol *next; /* next symbol in list */
246 char *name; /* name of symbol */
247 char *value; /* value of symbol (for defines) */
248 short flags; /* symbol attributes */
251 /* parser stack entry type */
255 Parameter *parameter;
256 ParameterList param_list;
257 Declarator *declarator;
258 DeclaratorList decl_list;
261 /* The hash table length should be a prime number. */
262 #define SYM_MAX_HASH 251
264 typedef struct symbol_table {
265 Symbol *bucket[SYM_MAX_HASH]; /* hash buckets */
268 extern SymbolTable *new_symbol_table /* Create symbol table */
270 extern void free_symbol_table /* Destroy symbol table */
272 extern Symbol *find_symbol /* Lookup symbol name */
273 (SymbolTable *s, const char *n);
274 extern Symbol *new_symbol /* Define new symbol */
275 (SymbolTable *s, const char *n, const char *v, int f);
277 /* #include "semantic.h" */
278 extern void new_decl_spec (DeclSpec *, const char *, long, int);
279 extern void free_decl_spec (DeclSpec *);
280 extern void join_decl_specs (DeclSpec *, DeclSpec *, DeclSpec *);
281 extern void check_untagged (DeclSpec *);
282 extern Declarator *new_declarator (const char *, const char *, long);
283 extern void free_declarator (Declarator *);
284 extern void new_decl_list (DeclaratorList *, Declarator *);
285 extern void free_decl_list (DeclaratorList *);
286 extern void add_decl_list (DeclaratorList *, DeclaratorList *, Declarator *);
287 extern Parameter *new_parameter (DeclSpec *, Declarator *);
288 extern void free_parameter (Parameter *);
289 extern void new_param_list (ParameterList *, Parameter *);
290 extern void free_param_list (ParameterList *);
291 extern void add_param_list (ParameterList *, ParameterList *, Parameter *);
292 extern void new_ident_list (ParameterList *);
293 extern void add_ident_list (ParameterList *, ParameterList *, const char *);
294 extern void set_param_types (ParameterList *, DeclSpec *, DeclaratorList *);
295 extern void gen_declarations (DeclSpec *, DeclaratorList *);
296 extern void gen_prototype (DeclSpec *, Declarator *);
297 extern void gen_func_declarator (Declarator *);
298 extern void gen_func_definition (DeclSpec *, Declarator *);
300 extern void init_parser (void);
301 extern void process_file (FILE *infile, char *name);
302 extern char *cur_text (void);
303 extern char *cur_file_name (void);
304 extern char *implied_typedef (void);
305 extern void include_file (char *name, int convert);
306 extern char *supply_parm (int count);
307 extern char *xstrdup (const char *);
308 extern int already_declared (char *name);
309 extern int is_actual_func (Declarator *d);
310 extern int lint_ellipsis (Parameter *p);
311 extern int want_typedef (void);
312 extern void begin_tracking (void);
313 extern void begin_typedef (void);
314 extern void copy_typedef (char *s);
315 extern void ellipsis_varargs (Declarator *d);
316 extern void end_typedef (void);
317 extern void flush_varargs (void);
318 extern void fmt_library (int code);
319 extern void imply_typedef (const char *s);
320 extern void indent (FILE *outf);
321 extern void put_blankline (FILE *outf);
322 extern void put_body (FILE *outf, DeclSpec *decl_spec, Declarator *declarator);
323 extern void put_char (FILE *outf, int c);
324 extern void put_error (void);
325 extern void put_newline (FILE *outf);
326 extern void put_padded (FILE *outf, const char *s);
327 extern void put_string (FILE *outf, const char *s);
328 extern void track_in (void);
330 extern boolean file_comments;
331 extern FuncDefStyle func_style;
332 extern char base_file[];
334 extern int yylex (void);
336 /* declaration specifier attributes for the typedef statement currently being
339 static int cur_decl_spec_flags;
341 /* pointer to parameter list for the current function definition */
342 static ParameterList *func_params;
344 /* A parser semantic action sets this pointer to the current declarator in
345 * a function parameter declaration in order to catch any comments following
346 * the parameter declaration on the same line. If the lexer scans a comment
347 * and <cur_declarator> is not NULL, then the comment is attached to the
348 * declarator. To ignore subsequent comments, the lexer sets this to NULL
349 * after scanning a comment or end of line.
351 static Declarator *cur_declarator;
353 /* temporary string buffer */
354 static char buf[MAX_TEXT_SIZE];
356 /* table of typedef names */
357 static SymbolTable *typedef_names;
359 /* table of define names */
360 static SymbolTable *define_names;
362 /* table of type qualifiers */
363 static SymbolTable *type_qualifiers;
365 /* information about the current input file */
367 char *base_name; /* base input file name */
368 char *file_name; /* current file name */
369 FILE *file; /* input file */
370 unsigned line_num; /* current line number in input file */
371 FILE *tmp_file; /* temporary file */
372 long begin_comment; /* tmp file offset after last written ) or ; */
373 long end_comment; /* tmp file offset after last comment */
374 boolean convert; /* if TRUE, convert function definitions */
375 boolean changed; /* TRUE if conversion done in this file */
378 static IncludeStack *cur_file; /* current input file */
380 /* #include "yyerror.c" */
382 static int haveAnsiParam (void);
385 /* Flags to enable us to find if a procedure returns a value.
387 static int return_val; /* nonzero on BRACES iff return-expression found */
392 return (lintLibrary() && !return_val) ? "void" : "int";
399 if (func_params != 0) {
400 for (p = func_params->first; p != 0; p = p->next) {
401 if (p->declarator->func_def == FUNC_ANSI) {
408 #line 409 "grammar.tab.c"
410 /* compatibility with bison */
412 /* compatibility with FreeBSD */
413 # ifdef YYPARSE_PARAM_TYPE
414 # define YYPARSE_DECL() yyparse(YYPARSE_PARAM_TYPE YYPARSE_PARAM)
416 # define YYPARSE_DECL() yyparse(void *YYPARSE_PARAM)
419 # define YYPARSE_DECL() yyparse(void)
422 /* Parameters sent to lex. */
424 # define YYLEX_DECL() yylex(void *YYLEX_PARAM)
425 # define YYLEX yylex(YYLEX_PARAM)
427 # define YYLEX_DECL() yylex(void)
428 # define YYLEX yylex()
431 /* Parameters sent to yyerror. */
433 #define YYERROR_DECL() yyerror(const char *s)
436 #define YYERROR_CALL(msg) yyerror(msg)
439 extern int YYPARSE_DECL();
441 #define T_IDENTIFIER 257
442 #define T_TYPEDEF_NAME 258
443 #define T_DEFINE_NAME 259
446 #define T_REGISTER 262
448 #define T_TYPEDEF 264
450 #define T_EXTENSION 266
459 #define T_UNSIGNED 275
464 #define T_Complex 280
465 #define T_Imaginary 281
466 #define T_TYPE_QUALIFIER 282
467 #define T_BRACKETS 283
469 #define T_MATCHRBRACE 285
470 #define T_ELLIPSIS 286
471 #define T_INITIALIZER 287
472 #define T_STRING_LITERAL 288
476 #define YYERRCODE 256
478 static const YYINT grammar_lhs[] = { -1,
479 0, 0, 26, 26, 27, 27, 27, 27, 27, 27,
480 27, 31, 30, 30, 28, 28, 34, 28, 32, 32,
481 33, 33, 35, 35, 37, 38, 29, 39, 29, 36,
482 36, 36, 40, 40, 1, 1, 2, 2, 2, 3,
483 3, 3, 3, 3, 3, 4, 4, 4, 4, 4,
484 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
485 5, 5, 6, 6, 6, 19, 19, 8, 8, 9,
486 41, 9, 7, 7, 7, 25, 23, 23, 10, 10,
487 11, 11, 11, 11, 11, 20, 20, 21, 21, 22,
488 22, 14, 14, 15, 15, 16, 16, 16, 17, 17,
489 18, 18, 24, 24, 12, 12, 12, 13, 13, 13,
492 static const YYINT grammar_len[] = { 2,
493 0, 1, 1, 2, 1, 1, 1, 1, 3, 2,
494 2, 2, 3, 3, 2, 3, 0, 5, 2, 1,
495 0, 1, 1, 3, 0, 0, 7, 0, 5, 0,
496 1, 1, 1, 2, 1, 2, 1, 1, 1, 1,
497 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
498 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
499 1, 1, 3, 2, 2, 1, 1, 1, 3, 1,
500 0, 4, 3, 2, 2, 1, 1, 1, 2, 1,
501 1, 3, 2, 4, 4, 2, 3, 0, 1, 1,
502 2, 1, 3, 1, 3, 2, 2, 1, 0, 1,
503 1, 3, 1, 2, 1, 2, 1, 3, 2, 1,
506 static const YYINT grammar_defred[] = { 0,
507 0, 0, 0, 0, 77, 0, 62, 40, 0, 42,
508 43, 20, 44, 0, 46, 47, 48, 49, 54, 50,
509 51, 52, 53, 76, 66, 67, 55, 56, 57, 61,
510 0, 7, 0, 0, 35, 37, 38, 39, 59, 60,
511 28, 0, 0, 0, 103, 81, 0, 0, 3, 5,
512 6, 8, 0, 10, 11, 78, 0, 90, 0, 0,
513 104, 0, 19, 0, 41, 45, 15, 36, 0, 68,
514 0, 0, 0, 83, 0, 0, 64, 0, 0, 74,
515 4, 58, 0, 82, 87, 91, 0, 14, 13, 9,
516 16, 0, 71, 0, 31, 33, 0, 0, 0, 0,
517 0, 94, 0, 0, 101, 12, 63, 73, 0, 0,
518 69, 0, 0, 0, 34, 0, 110, 96, 97, 0,
519 0, 84, 0, 85, 0, 23, 0, 0, 72, 26,
520 29, 114, 0, 0, 0, 109, 0, 93, 95, 102,
521 18, 0, 0, 108, 113, 112, 0, 24, 27, 111,
523 #if defined(YYDESTRUCT_CALL) || defined(YYSTYPE_TOSTRING)
524 static const YYINT grammar_stos[] = { 0,
525 256, 40, 42, 38, 257, 258, 259, 260, 261, 262,
526 263, 264, 265, 266, 267, 268, 269, 270, 271, 272,
527 273, 274, 275, 276, 277, 278, 279, 280, 281, 282,
528 289, 59, 293, 294, 295, 296, 297, 298, 299, 300,
529 303, 304, 312, 313, 316, 317, 318, 319, 320, 321,
530 322, 323, 325, 285, 59, 258, 303, 298, 314, 315,
531 316, 288, 264, 290, 261, 266, 59, 295, 301, 302,
532 303, 332, 40, 283, 284, 316, 324, 304, 316, 324,
533 320, 258, 294, 41, 313, 298, 294, 321, 324, 59,
534 59, 44, 61, 330, 291, 321, 329, 333, 294, 307,
535 308, 309, 310, 311, 316, 285, 324, 324, 327, 303,
536 302, 334, 329, 284, 321, 40, 283, 303, 305, 306,
537 313, 41, 44, 41, 44, 303, 326, 328, 287, 284,
538 285, 41, 305, 307, 40, 283, 306, 286, 309, 316,
539 59, 44, 331, 41, 41, 41, 307, 303, 285, 41,
541 #endif /* YYDESTRUCT_CALL || YYSTYPE_TOSTRING */
542 static const YYINT grammar_dgoto[] = { 33,
543 87, 35, 36, 37, 38, 39, 40, 69, 70, 41,
544 42, 119, 120, 100, 101, 102, 103, 104, 43, 44,
545 59, 60, 45, 46, 47, 48, 49, 50, 51, 52,
546 77, 53, 127, 109, 128, 97, 94, 143, 72, 98,
549 static const YYINT grammar_sindex[] = { -2,
550 -3, 27, -239, -177, 0, 0, 0, 0, -274, 0,
551 0, 0, 0, -246, 0, 0, 0, 0, 0, 0,
552 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
553 -266, 0, 0, 455, 0, 0, 0, 0, 0, 0,
554 0, -35, -245, 128, 0, 0, -245, -2, 0, 0,
555 0, 0, 642, 0, 0, 0, -15, 0, -12, -239,
556 0, 590, 0, -27, 0, 0, 0, 0, -10, 0,
557 -11, 534, -72, 0, -237, -232, 0, -35, -232, 0,
558 0, 0, 642, 0, 0, 0, 455, 0, 0, 0,
559 0, 27, 0, 534, 0, 0, -222, 617, 209, 34,
560 39, 0, 44, 42, 0, 0, 0, 0, 27, -11,
561 0, -200, -196, -195, 0, 174, 0, 0, 0, -33,
562 243, 0, 561, 0, -177, 0, 33, 49, 0, 0,
563 0, 0, 53, 55, 417, 0, -33, 0, 0, 0,
564 0, 27, -188, 0, 0, 0, 57, 0, 0, 0,
566 static const YYINT grammar_rindex[] = { 99,
567 0, 0, 275, 0, 0, -38, 0, 0, 481, 0,
568 0, 0, 0, 509, 0, 0, 0, 0, 0, 0,
569 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
570 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
571 0, 30, 0, 0, 0, 0, 0, 101, 0, 0,
572 0, 0, 0, 0, 0, 0, 0, 0, 343, 309,
573 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
574 98, -182, 62, 0, 0, 133, 0, 64, 379, 0,
575 0, 0, -5, 0, 0, 0, 0, 0, 0, 0,
576 0, 0, 0, -182, 0, 0, 0, -180, -19, 0,
577 65, 0, 0, 68, 0, 0, 0, 0, 51, 9,
578 0, 0, 0, 0, 0, 0, 0, 0, 0, -13,
579 19, 0, 0, 0, 0, 0, 0, 52, 0, 0,
580 0, 0, 0, 0, 0, 0, 35, 0, 0, 0,
581 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
584 static const YYINT grammar_cindex[] = { 0,
585 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
586 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
587 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
588 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
589 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
590 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
591 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
592 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
593 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
594 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
595 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
596 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
597 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,
602 static const YYINT grammar_gindex[] = { 0,
603 11, -17, 0, 0, 13, 0, 0, 0, 20, 8,
604 -43, -1, -8, -89, 0, -9, 0, 0, 0, -44,
605 0, 0, 4, 0, 0, 0, 70, -53, 0, 0,
606 -18, 0, 0, 0, 0, 22, 0, 0, 0, 0,
609 #define YYTABLESIZE 924
610 static const YYINT grammar_table[] = { 58,
611 78, 58, 58, 58, 73, 58, 135, 61, 88, 57,
612 34, 5, 56, 62, 85, 58, 68, 63, 96, 7,
613 58, 98, 78, 64, 98, 84, 134, 107, 80, 3,
614 107, 90, 17, 92, 17, 4, 17, 2, 75, 3,
615 96, 71, 30, 89, 115, 147, 76, 106, 91, 93,
616 79, 75, 70, 17, 121, 55, 32, 107, 34, 105,
617 108, 114, 105, 83, 4, 68, 2, 70, 3, 68,
618 80, 121, 86, 80, 122, 106, 105, 78, 106, 5,
619 56, 68, 123, 99, 124, 125, 129, 130, 80, 131,
620 80, 141, 142, 144, 110, 145, 149, 150, 1, 110,
621 2, 30, 99, 32, 79, 92, 118, 79, 100, 21,
622 22, 111, 137, 139, 133, 113, 126, 81, 0, 0,
623 0, 0, 79, 57, 79, 0, 99, 0, 140, 0,
624 0, 0, 0, 99, 0, 0, 0, 0, 0, 0,
625 0, 70, 0, 0, 0, 99, 0, 0, 0, 148,
626 0, 0, 0, 0, 0, 0, 70, 0, 0, 0,
627 0, 0, 0, 0, 0, 4, 0, 2, 0, 0,
628 65, 0, 65, 65, 65, 0, 65, 0, 0, 0,
629 0, 0, 0, 0, 5, 6, 7, 8, 65, 10,
630 11, 65, 13, 66, 15, 16, 17, 18, 19, 20,
631 21, 22, 23, 24, 25, 26, 27, 28, 29, 30,
632 0, 4, 0, 116, 132, 3, 0, 0, 58, 58,
633 58, 58, 58, 58, 58, 78, 58, 58, 58, 58,
634 58, 58, 58, 58, 58, 58, 58, 58, 58, 58,
635 58, 58, 58, 58, 58, 78, 4, 74, 116, 136,
636 3, 17, 78, 1, 5, 6, 7, 8, 9, 10,
637 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,
638 21, 22, 23, 24, 25, 26, 27, 28, 29, 30,
639 4, 54, 116, 5, 56, 0, 31, 80, 80, 80,
640 80, 80, 80, 80, 80, 80, 80, 80, 80, 80,
641 80, 80, 80, 80, 80, 80, 80, 80, 80, 80,
642 80, 80, 88, 80, 88, 88, 88, 0, 88, 0,
643 80, 79, 79, 79, 79, 79, 79, 79, 79, 79,
644 79, 79, 79, 79, 79, 79, 79, 79, 79, 79,
645 79, 79, 79, 79, 79, 79, 89, 79, 89, 89,
646 89, 0, 89, 0, 79, 25, 25, 25, 25, 25,
647 25, 25, 25, 25, 25, 25, 25, 25, 25, 25,
648 25, 25, 25, 25, 25, 25, 25, 25, 25, 25,
649 86, 25, 86, 86, 5, 56, 86, 0, 25, 65,
650 65, 65, 65, 65, 65, 65, 0, 65, 65, 65,
651 65, 65, 65, 65, 65, 65, 65, 65, 65, 65,
652 65, 65, 65, 65, 65, 65, 75, 0, 75, 75,
653 75, 0, 75, 0, 0, 0, 0, 0, 0, 0,
654 5, 6, 7, 8, 65, 10, 11, 75, 13, 66,
655 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
656 25, 26, 27, 28, 29, 30, 117, 146, 0, 0,
657 0, 0, 0, 0, 0, 5, 6, 7, 8, 65,
658 10, 11, 0, 13, 66, 15, 16, 17, 18, 19,
659 20, 21, 22, 23, 24, 25, 26, 27, 28, 29,
660 30, 117, 4, 0, 2, 0, 3, 0, 0, 5,
661 56, 0, 0, 0, 0, 0, 0, 0, 0, 0,
662 0, 0, 0, 67, 0, 0, 0, 0, 41, 0,
663 41, 0, 41, 0, 0, 117, 0, 0, 0, 0,
664 0, 88, 88, 0, 0, 0, 0, 0, 0, 41,
665 0, 0, 0, 0, 0, 0, 45, 0, 45, 0,
666 45, 0, 0, 0, 0, 0, 0, 88, 0, 0,
667 0, 0, 0, 0, 0, 89, 89, 45, 0, 0,
668 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
669 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
670 0, 89, 0, 0, 0, 0, 0, 0, 0, 86,
671 86, 0, 0, 0, 0, 0, 0, 0, 0, 0,
672 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
673 0, 0, 0, 0, 0, 86, 0, 0, 0, 0,
674 0, 0, 0, 0, 0, 75, 75, 75, 75, 75,
675 75, 75, 0, 75, 75, 75, 75, 75, 75, 75,
676 75, 75, 75, 75, 75, 75, 75, 75, 75, 75,
677 75, 75, 0, 0, 0, 0, 0, 0, 0, 0,
678 0, 0, 0, 0, 82, 7, 8, 65, 10, 11,
679 0, 13, 66, 15, 16, 17, 18, 19, 20, 21,
680 22, 23, 24, 25, 26, 27, 28, 29, 30, 0,
681 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
682 0, 5, 6, 7, 8, 65, 10, 11, 0, 13,
683 66, 15, 16, 17, 18, 19, 20, 21, 22, 23,
684 24, 25, 26, 27, 28, 29, 30, 41, 41, 41,
685 41, 41, 41, 41, 0, 41, 41, 41, 41, 41,
686 41, 41, 41, 41, 41, 41, 41, 41, 41, 41,
687 41, 41, 41, 0, 0, 45, 45, 45, 45, 45,
688 45, 45, 0, 45, 45, 45, 45, 45, 45, 45,
689 45, 45, 45, 45, 45, 45, 45, 45, 45, 45,
690 45, 82, 7, 8, 65, 10, 11, 12, 13, 14,
691 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
692 25, 26, 27, 28, 29, 30, 0, 0, 82, 7,
693 8, 65, 10, 11, 95, 13, 66, 15, 16, 17,
694 18, 19, 20, 21, 22, 23, 24, 25, 26, 27,
695 28, 29, 30, 0, 0, 0, 138, 82, 7, 8,
696 65, 10, 11, 12, 13, 14, 15, 16, 17, 18,
697 19, 20, 21, 22, 23, 24, 25, 26, 27, 28,
698 29, 30, 0, 75, 82, 7, 8, 65, 10, 11,
699 12, 13, 14, 15, 16, 17, 18, 19, 20, 21,
700 22, 23, 24, 25, 26, 27, 28, 29, 30, 82,
701 7, 8, 65, 10, 11, 0, 13, 66, 15, 16,
702 17, 18, 19, 20, 21, 22, 23, 24, 25, 26,
705 static const YYINT grammar_check[] = { 38,
706 44, 40, 41, 42, 40, 44, 40, 4, 62, 2,
707 0, 257, 258, 288, 59, 3, 34, 264, 72, 259,
708 59, 41, 61, 290, 44, 41, 116, 41, 47, 42,
709 44, 59, 38, 44, 40, 38, 42, 40, 284, 42,
710 94, 34, 282, 62, 98, 135, 43, 285, 59, 61,
711 47, 284, 44, 59, 99, 59, 59, 76, 48, 41,
712 79, 284, 44, 53, 38, 83, 40, 59, 42, 87,
713 41, 116, 60, 44, 41, 41, 73, 121, 44, 257,
714 258, 99, 44, 73, 41, 44, 287, 284, 59, 285,
715 61, 59, 44, 41, 87, 41, 285, 41, 0, 92,
716 0, 284, 41, 284, 41, 41, 99, 44, 41, 59,
717 59, 92, 121, 123, 116, 94, 109, 48, -1, -1,
718 -1, -1, 59, 116, 61, -1, 116, -1, 125, -1,
719 -1, -1, -1, 123, -1, -1, -1, -1, -1, -1,
720 -1, 44, -1, -1, -1, 135, -1, -1, -1, 142,
721 -1, -1, -1, -1, -1, -1, 59, -1, -1, -1,
722 -1, -1, -1, -1, -1, 38, -1, 40, -1, -1,
723 38, -1, 40, 41, 42, -1, 44, -1, -1, -1,
724 -1, -1, -1, -1, 257, 258, 259, 260, 261, 262,
725 263, 59, 265, 266, 267, 268, 269, 270, 271, 272,
726 273, 274, 275, 276, 277, 278, 279, 280, 281, 282,
727 -1, 38, -1, 40, 41, 42, -1, -1, 257, 258,
728 259, 260, 261, 262, 263, 264, 265, 266, 267, 268,
729 269, 270, 271, 272, 273, 274, 275, 276, 277, 278,
730 279, 280, 281, 282, 283, 284, 38, 283, 40, 283,
731 42, 257, 291, 256, 257, 258, 259, 260, 261, 262,
732 263, 264, 265, 266, 267, 268, 269, 270, 271, 272,
733 273, 274, 275, 276, 277, 278, 279, 280, 281, 282,
734 38, 285, 40, 257, 258, -1, 289, 258, 259, 260,
735 261, 262, 263, 264, 265, 266, 267, 268, 269, 270,
736 271, 272, 273, 274, 275, 276, 277, 278, 279, 280,
737 281, 282, 38, 284, 40, 41, 42, -1, 44, -1,
738 291, 258, 259, 260, 261, 262, 263, 264, 265, 266,
739 267, 268, 269, 270, 271, 272, 273, 274, 275, 276,
740 277, 278, 279, 280, 281, 282, 38, 284, 40, 41,
741 42, -1, 44, -1, 291, 258, 259, 260, 261, 262,
742 263, 264, 265, 266, 267, 268, 269, 270, 271, 272,
743 273, 274, 275, 276, 277, 278, 279, 280, 281, 282,
744 38, 284, 40, 41, 257, 258, 44, -1, 291, 257,
745 258, 259, 260, 261, 262, 263, -1, 265, 266, 267,
746 268, 269, 270, 271, 272, 273, 274, 275, 276, 277,
747 278, 279, 280, 281, 282, 283, 38, -1, 40, 41,
748 42, -1, 44, -1, -1, -1, -1, -1, -1, -1,
749 257, 258, 259, 260, 261, 262, 263, 59, 265, 266,
750 267, 268, 269, 270, 271, 272, 273, 274, 275, 276,
751 277, 278, 279, 280, 281, 282, 283, 41, -1, -1,
752 -1, -1, -1, -1, -1, 257, 258, 259, 260, 261,
753 262, 263, -1, 265, 266, 267, 268, 269, 270, 271,
754 272, 273, 274, 275, 276, 277, 278, 279, 280, 281,
755 282, 283, 38, -1, 40, -1, 42, -1, -1, 257,
756 258, -1, -1, -1, -1, -1, -1, -1, -1, -1,
757 -1, -1, -1, 59, -1, -1, -1, -1, 38, -1,
758 40, -1, 42, -1, -1, 283, -1, -1, -1, -1,
759 -1, 257, 258, -1, -1, -1, -1, -1, -1, 59,
760 -1, -1, -1, -1, -1, -1, 38, -1, 40, -1,
761 42, -1, -1, -1, -1, -1, -1, 283, -1, -1,
762 -1, -1, -1, -1, -1, 257, 258, 59, -1, -1,
763 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
764 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
765 -1, 283, -1, -1, -1, -1, -1, -1, -1, 257,
766 258, -1, -1, -1, -1, -1, -1, -1, -1, -1,
767 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
768 -1, -1, -1, -1, -1, 283, -1, -1, -1, -1,
769 -1, -1, -1, -1, -1, 257, 258, 259, 260, 261,
770 262, 263, -1, 265, 266, 267, 268, 269, 270, 271,
771 272, 273, 274, 275, 276, 277, 278, 279, 280, 281,
772 282, 283, -1, -1, -1, -1, -1, -1, -1, -1,
773 -1, -1, -1, -1, 258, 259, 260, 261, 262, 263,
774 -1, 265, 266, 267, 268, 269, 270, 271, 272, 273,
775 274, 275, 276, 277, 278, 279, 280, 281, 282, -1,
776 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
777 -1, 257, 258, 259, 260, 261, 262, 263, -1, 265,
778 266, 267, 268, 269, 270, 271, 272, 273, 274, 275,
779 276, 277, 278, 279, 280, 281, 282, 257, 258, 259,
780 260, 261, 262, 263, -1, 265, 266, 267, 268, 269,
781 270, 271, 272, 273, 274, 275, 276, 277, 278, 279,
782 280, 281, 282, -1, -1, 257, 258, 259, 260, 261,
783 262, 263, -1, 265, 266, 267, 268, 269, 270, 271,
784 272, 273, 274, 275, 276, 277, 278, 279, 280, 281,
785 282, 258, 259, 260, 261, 262, 263, 264, 265, 266,
786 267, 268, 269, 270, 271, 272, 273, 274, 275, 276,
787 277, 278, 279, 280, 281, 282, -1, -1, 258, 259,
788 260, 261, 262, 263, 291, 265, 266, 267, 268, 269,
789 270, 271, 272, 273, 274, 275, 276, 277, 278, 279,
790 280, 281, 282, -1, -1, -1, 286, 258, 259, 260,
791 261, 262, 263, 264, 265, 266, 267, 268, 269, 270,
792 271, 272, 273, 274, 275, 276, 277, 278, 279, 280,
793 281, 282, -1, 284, 258, 259, 260, 261, 262, 263,
794 264, 265, 266, 267, 268, 269, 270, 271, 272, 273,
795 274, 275, 276, 277, 278, 279, 280, 281, 282, 258,
796 259, 260, 261, 262, 263, -1, 265, 266, 267, 268,
797 269, 270, 271, 272, 273, 274, 275, 276, 277, 278,
801 static const YYINT grammar_ctable[] = { -1,
802 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
803 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
804 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
805 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
806 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
807 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
808 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
809 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
810 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
811 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
812 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
813 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
814 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
815 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
816 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
817 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
818 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
819 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
820 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
821 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
822 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
823 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
824 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
825 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
826 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
827 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
828 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
829 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
830 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
831 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
832 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
833 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
834 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
835 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
836 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
837 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
838 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
839 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
840 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
841 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
842 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
843 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
844 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
845 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
846 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
847 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
848 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
849 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
850 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
851 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
852 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
853 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
854 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
855 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
856 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
857 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
858 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
859 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
860 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
861 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
862 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
863 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
864 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
865 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
866 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
867 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
868 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
869 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
870 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
871 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
872 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
873 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
874 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
875 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
876 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
877 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
878 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
879 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
880 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
881 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
882 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
883 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
884 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
885 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
886 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
887 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
888 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
889 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
890 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
891 -1, -1, -1, -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,
901 #define YYMAXTOKEN 291
902 #define YYUNDFTOKEN 335
903 #define YYTRANSLATE(a) ((a) > YYMAXTOKEN ? YYUNDFTOKEN : (a))
905 static const char *const grammar_name[] = {
907 "$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,
908 0,"'&'",0,"'('","')'","'*'",0,"','",0,0,0,0,0,0,0,0,0,0,0,0,0,0,"';'",0,"'='",0,
909 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
910 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,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,"error",
914 "T_IDENTIFIER","T_TYPEDEF_NAME","T_DEFINE_NAME","T_AUTO","T_EXTERN",
915 "T_REGISTER","T_STATIC","T_TYPEDEF","T_INLINE","T_EXTENSION","T_CHAR",
916 "T_DOUBLE","T_FLOAT","T_INT","T_VOID","T_LONG","T_SHORT","T_SIGNED",
917 "T_UNSIGNED","T_ENUM","T_STRUCT","T_UNION","T_Bool","T_Complex","T_Imaginary",
918 "T_TYPE_QUALIFIER","T_BRACKETS","T_LBRACE","T_MATCHRBRACE","T_ELLIPSIS",
919 "T_INITIALIZER","T_STRING_LITERAL","T_ASM","T_ASMARG","T_VA_DCL","$accept",
920 "program","decl_specifiers","decl_specifier","storage_class","type_specifier",
921 "type_qualifier","struct_or_union_specifier","enum_specifier",
922 "init_declarator_list","init_declarator","declarator","direct_declarator",
923 "abs_declarator","direct_abs_declarator","parameter_type_list","parameter_list",
924 "parameter_declaration","opt_identifier_list","identifier_list",
925 "struct_or_union","pointer","opt_type_qualifiers","type_qualifier_list",
926 "any_id","identifier_or_ref","enumeration","translation_unit",
927 "external_declaration","declaration","function_definition",
928 "linkage_specification","braces","any_typedef","opt_declarator_list","$$1",
929 "declarator_list","opt_declaration_list","$$2","$$3","$$4","declaration_list",
930 "$$5","illegal-symbol",
932 static const char *const grammar_rule[] = {
935 "program : translation_unit",
936 "translation_unit : external_declaration",
937 "translation_unit : translation_unit external_declaration",
938 "external_declaration : declaration",
939 "external_declaration : function_definition",
940 "external_declaration : ';'",
941 "external_declaration : linkage_specification",
942 "external_declaration : T_ASM T_ASMARG ';'",
943 "external_declaration : error T_MATCHRBRACE",
944 "external_declaration : error ';'",
945 "braces : T_LBRACE T_MATCHRBRACE",
946 "linkage_specification : T_EXTERN T_STRING_LITERAL braces",
947 "linkage_specification : T_EXTERN T_STRING_LITERAL declaration",
948 "declaration : decl_specifiers ';'",
949 "declaration : decl_specifiers init_declarator_list ';'",
951 "declaration : any_typedef decl_specifiers $$1 opt_declarator_list ';'",
952 "any_typedef : T_EXTENSION T_TYPEDEF",
953 "any_typedef : T_TYPEDEF",
954 "opt_declarator_list :",
955 "opt_declarator_list : declarator_list",
956 "declarator_list : declarator",
957 "declarator_list : declarator_list ',' declarator",
960 "function_definition : decl_specifiers declarator $$2 opt_declaration_list T_LBRACE $$3 T_MATCHRBRACE",
962 "function_definition : declarator $$4 opt_declaration_list T_LBRACE T_MATCHRBRACE",
963 "opt_declaration_list :",
964 "opt_declaration_list : T_VA_DCL",
965 "opt_declaration_list : declaration_list",
966 "declaration_list : declaration",
967 "declaration_list : declaration_list declaration",
968 "decl_specifiers : decl_specifier",
969 "decl_specifiers : decl_specifiers decl_specifier",
970 "decl_specifier : storage_class",
971 "decl_specifier : type_specifier",
972 "decl_specifier : type_qualifier",
973 "storage_class : T_AUTO",
974 "storage_class : T_EXTERN",
975 "storage_class : T_REGISTER",
976 "storage_class : T_STATIC",
977 "storage_class : T_INLINE",
978 "storage_class : T_EXTENSION",
979 "type_specifier : T_CHAR",
980 "type_specifier : T_DOUBLE",
981 "type_specifier : T_FLOAT",
982 "type_specifier : T_INT",
983 "type_specifier : T_LONG",
984 "type_specifier : T_SHORT",
985 "type_specifier : T_SIGNED",
986 "type_specifier : T_UNSIGNED",
987 "type_specifier : T_VOID",
988 "type_specifier : T_Bool",
989 "type_specifier : T_Complex",
990 "type_specifier : T_Imaginary",
991 "type_specifier : T_TYPEDEF_NAME",
992 "type_specifier : struct_or_union_specifier",
993 "type_specifier : enum_specifier",
994 "type_qualifier : T_TYPE_QUALIFIER",
995 "type_qualifier : T_DEFINE_NAME",
996 "struct_or_union_specifier : struct_or_union any_id braces",
997 "struct_or_union_specifier : struct_or_union braces",
998 "struct_or_union_specifier : struct_or_union any_id",
999 "struct_or_union : T_STRUCT",
1000 "struct_or_union : T_UNION",
1001 "init_declarator_list : init_declarator",
1002 "init_declarator_list : init_declarator_list ',' init_declarator",
1003 "init_declarator : declarator",
1005 "init_declarator : declarator '=' $$5 T_INITIALIZER",
1006 "enum_specifier : enumeration any_id braces",
1007 "enum_specifier : enumeration braces",
1008 "enum_specifier : enumeration any_id",
1009 "enumeration : T_ENUM",
1010 "any_id : T_IDENTIFIER",
1011 "any_id : T_TYPEDEF_NAME",
1012 "declarator : pointer direct_declarator",
1013 "declarator : direct_declarator",
1014 "direct_declarator : identifier_or_ref",
1015 "direct_declarator : '(' declarator ')'",
1016 "direct_declarator : direct_declarator T_BRACKETS",
1017 "direct_declarator : direct_declarator '(' parameter_type_list ')'",
1018 "direct_declarator : direct_declarator '(' opt_identifier_list ')'",
1019 "pointer : '*' opt_type_qualifiers",
1020 "pointer : '*' opt_type_qualifiers pointer",
1021 "opt_type_qualifiers :",
1022 "opt_type_qualifiers : type_qualifier_list",
1023 "type_qualifier_list : type_qualifier",
1024 "type_qualifier_list : type_qualifier_list type_qualifier",
1025 "parameter_type_list : parameter_list",
1026 "parameter_type_list : parameter_list ',' T_ELLIPSIS",
1027 "parameter_list : parameter_declaration",
1028 "parameter_list : parameter_list ',' parameter_declaration",
1029 "parameter_declaration : decl_specifiers declarator",
1030 "parameter_declaration : decl_specifiers abs_declarator",
1031 "parameter_declaration : decl_specifiers",
1032 "opt_identifier_list :",
1033 "opt_identifier_list : identifier_list",
1034 "identifier_list : any_id",
1035 "identifier_list : identifier_list ',' any_id",
1036 "identifier_or_ref : any_id",
1037 "identifier_or_ref : '&' any_id",
1038 "abs_declarator : pointer",
1039 "abs_declarator : pointer direct_abs_declarator",
1040 "abs_declarator : direct_abs_declarator",
1041 "direct_abs_declarator : '(' abs_declarator ')'",
1042 "direct_abs_declarator : direct_abs_declarator T_BRACKETS",
1043 "direct_abs_declarator : T_BRACKETS",
1044 "direct_abs_declarator : direct_abs_declarator '(' parameter_type_list ')'",
1045 "direct_abs_declarator : direct_abs_declarator '(' ')'",
1046 "direct_abs_declarator : '(' parameter_type_list ')'",
1047 "direct_abs_declarator : '(' ')'",
1062 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1063 YYLTYPE yyloc; /* position returned by actions */
1064 YYLTYPE yylloc; /* position from the lexer */
1067 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1068 #ifndef YYLLOC_DEFAULT
1069 #define YYLLOC_DEFAULT(loc, rhs, n) \
1074 (loc).first_line = YYRHSLOC(rhs, 0).last_line; \
1075 (loc).first_column = YYRHSLOC(rhs, 0).last_column; \
1076 (loc).last_line = YYRHSLOC(rhs, 0).last_line; \
1077 (loc).last_column = YYRHSLOC(rhs, 0).last_column; \
1081 (loc).first_line = YYRHSLOC(rhs, 1).first_line; \
1082 (loc).first_column = YYRHSLOC(rhs, 1).first_column; \
1083 (loc).last_line = YYRHSLOC(rhs, n).last_line; \
1084 (loc).last_column = YYRHSLOC(rhs, n).last_column; \
1087 #endif /* YYLLOC_DEFAULT */
1088 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
1091 #ifndef YYLVQUEUEGROWTH
1092 #define YYLVQUEUEGROWTH 32
1094 #endif /* YYBTYACC */
1096 /* define the initial stack-sizes */
1099 #define YYMAXDEPTH YYSTACKSIZE
1102 #define YYSTACKSIZE YYMAXDEPTH
1104 #define YYSTACKSIZE 10000
1105 #define YYMAXDEPTH 10000
1109 #ifndef YYINITSTACKSIZE
1110 #define YYINITSTACKSIZE 200
1120 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1127 struct YYParseState_s
1129 struct YYParseState_s *save; /* Previously saved parser state */
1130 YYSTACKDATA yystack; /* saved parser stack */
1131 int state; /* saved parser state */
1132 int errflag; /* saved error recovery status */
1133 int lexeme; /* saved index of the conflict lexeme in the lexical queue */
1134 YYINT ctry; /* saved index in yyctable[] for this conflict */
1136 typedef struct YYParseState_s YYParseState;
1137 #endif /* YYBTYACC */
1138 /* variables for the parser stack */
1139 static YYSTACKDATA yystack;
1142 /* Current parser state */
1143 static YYParseState *yyps = 0;
1145 /* yypath != NULL: do the full parse, starting at *yypath parser state. */
1146 static YYParseState *yypath = 0;
1148 /* Base of the lexical value queue */
1149 static YYSTYPE *yylvals = 0;
1151 /* Current position at lexical value queue */
1152 static YYSTYPE *yylvp = 0;
1154 /* End position of lexical value queue */
1155 static YYSTYPE *yylve = 0;
1157 /* The last allocated position at the lexical value queue */
1158 static YYSTYPE *yylvlim = 0;
1160 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1161 /* Base of the lexical position queue */
1162 static YYLTYPE *yylpsns = 0;
1164 /* Current position at lexical position queue */
1165 static YYLTYPE *yylpp = 0;
1167 /* End position of lexical position queue */
1168 static YYLTYPE *yylpe = 0;
1170 /* The last allocated position at the lexical position queue */
1171 static YYLTYPE *yylplim = 0;
1174 /* Current position at lexical token queue */
1175 static YYINT *yylexp = 0;
1177 static YYINT *yylexemes = 0;
1178 #endif /* YYBTYACC */
1179 #line 1015 "grammar.y"
1182 #define BEGIN yy_start = 1 + 2 *
1190 #define CPP_INLINE 7
1192 extern char *yytext;
1193 extern FILE *yyin, *yyout;
1195 static int curly; /* number of curly brace nesting levels */
1196 static int ly_count; /* number of occurrences of %% */
1197 static int inc_depth; /* include nesting level */
1198 static SymbolTable *included_files; /* files already included */
1199 static int yy_start = 0; /* start state number */
1201 #define grammar_error(s) yaccError(s)
1204 yaccError (const char *msg)
1207 put_error(); /* tell what line we're on, and what file */
1208 fprintf(stderr, "%s at token '%s'\n", msg, yytext);
1211 /* Initialize the table of type qualifier keywords recognized by the lexical
1217 static const char *keywords[] = {
1226 #if defined(MSDOS) || defined(OS2)
1271 "__builtin_va_list",
1284 /* Initialize type qualifier table. */
1285 type_qualifiers = new_symbol_table();
1286 for (i = 0; i < sizeof(keywords)/sizeof(keywords[0]); ++i) {
1287 new_symbol(type_qualifiers, keywords[i], NULL, DS_NONE);
1291 /* Process the C source file. Write function prototypes to the standard
1292 * output. Convert function definitions and write the converted source
1293 * code to a temporary file.
1296 process_file (FILE *infile, char *name)
1300 if (strlen(name) > 2) {
1301 s = name + strlen(name) - 2;
1304 if (*s == 'l' || *s == 'y')
1306 #if defined(MSDOS) || defined(OS2)
1307 if (*s == 'L' || *s == 'Y')
1313 included_files = new_symbol_table();
1314 typedef_names = new_symbol_table();
1315 define_names = new_symbol_table();
1321 include_file(strcpy(base_file, name), func_style != FUNC_NONE);
1322 if (file_comments) {
1324 if (lintLibrary()) {
1325 put_blankline(stdout);
1329 put_string(stdout, "/* ");
1330 put_string(stdout, cur_file_name());
1331 put_string(stdout, " */\n");
1334 free_symbol_table(define_names);
1335 free_symbol_table(typedef_names);
1336 free_symbol_table(included_files);
1343 free_symbol_table (type_qualifiers);
1345 if (yy_current_buffer != 0)
1346 yy_delete_buffer(yy_current_buffer);
1350 #line 1351 "grammar.tab.c"
1352 /* For use in generated program */
1353 #define yydepth (int)(yystack.s_mark - yystack.s_base)
1355 #define yytrial (yyps->save)
1356 #endif /* YYBTYACC */
1359 #include <stdio.h> /* needed for printf */
1362 #include <stdlib.h> /* needed for malloc, etc */
1363 #include <string.h> /* needed for memset */
1365 /* allocate initial stack or double stack size, up to YYMAXDEPTH */
1366 static int yygrowstack(YYSTACKDATA *data)
1372 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1376 if ((newsize = data->stacksize) == 0)
1377 newsize = YYINITSTACKSIZE;
1378 else if (newsize >= YYMAXDEPTH)
1380 else if ((newsize *= 2) > YYMAXDEPTH)
1381 newsize = YYMAXDEPTH;
1383 i = (int) (data->s_mark - data->s_base);
1384 newss = (YYINT *)realloc(data->s_base, newsize * sizeof(*newss));
1388 data->s_base = newss;
1389 data->s_mark = newss + i;
1391 newvs = (YYSTYPE *)realloc(data->l_base, newsize * sizeof(*newvs));
1395 data->l_base = newvs;
1396 data->l_mark = newvs + i;
1398 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1399 newps = (YYLTYPE *)realloc(data->p_base, newsize * sizeof(*newps));
1403 data->p_base = newps;
1404 data->p_mark = newps + i;
1407 data->stacksize = newsize;
1408 data->s_last = data->s_base + newsize - 1;
1412 fprintf(stderr, "%sdebug: stack size increased to %d\n", YYPREFIX, newsize);
1417 #if YYPURE || defined(YY_NO_LEAKS)
1418 static void yyfreestack(YYSTACKDATA *data)
1422 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1425 memset(data, 0, sizeof(*data));
1428 #define yyfreestack(data) /* nothing */
1429 #endif /* YYPURE || defined(YY_NO_LEAKS) */
1432 static YYParseState *
1433 yyNewState(unsigned size)
1435 YYParseState *p = (YYParseState *) malloc(sizeof(YYParseState));
1436 if (p == NULL) return NULL;
1438 p->yystack.stacksize = size;
1441 p->yystack.s_base = NULL;
1442 p->yystack.l_base = NULL;
1443 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1444 p->yystack.p_base = NULL;
1448 p->yystack.s_base = (YYINT *) malloc(size * sizeof(YYINT));
1449 if (p->yystack.s_base == NULL) return NULL;
1450 p->yystack.l_base = (YYSTYPE *) malloc(size * sizeof(YYSTYPE));
1451 if (p->yystack.l_base == NULL) return NULL;
1452 memset(p->yystack.l_base, 0, size * sizeof(YYSTYPE));
1453 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1454 p->yystack.p_base = (YYLTYPE *) malloc(size * sizeof(YYLTYPE));
1455 if (p->yystack.p_base == NULL) return NULL;
1456 memset(p->yystack.p_base, 0, size * sizeof(YYLTYPE));
1463 yyFreeState(YYParseState *p)
1465 yyfreestack(&p->yystack);
1468 #endif /* YYBTYACC */
1470 #define YYABORT goto yyabort
1471 #define YYREJECT goto yyabort
1472 #define YYACCEPT goto yyaccept
1473 #define YYERROR goto yyerrlab
1475 #define YYVALID do { if (yyps->save) goto yyvalid; } while(0)
1476 #define YYVALID_NESTED do { if (yyps->save && \
1477 yyps->save->save == 0) goto yyvalid; } while(0)
1478 #endif /* YYBTYACC */
1483 int yym, yyn, yystate, yyresult;
1486 YYParseState *yyerrctx = NULL;
1487 #endif /* YYBTYACC */
1488 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1489 YYLTYPE yyerror_loc_range[3]; /* position of error start/end (0 unused) */
1494 if ((yys = getenv("YYDEBUG")) != 0)
1497 if (yyn >= '0' && yyn <= '9')
1498 yydebug = yyn - '0';
1501 fprintf(stderr, "%sdebug[<# of symbols on state stack>]\n", YYPREFIX);
1503 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1504 memset(yyerror_loc_range, 0, sizeof(yyerror_loc_range));
1508 yyps = yyNewState(0); if (yyps == 0) goto yyenomem;
1510 #endif /* YYBTYACC */
1519 memset(&yystack, 0, sizeof(yystack));
1522 if (yystack.s_base == NULL && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
1523 yystack.s_mark = yystack.s_base;
1524 yystack.l_mark = yystack.l_base;
1525 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1526 yystack.p_mark = yystack.p_base;
1529 *yystack.s_mark = 0;
1532 if ((yyn = yydefred[yystate]) != 0) goto yyreduce;
1539 /* we're currently re-reading tokens */
1541 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1549 /* in trial mode; save scanner results for future parse attempts */
1550 if (yylvp == yylvlim)
1551 { /* Enlarge lexical value queue */
1552 size_t p = (size_t) (yylvp - yylvals);
1553 size_t s = (size_t) (yylvlim - yylvals);
1555 s += YYLVQUEUEGROWTH;
1556 if ((yylexemes = (YYINT *)realloc(yylexemes, s * sizeof(YYINT))) == NULL) goto yyenomem;
1557 if ((yylvals = (YYSTYPE *)realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) goto yyenomem;
1558 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1559 if ((yylpsns = (YYLTYPE *)realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) goto yyenomem;
1561 yylvp = yylve = yylvals + p;
1562 yylvlim = yylvals + s;
1563 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1564 yylpp = yylpe = yylpsns + p;
1565 yylplim = yylpsns + s;
1567 yylexp = yylexemes + p;
1569 *yylexp = (YYINT) YYLEX;
1572 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1579 /* normal operation, no conflict encountered */
1580 #endif /* YYBTYACC */
1584 #endif /* YYBTYACC */
1585 if (yychar < 0) yychar = YYEOF;
1589 if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN];
1590 fprintf(stderr, "%s[%d]: state %d, reading token %d (%s)",
1591 YYDEBUGSTR, yydepth, yystate, yychar, yys);
1592 #ifdef YYSTYPE_TOSTRING
1595 #endif /* YYBTYACC */
1596 fprintf(stderr, " <%s>", YYSTYPE_TOSTRING(yychar, yylval));
1598 fputc('\n', stderr);
1604 /* Do we have a conflict? */
1605 if (((yyn = yycindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
1606 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
1615 fprintf(stderr, "%s[%d]: CONFLICT in state %d: following successful trial parse\n",
1616 YYDEBUGSTR, yydepth, yystate);
1618 /* Switch to the next conflict context */
1620 yypath = save->save;
1623 if (save->state != yystate) YYABORT;
1630 /* Unresolved conflict - start/continue trial parse */
1635 fprintf(stderr, "%s[%d]: CONFLICT in state %d. ", YYDEBUGSTR, yydepth, yystate);
1637 fputs("ALREADY in conflict, continuing trial parse.\n", stderr);
1639 fputs("Starting trial parse.\n", stderr);
1642 save = yyNewState((unsigned)(yystack.s_mark - yystack.s_base + 1));
1643 if (save == NULL) goto yyenomem;
1644 save->save = yyps->save;
1645 save->state = yystate;
1646 save->errflag = yyerrflag;
1647 save->yystack.s_mark = save->yystack.s_base + (yystack.s_mark - yystack.s_base);
1648 memcpy (save->yystack.s_base, yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(YYINT));
1649 save->yystack.l_mark = save->yystack.l_base + (yystack.l_mark - yystack.l_base);
1650 memcpy (save->yystack.l_base, yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
1651 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1652 save->yystack.p_mark = save->yystack.p_base + (yystack.p_mark - yystack.p_base);
1653 memcpy (save->yystack.p_base, yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
1655 ctry = yytable[yyn];
1656 if (yyctable[ctry] == -1)
1659 if (yydebug && yychar >= YYEOF)
1660 fprintf(stderr, "%s[%d]: backtracking 1 token\n", YYDEBUGSTR, yydepth);
1665 if (yyps->save == NULL)
1667 /* If this is a first conflict in the stack, start saving lexemes */
1670 yylexemes = (YYINT *) malloc((YYLVQUEUEGROWTH) * sizeof(YYINT));
1671 if (yylexemes == NULL) goto yyenomem;
1672 yylvals = (YYSTYPE *) malloc((YYLVQUEUEGROWTH) * sizeof(YYSTYPE));
1673 if (yylvals == NULL) goto yyenomem;
1674 yylvlim = yylvals + YYLVQUEUEGROWTH;
1675 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1676 yylpsns = (YYLTYPE *) malloc((YYLVQUEUEGROWTH) * sizeof(YYLTYPE));
1677 if (yylpsns == NULL) goto yyenomem;
1678 yylplim = yylpsns + YYLVQUEUEGROWTH;
1683 yylvp = yylve = yylvals;
1684 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1685 yylpp = yylpe = yylpsns;
1688 if (yychar >= YYEOF)
1691 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1694 *yylexp = (YYINT) yychar;
1699 if (yychar >= YYEOF)
1702 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1708 save->lexeme = (int) (yylvp - yylvals);
1711 if (yytable[yyn] == ctry)
1715 fprintf(stderr, "%s[%d]: state %d, shifting to state %d\n",
1716 YYDEBUGSTR, yydepth, yystate, yyctable[ctry]);
1721 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1726 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM)
1728 yystate = yyctable[ctry];
1729 *++yystack.s_mark = (YYINT) yystate;
1730 *++yystack.l_mark = yylval;
1731 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1732 *++yystack.p_mark = yylloc;
1735 if (yyerrflag > 0) --yyerrflag;
1740 yyn = yyctable[ctry];
1743 } /* End of code dealing with conflicts */
1744 #endif /* YYBTYACC */
1745 if (((yyn = yysindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
1746 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
1750 fprintf(stderr, "%s[%d]: state %d, shifting to state %d\n",
1751 YYDEBUGSTR, yydepth, yystate, yytable[yyn]);
1753 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
1754 yystate = yytable[yyn];
1755 *++yystack.s_mark = yytable[yyn];
1756 *++yystack.l_mark = yylval;
1757 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1758 *++yystack.p_mark = yylloc;
1761 if (yyerrflag > 0) --yyerrflag;
1764 if (((yyn = yyrindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
1765 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
1770 if (yyerrflag != 0) goto yyinrecovery;
1775 goto yyerrlab; /* redundant goto avoids 'unused label' warning */
1778 /* explicit YYERROR from an action -- pop the rhs of the rule reduced
1779 * before looking for error recovery */
1780 yystack.s_mark -= yym;
1781 yystate = *yystack.s_mark;
1782 yystack.l_mark -= yym;
1783 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1784 yystack.p_mark -= yym;
1792 YYParseState *save = yyps->save;
1795 fprintf(stderr, "%s[%d]: ERROR in state %d, CONFLICT BACKTRACKING to state %d, %d tokens\n",
1796 YYDEBUGSTR, yydepth, yystate, yyps->save->state,
1797 (int)(yylvp - yylvals - yyps->save->lexeme));
1799 /* Memorize most forward-looking error state in case it's really an error. */
1800 if (yyerrctx == NULL || yyerrctx->lexeme < yylvp - yylvals)
1802 /* Free old saved error context state */
1803 if (yyerrctx) yyFreeState(yyerrctx);
1804 /* Create and fill out new saved error context state */
1805 yyerrctx = yyNewState((unsigned)(yystack.s_mark - yystack.s_base + 1));
1806 if (yyerrctx == NULL) goto yyenomem;
1807 yyerrctx->save = yyps->save;
1808 yyerrctx->state = yystate;
1809 yyerrctx->errflag = yyerrflag;
1810 yyerrctx->yystack.s_mark = yyerrctx->yystack.s_base + (yystack.s_mark - yystack.s_base);
1811 memcpy (yyerrctx->yystack.s_base, yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(YYINT));
1812 yyerrctx->yystack.l_mark = yyerrctx->yystack.l_base + (yystack.l_mark - yystack.l_base);
1813 memcpy (yyerrctx->yystack.l_base, yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
1814 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1815 yyerrctx->yystack.p_mark = yyerrctx->yystack.p_base + (yystack.p_mark - yystack.p_base);
1816 memcpy (yyerrctx->yystack.p_base, yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
1818 yyerrctx->lexeme = (int) (yylvp - yylvals);
1820 yylvp = yylvals + save->lexeme;
1821 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1822 yylpp = yylpsns + save->lexeme;
1824 yylexp = yylexemes + save->lexeme;
1826 yystack.s_mark = yystack.s_base + (save->yystack.s_mark - save->yystack.s_base);
1827 memcpy (yystack.s_base, save->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(YYINT));
1828 yystack.l_mark = yystack.l_base + (save->yystack.l_mark - save->yystack.l_base);
1829 memcpy (yystack.l_base, save->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
1830 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1831 yystack.p_mark = yystack.p_base + (save->yystack.p_mark - save->yystack.p_base);
1832 memcpy (yystack.p_base, save->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
1834 ctry = ++save->ctry;
1835 yystate = save->state;
1836 /* We tried shift, try reduce now */
1837 if ((yyn = yyctable[ctry]) >= 0) goto yyreduce;
1838 yyps->save = save->save;
1842 /* Nothing left on the stack -- error */
1847 fprintf(stderr, "%sdebug[%d,trial]: trial parse FAILED, entering ERROR mode\n",
1850 /* Restore state as it was in the most forward-advanced error */
1851 yylvp = yylvals + yyerrctx->lexeme;
1852 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1853 yylpp = yylpsns + yyerrctx->lexeme;
1855 yylexp = yylexemes + yyerrctx->lexeme;
1856 yychar = yylexp[-1];
1858 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1861 yystack.s_mark = yystack.s_base + (yyerrctx->yystack.s_mark - yyerrctx->yystack.s_base);
1862 memcpy (yystack.s_base, yyerrctx->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(YYINT));
1863 yystack.l_mark = yystack.l_base + (yyerrctx->yystack.l_mark - yyerrctx->yystack.l_base);
1864 memcpy (yystack.l_base, yyerrctx->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
1865 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1866 yystack.p_mark = yystack.p_base + (yyerrctx->yystack.p_mark - yyerrctx->yystack.p_base);
1867 memcpy (yystack.p_base, yyerrctx->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
1869 yystate = yyerrctx->state;
1870 yyFreeState(yyerrctx);
1875 if (yynewerrflag == 0) goto yyinrecovery;
1876 #endif /* YYBTYACC */
1878 YYERROR_CALL("syntax error");
1879 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1880 yyerror_loc_range[1] = yylloc; /* lookahead position is error start position */
1884 goto yyerrlab; /* redundant goto avoids 'unused label' warning */
1895 if (((yyn = yysindex[*yystack.s_mark]) != 0) && (yyn += YYERRCODE) >= 0 &&
1896 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) YYERRCODE)
1900 fprintf(stderr, "%s[%d]: state %d, error recovery shifting to state %d\n",
1901 YYDEBUGSTR, yydepth, *yystack.s_mark, yytable[yyn]);
1903 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
1904 yystate = yytable[yyn];
1905 *++yystack.s_mark = yytable[yyn];
1906 *++yystack.l_mark = yylval;
1907 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1908 /* lookahead position is error end position */
1909 yyerror_loc_range[2] = yylloc;
1910 YYLLOC_DEFAULT(yyloc, yyerror_loc_range, 2); /* position of error span */
1911 *++yystack.p_mark = yyloc;
1919 fprintf(stderr, "%s[%d]: error recovery discarding state %d\n",
1920 YYDEBUGSTR, yydepth, *yystack.s_mark);
1922 if (yystack.s_mark <= yystack.s_base) goto yyabort;
1923 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1924 /* the current TOS position is the error start position */
1925 yyerror_loc_range[1] = *yystack.p_mark;
1927 #if defined(YYDESTRUCT_CALL)
1930 #endif /* YYBTYACC */
1931 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1932 YYDESTRUCT_CALL("error: discarding state",
1933 yystos[*yystack.s_mark], yystack.l_mark, yystack.p_mark);
1935 YYDESTRUCT_CALL("error: discarding state",
1936 yystos[*yystack.s_mark], yystack.l_mark);
1937 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
1938 #endif /* defined(YYDESTRUCT_CALL) */
1941 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1949 if (yychar == YYEOF) goto yyabort;
1953 if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN];
1954 fprintf(stderr, "%s[%d]: state %d, error recovery discarding token %d (%s)\n",
1955 YYDEBUGSTR, yydepth, yystate, yychar, yys);
1958 #if defined(YYDESTRUCT_CALL)
1961 #endif /* YYBTYACC */
1962 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1963 YYDESTRUCT_CALL("error: discarding token", yychar, &yylval, &yylloc);
1965 YYDESTRUCT_CALL("error: discarding token", yychar, &yylval);
1966 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
1967 #endif /* defined(YYDESTRUCT_CALL) */
1977 fprintf(stderr, "%s[%d]: state %d, reducing by rule %d (%s)",
1978 YYDEBUGSTR, yydepth, yystate, yyn, yyrule[yyn]);
1979 #ifdef YYSTYPE_TOSTRING
1982 #endif /* YYBTYACC */
1987 for (i = yym; i > 0; i--)
1989 if (i != yym) fputs(", ", stderr);
1990 fputs(YYSTYPE_TOSTRING(yystos[yystack.s_mark[1-i]],
1991 yystack.l_mark[1-i]), stderr);
1996 fputc('\n', stderr);
2000 yyval = yystack.l_mark[1-yym];
2002 memset(&yyval, 0, sizeof yyval);
2003 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
2005 /* Perform position reduction */
2006 memset(&yyloc, 0, sizeof(yyloc));
2009 #endif /* YYBTYACC */
2011 YYLLOC_DEFAULT(yyloc, &yystack.p_mark[-yym], yym);
2012 /* just in case YYERROR is invoked within the action, save
2013 the start of the rhs as the error start position */
2014 yyerror_loc_range[1] = yystack.p_mark[1-yym];
2021 #line 378 "grammar.y"
2027 #line 382 "grammar.y"
2033 #line 393 "grammar.y"
2035 /* Provide an empty action here so bison will not complain about
2036 * incompatible types in the default action it normally would
2042 #line 400 "grammar.y"
2048 #line 407 "grammar.y"
2051 if (types_out && want_typedef()) {
2052 gen_declarations(&yystack.l_mark[-1].decl_spec, (DeclaratorList *)0);
2056 free_decl_spec(&yystack.l_mark[-1].decl_spec);
2061 #line 418 "grammar.y"
2063 if (func_params != NULL) {
2064 set_param_types(func_params, &yystack.l_mark[-2].decl_spec, &yystack.l_mark[-1].decl_list);
2066 gen_declarations(&yystack.l_mark[-2].decl_spec, &yystack.l_mark[-1].decl_list);
2070 free_decl_list(&yystack.l_mark[-1].decl_list);
2072 free_decl_spec(&yystack.l_mark[-2].decl_spec);
2077 #line 432 "grammar.y"
2079 cur_decl_spec_flags = yystack.l_mark[0].decl_spec.flags;
2080 free_decl_spec(&yystack.l_mark[0].decl_spec);
2084 #line 437 "grammar.y"
2090 #line 444 "grammar.y"
2096 #line 448 "grammar.y"
2102 #line 460 "grammar.y"
2104 int flags = cur_decl_spec_flags;
2106 /* If the typedef is a pointer type, then reset the short type
2107 * flags so it does not get promoted.
2109 if (strcmp(yystack.l_mark[0].declarator->text, yystack.l_mark[0].declarator->name) != 0)
2110 flags &= ~(DS_CHAR | DS_SHORT | DS_FLOAT);
2111 new_symbol(typedef_names, yystack.l_mark[0].declarator->name, NULL, flags);
2112 free_declarator(yystack.l_mark[0].declarator);
2116 #line 472 "grammar.y"
2118 int flags = cur_decl_spec_flags;
2120 if (strcmp(yystack.l_mark[0].declarator->text, yystack.l_mark[0].declarator->name) != 0)
2121 flags &= ~(DS_CHAR | DS_SHORT | DS_FLOAT);
2122 new_symbol(typedef_names, yystack.l_mark[0].declarator->name, NULL, flags);
2123 free_declarator(yystack.l_mark[0].declarator);
2127 #line 484 "grammar.y"
2129 check_untagged(&yystack.l_mark[-1].decl_spec);
2130 if (yystack.l_mark[0].declarator->func_def == FUNC_NONE) {
2131 yyerror("syntax error");
2134 func_params = &(yystack.l_mark[0].declarator->head->params);
2135 func_params->begin_comment = cur_file->begin_comment;
2136 func_params->end_comment = cur_file->end_comment;
2140 #line 495 "grammar.y"
2142 /* If we're converting to K&R and we've got a nominally K&R
2143 * function which has a parameter which is ANSI (i.e., a prototyped
2144 * function pointer), then we must override the deciphered value of
2145 * 'func_def' so that the parameter will be converted.
2147 if (func_style == FUNC_TRADITIONAL
2149 && yystack.l_mark[-3].declarator->head->func_def == func_style) {
2150 yystack.l_mark[-3].declarator->head->func_def = FUNC_BOTH;
2155 if (cur_file->convert)
2156 gen_func_definition(&yystack.l_mark[-4].decl_spec, yystack.l_mark[-3].declarator);
2157 gen_prototype(&yystack.l_mark[-4].decl_spec, yystack.l_mark[-3].declarator);
2161 free_decl_spec(&yystack.l_mark[-4].decl_spec);
2162 free_declarator(yystack.l_mark[-3].declarator);
2166 #line 520 "grammar.y"
2168 if (yystack.l_mark[0].declarator->func_def == FUNC_NONE) {
2169 yyerror("syntax error");
2172 func_params = &(yystack.l_mark[0].declarator->head->params);
2173 func_params->begin_comment = cur_file->begin_comment;
2174 func_params->end_comment = cur_file->end_comment;
2178 #line 530 "grammar.y"
2184 new_decl_spec(&decl_spec, dft_decl_spec(), yystack.l_mark[-4].declarator->begin, DS_NONE);
2185 if (cur_file->convert)
2186 gen_func_definition(&decl_spec, yystack.l_mark[-4].declarator);
2187 gen_prototype(&decl_spec, yystack.l_mark[-4].declarator);
2191 free_decl_spec(&decl_spec);
2192 free_declarator(yystack.l_mark[-4].declarator);
2196 #line 561 "grammar.y"
2198 join_decl_specs(&yyval.decl_spec, &yystack.l_mark[-1].decl_spec, &yystack.l_mark[0].decl_spec);
2199 free(yystack.l_mark[-1].decl_spec.text);
2200 free(yystack.l_mark[0].decl_spec.text);
2204 #line 576 "grammar.y"
2206 new_decl_spec(&yyval.decl_spec, yystack.l_mark[0].text.text, yystack.l_mark[0].text.begin, DS_NONE);
2210 #line 580 "grammar.y"
2212 new_decl_spec(&yyval.decl_spec, yystack.l_mark[0].text.text, yystack.l_mark[0].text.begin, DS_EXTERN);
2216 #line 584 "grammar.y"
2218 new_decl_spec(&yyval.decl_spec, yystack.l_mark[0].text.text, yystack.l_mark[0].text.begin, DS_NONE);
2222 #line 588 "grammar.y"
2224 new_decl_spec(&yyval.decl_spec, yystack.l_mark[0].text.text, yystack.l_mark[0].text.begin, DS_STATIC);
2228 #line 592 "grammar.y"
2230 new_decl_spec(&yyval.decl_spec, yystack.l_mark[0].text.text, yystack.l_mark[0].text.begin, DS_INLINE);
2234 #line 596 "grammar.y"
2236 new_decl_spec(&yyval.decl_spec, yystack.l_mark[0].text.text, yystack.l_mark[0].text.begin, DS_JUNK);
2240 #line 603 "grammar.y"
2242 new_decl_spec(&yyval.decl_spec, yystack.l_mark[0].text.text, yystack.l_mark[0].text.begin, DS_CHAR);
2246 #line 607 "grammar.y"
2248 new_decl_spec(&yyval.decl_spec, yystack.l_mark[0].text.text, yystack.l_mark[0].text.begin, DS_NONE);
2252 #line 611 "grammar.y"
2254 new_decl_spec(&yyval.decl_spec, yystack.l_mark[0].text.text, yystack.l_mark[0].text.begin, DS_FLOAT);
2258 #line 615 "grammar.y"
2260 new_decl_spec(&yyval.decl_spec, yystack.l_mark[0].text.text, yystack.l_mark[0].text.begin, DS_NONE);
2264 #line 619 "grammar.y"
2266 new_decl_spec(&yyval.decl_spec, yystack.l_mark[0].text.text, yystack.l_mark[0].text.begin, DS_NONE);
2270 #line 623 "grammar.y"
2272 new_decl_spec(&yyval.decl_spec, yystack.l_mark[0].text.text, yystack.l_mark[0].text.begin, DS_SHORT);
2276 #line 627 "grammar.y"
2278 new_decl_spec(&yyval.decl_spec, yystack.l_mark[0].text.text, yystack.l_mark[0].text.begin, DS_NONE);
2282 #line 631 "grammar.y"
2284 new_decl_spec(&yyval.decl_spec, yystack.l_mark[0].text.text, yystack.l_mark[0].text.begin, DS_NONE);
2288 #line 635 "grammar.y"
2290 new_decl_spec(&yyval.decl_spec, yystack.l_mark[0].text.text, yystack.l_mark[0].text.begin, DS_NONE);
2294 #line 639 "grammar.y"
2296 new_decl_spec(&yyval.decl_spec, yystack.l_mark[0].text.text, yystack.l_mark[0].text.begin, DS_CHAR);
2300 #line 643 "grammar.y"
2302 new_decl_spec(&yyval.decl_spec, yystack.l_mark[0].text.text, yystack.l_mark[0].text.begin, DS_NONE);
2306 #line 647 "grammar.y"
2308 new_decl_spec(&yyval.decl_spec, yystack.l_mark[0].text.text, yystack.l_mark[0].text.begin, DS_NONE);
2312 #line 651 "grammar.y"
2315 s = find_symbol(typedef_names, yystack.l_mark[0].text.text);
2317 new_decl_spec(&yyval.decl_spec, yystack.l_mark[0].text.text, yystack.l_mark[0].text.begin, s->flags);
2321 #line 663 "grammar.y"
2323 new_decl_spec(&yyval.decl_spec, yystack.l_mark[0].text.text, yystack.l_mark[0].text.begin, DS_NONE);
2327 #line 667 "grammar.y"
2329 /* This rule allows the <pointer> nonterminal to scan #define
2330 * names as if they were type modifiers.
2333 s = find_symbol(define_names, yystack.l_mark[0].text.text);
2335 new_decl_spec(&yyval.decl_spec, yystack.l_mark[0].text.text, yystack.l_mark[0].text.begin, s->flags);
2339 #line 680 "grammar.y"
2342 if ((s = implied_typedef()) == 0)
2343 (void)sprintf(s = buf, "%.*s %.*s", TEXT_LEN, yystack.l_mark[-2].text.text, TEXT_LEN, yystack.l_mark[-1].text.text);
2344 new_decl_spec(&yyval.decl_spec, s, yystack.l_mark[-2].text.begin, DS_NONE);
2348 #line 687 "grammar.y"
2351 if ((s = implied_typedef()) == 0)
2352 (void)sprintf(s = buf, "%.*s {}", TEXT_LEN, yystack.l_mark[-1].text.text);
2353 new_decl_spec(&yyval.decl_spec, s, yystack.l_mark[-1].text.begin, DS_NONE);
2357 #line 694 "grammar.y"
2359 (void)sprintf(buf, "%.*s %.*s", TEXT_LEN, yystack.l_mark[-1].text.text, TEXT_LEN, yystack.l_mark[0].text.text);
2360 new_decl_spec(&yyval.decl_spec, buf, yystack.l_mark[-1].text.begin, DS_NONE);
2364 #line 702 "grammar.y"
2366 imply_typedef(yyval.text.text);
2370 #line 706 "grammar.y"
2372 imply_typedef(yyval.text.text);
2376 #line 713 "grammar.y"
2378 new_decl_list(&yyval.decl_list, yystack.l_mark[0].declarator);
2382 #line 717 "grammar.y"
2384 add_decl_list(&yyval.decl_list, &yystack.l_mark[-2].decl_list, yystack.l_mark[0].declarator);
2388 #line 724 "grammar.y"
2390 if (yystack.l_mark[0].declarator->func_def != FUNC_NONE && func_params == NULL &&
2391 func_style == FUNC_TRADITIONAL && cur_file->convert) {
2392 gen_func_declarator(yystack.l_mark[0].declarator);
2393 fputs(cur_text(), cur_file->tmp_file);
2395 cur_declarator = yyval.declarator;
2399 #line 733 "grammar.y"
2401 if (yystack.l_mark[-1].declarator->func_def != FUNC_NONE && func_params == NULL &&
2402 func_style == FUNC_TRADITIONAL && cur_file->convert) {
2403 gen_func_declarator(yystack.l_mark[-1].declarator);
2404 fputs(" =", cur_file->tmp_file);
2409 #line 745 "grammar.y"
2412 if ((s = implied_typedef()) == 0)
2413 (void)sprintf(s = buf, "enum %.*s", TEXT_LEN, yystack.l_mark[-1].text.text);
2414 new_decl_spec(&yyval.decl_spec, s, yystack.l_mark[-2].text.begin, DS_NONE);
2418 #line 752 "grammar.y"
2421 if ((s = implied_typedef()) == 0)
2422 (void)sprintf(s = buf, "%.*s {}", TEXT_LEN, yystack.l_mark[-1].text.text);
2423 new_decl_spec(&yyval.decl_spec, s, yystack.l_mark[-1].text.begin, DS_NONE);
2427 #line 759 "grammar.y"
2429 (void)sprintf(buf, "enum %.*s", TEXT_LEN, yystack.l_mark[0].text.text);
2430 new_decl_spec(&yyval.decl_spec, buf, yystack.l_mark[-1].text.begin, DS_NONE);
2434 #line 767 "grammar.y"
2436 imply_typedef("enum");
2437 yyval.text = yystack.l_mark[0].text;
2441 #line 780 "grammar.y"
2443 yyval.declarator = yystack.l_mark[0].declarator;
2444 (void)sprintf(buf, "%.*s%.*s", TEXT_LEN, yystack.l_mark[-1].text.text, TEXT_LEN, yyval.declarator->text);
2445 free(yyval.declarator->text);
2446 yyval.declarator->text = xstrdup(buf);
2447 yyval.declarator->begin = yystack.l_mark[-1].text.begin;
2448 yyval.declarator->pointer = TRUE;
2452 #line 793 "grammar.y"
2454 yyval.declarator = new_declarator(yystack.l_mark[0].text.text, yystack.l_mark[0].text.text, yystack.l_mark[0].text.begin);
2458 #line 797 "grammar.y"
2460 yyval.declarator = yystack.l_mark[-1].declarator;
2461 (void)sprintf(buf, "(%.*s)", TEXT_LEN, yyval.declarator->text);
2462 free(yyval.declarator->text);
2463 yyval.declarator->text = xstrdup(buf);
2464 yyval.declarator->begin = yystack.l_mark[-2].text.begin;
2468 #line 805 "grammar.y"
2470 yyval.declarator = yystack.l_mark[-1].declarator;
2471 (void)sprintf(buf, "%.*s%.*s", TEXT_LEN, yyval.declarator->text, TEXT_LEN, yystack.l_mark[0].text.text);
2472 free(yyval.declarator->text);
2473 yyval.declarator->text = xstrdup(buf);
2477 #line 812 "grammar.y"
2479 yyval.declarator = new_declarator("%s()", yystack.l_mark[-3].declarator->name, yystack.l_mark[-3].declarator->begin);
2480 yyval.declarator->params = yystack.l_mark[-1].param_list;
2481 yyval.declarator->func_stack = yystack.l_mark[-3].declarator;
2482 yyval.declarator->head = (yystack.l_mark[-3].declarator->func_stack == NULL) ? yyval.declarator : yystack.l_mark[-3].declarator->head;
2483 yyval.declarator->func_def = FUNC_ANSI;
2487 #line 820 "grammar.y"
2489 yyval.declarator = new_declarator("%s()", yystack.l_mark[-3].declarator->name, yystack.l_mark[-3].declarator->begin);
2490 yyval.declarator->params = yystack.l_mark[-1].param_list;
2491 yyval.declarator->func_stack = yystack.l_mark[-3].declarator;
2492 yyval.declarator->head = (yystack.l_mark[-3].declarator->func_stack == NULL) ? yyval.declarator : yystack.l_mark[-3].declarator->head;
2493 yyval.declarator->func_def = FUNC_TRADITIONAL;
2497 #line 831 "grammar.y"
2499 (void)sprintf(yyval.text.text, "*%.*s", TEXT_LEN, yystack.l_mark[0].text.text);
2500 yyval.text.begin = yystack.l_mark[-1].text.begin;
2504 #line 836 "grammar.y"
2506 (void)sprintf(yyval.text.text, "*%.*s%.*s", TEXT_LEN, yystack.l_mark[-1].text.text, TEXT_LEN, yystack.l_mark[0].text.text);
2507 yyval.text.begin = yystack.l_mark[-2].text.begin;
2511 #line 844 "grammar.y"
2513 strcpy(yyval.text.text, "");
2514 yyval.text.begin = 0L;
2518 #line 853 "grammar.y"
2520 (void)sprintf(yyval.text.text, "%s ", yystack.l_mark[0].decl_spec.text);
2521 yyval.text.begin = yystack.l_mark[0].decl_spec.begin;
2522 free(yystack.l_mark[0].decl_spec.text);
2526 #line 859 "grammar.y"
2528 (void)sprintf(yyval.text.text, "%.*s%.*s ", TEXT_LEN, yystack.l_mark[-1].text.text, TEXT_LEN, yystack.l_mark[0].decl_spec.text);
2529 yyval.text.begin = yystack.l_mark[-1].text.begin;
2530 free(yystack.l_mark[0].decl_spec.text);
2534 #line 869 "grammar.y"
2536 add_ident_list(&yyval.param_list, &yystack.l_mark[-2].param_list, "...");
2540 #line 876 "grammar.y"
2542 new_param_list(&yyval.param_list, yystack.l_mark[0].parameter);
2546 #line 880 "grammar.y"
2548 add_param_list(&yyval.param_list, &yystack.l_mark[-2].param_list, yystack.l_mark[0].parameter);
2552 #line 887 "grammar.y"
2554 check_untagged(&yystack.l_mark[-1].decl_spec);
2555 yyval.parameter = new_parameter(&yystack.l_mark[-1].decl_spec, yystack.l_mark[0].declarator);
2559 #line 892 "grammar.y"
2561 check_untagged(&yystack.l_mark[-1].decl_spec);
2562 yyval.parameter = new_parameter(&yystack.l_mark[-1].decl_spec, yystack.l_mark[0].declarator);
2566 #line 897 "grammar.y"
2568 check_untagged(&yystack.l_mark[0].decl_spec);
2569 yyval.parameter = new_parameter(&yystack.l_mark[0].decl_spec, (Declarator *)0);
2573 #line 905 "grammar.y"
2575 new_ident_list(&yyval.param_list);
2579 #line 913 "grammar.y"
2581 new_ident_list(&yyval.param_list);
2582 add_ident_list(&yyval.param_list, &yyval.param_list, yystack.l_mark[0].text.text);
2586 #line 918 "grammar.y"
2588 add_ident_list(&yyval.param_list, &yystack.l_mark[-2].param_list, yystack.l_mark[0].text.text);
2592 #line 925 "grammar.y"
2594 yyval.text = yystack.l_mark[0].text;
2598 #line 929 "grammar.y"
2601 if (lintLibrary()) { /* Lint doesn't grok C++ ref variables */
2602 yyval.text = yystack.l_mark[0].text;
2605 (void)sprintf(yyval.text.text, "&%.*s", TEXT_LEN, yystack.l_mark[0].text.text);
2606 yyval.text.begin = yystack.l_mark[-1].text.begin;
2610 #line 942 "grammar.y"
2612 yyval.declarator = new_declarator(yystack.l_mark[0].text.text, "", yystack.l_mark[0].text.begin);
2616 #line 946 "grammar.y"
2618 yyval.declarator = yystack.l_mark[0].declarator;
2619 (void)sprintf(buf, "%.*s%.*s", TEXT_LEN, yystack.l_mark[-1].text.text, TEXT_LEN, yyval.declarator->text);
2620 free(yyval.declarator->text);
2621 yyval.declarator->text = xstrdup(buf);
2622 yyval.declarator->begin = yystack.l_mark[-1].text.begin;
2626 #line 958 "grammar.y"
2628 yyval.declarator = yystack.l_mark[-1].declarator;
2629 (void)sprintf(buf, "(%.*s)", TEXT_LEN, yyval.declarator->text);
2630 free(yyval.declarator->text);
2631 yyval.declarator->text = xstrdup(buf);
2632 yyval.declarator->begin = yystack.l_mark[-2].text.begin;
2636 #line 966 "grammar.y"
2638 yyval.declarator = yystack.l_mark[-1].declarator;
2639 (void)sprintf(buf, "%.*s%.*s", TEXT_LEN, yyval.declarator->text, TEXT_LEN, yystack.l_mark[0].text.text);
2640 free(yyval.declarator->text);
2641 yyval.declarator->text = xstrdup(buf);
2645 #line 973 "grammar.y"
2647 yyval.declarator = new_declarator(yystack.l_mark[0].text.text, "", yystack.l_mark[0].text.begin);
2651 #line 977 "grammar.y"
2653 yyval.declarator = new_declarator("%s()", "", yystack.l_mark[-3].declarator->begin);
2654 yyval.declarator->params = yystack.l_mark[-1].param_list;
2655 yyval.declarator->func_stack = yystack.l_mark[-3].declarator;
2656 yyval.declarator->head = (yystack.l_mark[-3].declarator->func_stack == NULL) ? yyval.declarator : yystack.l_mark[-3].declarator->head;
2657 yyval.declarator->func_def = FUNC_ANSI;
2661 #line 985 "grammar.y"
2663 yyval.declarator = new_declarator("%s()", "", yystack.l_mark[-2].declarator->begin);
2664 yyval.declarator->func_stack = yystack.l_mark[-2].declarator;
2665 yyval.declarator->head = (yystack.l_mark[-2].declarator->func_stack == NULL) ? yyval.declarator : yystack.l_mark[-2].declarator->head;
2666 yyval.declarator->func_def = FUNC_ANSI;
2670 #line 992 "grammar.y"
2674 d = new_declarator("", "", yystack.l_mark[-2].text.begin);
2675 yyval.declarator = new_declarator("%s()", "", yystack.l_mark[-2].text.begin);
2676 yyval.declarator->params = yystack.l_mark[-1].param_list;
2677 yyval.declarator->func_stack = d;
2678 yyval.declarator->head = yyval.declarator;
2679 yyval.declarator->func_def = FUNC_ANSI;
2683 #line 1003 "grammar.y"
2687 d = new_declarator("", "", yystack.l_mark[-1].text.begin);
2688 yyval.declarator = new_declarator("%s()", "", yystack.l_mark[-1].text.begin);
2689 yyval.declarator->func_stack = d;
2690 yyval.declarator->head = yyval.declarator;
2691 yyval.declarator->func_def = FUNC_ANSI;
2694 #line 2695 "grammar.tab.c"
2698 yystack.s_mark -= yym;
2699 yystate = *yystack.s_mark;
2700 yystack.l_mark -= yym;
2701 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
2702 yystack.p_mark -= yym;
2705 if (yystate == 0 && yym == 0)
2710 fprintf(stderr, "%s[%d]: after reduction, ", YYDEBUGSTR, yydepth);
2711 #ifdef YYSTYPE_TOSTRING
2714 #endif /* YYBTYACC */
2715 fprintf(stderr, "result is <%s>, ", YYSTYPE_TOSTRING(yystos[YYFINAL], yyval));
2717 fprintf(stderr, "shifting from state 0 to final state %d\n", YYFINAL);
2721 *++yystack.s_mark = YYFINAL;
2722 *++yystack.l_mark = yyval;
2723 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
2724 *++yystack.p_mark = yyloc;
2732 /* we're currently re-reading tokens */
2734 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
2742 /* in trial mode; save scanner results for future parse attempts */
2743 if (yylvp == yylvlim)
2744 { /* Enlarge lexical value queue */
2745 size_t p = (size_t) (yylvp - yylvals);
2746 size_t s = (size_t) (yylvlim - yylvals);
2748 s += YYLVQUEUEGROWTH;
2749 if ((yylexemes = (YYINT *)realloc(yylexemes, s * sizeof(YYINT))) == NULL)
2751 if ((yylvals = (YYSTYPE *)realloc(yylvals, s * sizeof(YYSTYPE))) == NULL)
2753 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
2754 if ((yylpsns = (YYLTYPE *)realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL)
2757 yylvp = yylve = yylvals + p;
2758 yylvlim = yylvals + s;
2759 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
2760 yylpp = yylpe = yylpsns + p;
2761 yylplim = yylpsns + s;
2763 yylexp = yylexemes + p;
2765 *yylexp = (YYINT) YYLEX;
2768 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
2775 /* normal operation, no conflict encountered */
2776 #endif /* YYBTYACC */
2780 #endif /* YYBTYACC */
2781 if (yychar < 0) yychar = YYEOF;
2785 if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN];
2786 fprintf(stderr, "%s[%d]: state %d, reading token %d (%s)\n",
2787 YYDEBUGSTR, yydepth, YYFINAL, yychar, yys);
2791 if (yychar == YYEOF) goto yyaccept;
2794 if (((yyn = yygindex[yym]) != 0) && (yyn += yystate) >= 0 &&
2795 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yystate)
2796 yystate = yytable[yyn];
2798 yystate = yydgoto[yym];
2802 fprintf(stderr, "%s[%d]: after reduction, ", YYDEBUGSTR, yydepth);
2803 #ifdef YYSTYPE_TOSTRING
2806 #endif /* YYBTYACC */
2807 fprintf(stderr, "result is <%s>, ", YYSTYPE_TOSTRING(yystos[yystate], yyval));
2809 fprintf(stderr, "shifting from state %d to state %d\n", *yystack.s_mark, yystate);
2812 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
2813 *++yystack.s_mark = (YYINT) yystate;
2814 *++yystack.l_mark = yyval;
2815 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
2816 *++yystack.p_mark = yyloc;
2821 /* Reduction declares that this path is valid. Set yypath and do a full parse */
2823 if (yypath) YYABORT;
2826 YYParseState *save = yyps->save;
2827 yyps->save = save->save;
2828 save->save = yypath;
2833 fprintf(stderr, "%s[%d]: state %d, CONFLICT trial successful, backtracking to state %d, %d tokens\n",
2834 YYDEBUGSTR, yydepth, yystate, yypath->state, (int)(yylvp - yylvals - yypath->lexeme));
2838 yyFreeState(yyerrctx);
2841 yylvp = yylvals + yypath->lexeme;
2842 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
2843 yylpp = yylpsns + yypath->lexeme;
2845 yylexp = yylexemes + yypath->lexeme;
2847 yystack.s_mark = yystack.s_base + (yypath->yystack.s_mark - yypath->yystack.s_base);
2848 memcpy (yystack.s_base, yypath->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(YYINT));
2849 yystack.l_mark = yystack.l_base + (yypath->yystack.l_mark - yypath->yystack.l_base);
2850 memcpy (yystack.l_base, yypath->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
2851 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
2852 yystack.p_mark = yystack.p_base + (yypath->yystack.p_mark - yypath->yystack.p_base);
2853 memcpy (yystack.p_base, yypath->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
2855 yystate = yypath->state;
2857 #endif /* YYBTYACC */
2860 YYERROR_CALL("yacc stack overflow");
2864 YYERROR_CALL("memory exhausted");
2866 #endif /* YYBTYACC */
2876 if (yyps->save) goto yyvalid;
2877 #endif /* YYBTYACC */
2881 #if defined(YYDESTRUCT_CALL)
2882 if (yychar != YYEOF && yychar != YYEMPTY)
2883 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
2884 YYDESTRUCT_CALL("cleanup: discarding token", yychar, &yylval, &yylloc);
2886 YYDESTRUCT_CALL("cleanup: discarding token", yychar, &yylval);
2887 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
2891 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
2894 for (pv = yystack.l_base, pp = yystack.p_base; pv <= yystack.l_mark; ++pv, ++pp)
2895 YYDESTRUCT_CALL("cleanup: discarding state",
2896 yystos[*(yystack.s_base + (pv - yystack.l_base))], pv, pp);
2898 for (pv = yystack.l_base; pv <= yystack.l_mark; ++pv)
2899 YYDESTRUCT_CALL("cleanup: discarding state",
2900 yystos[*(yystack.s_base + (pv - yystack.l_base))], pv);
2901 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
2903 #endif /* defined(YYDESTRUCT_CALL) */
2908 yyFreeState(yyerrctx);
2913 YYParseState *save = yyps;
2920 YYParseState *save = yypath;
2921 yypath = save->save;
2925 #endif /* YYBTYACC */
2926 yyfreestack(&yystack);