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