]> git.saurik.com Git - bison.git/blame_incremental - src/parse-gram.c
Add Makevars.template, stamp-po.
[bison.git] / src / parse-gram.c
... / ...
CommitLineData
1/* A Bison parser, made by GNU Bison 1.875c. */
2
3/* Skeleton parser for Yacc-like parsing with Bison,
4 Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
5
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2, or (at your option)
9 any later version.
10
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 59 Temple Place - Suite 330,
19 Boston, MA 02111-1307, USA. */
20
21/* As a special exception, when this file is copied by Bison into a
22 Bison output file, you may use that output file without restriction.
23 This special exception was added by the Free Software Foundation
24 in version 1.24 of Bison. */
25
26/* Written by Richard Stallman by simplifying the original so called
27 ``semantic'' parser. */
28
29/* All symbols defined below should begin with yy or YY, to avoid
30 infringing on user name space. This should be done even for local
31 variables, as they might otherwise be expanded by user macros.
32 There are some unavoidable exceptions within include files to
33 define necessary library symbols; they are noted "INFRINGES ON
34 USER NAME SPACE" below. */
35
36/* Identify Bison output. */
37#define YYBISON 1
38
39/* Skeleton name. */
40#define YYSKELETON_NAME "yacc.c"
41
42/* Pure parsers. */
43#define YYPURE 1
44
45/* Using locations. */
46#define YYLSP_NEEDED 1
47
48/* If NAME_PREFIX is specified substitute the variables and functions
49 names. */
50#define yyparse gram_parse
51#define yylex gram_lex
52#define yyerror gram_error
53#define yylval gram_lval
54#define yychar gram_char
55#define yydebug gram_debug
56#define yynerrs gram_nerrs
57#define yylloc gram_lloc
58
59/* Tokens. */
60#ifndef YYTOKENTYPE
61# define YYTOKENTYPE
62 /* Put the tokens into the symbol table, so that GDB and other debuggers
63 know about them. */
64 enum yytokentype {
65 GRAM_EOF = 0,
66 STRING = 258,
67 INT = 259,
68 PERCENT_TOKEN = 260,
69 PERCENT_NTERM = 261,
70 PERCENT_TYPE = 262,
71 PERCENT_DESTRUCTOR = 263,
72 PERCENT_PRINTER = 264,
73 PERCENT_UNION = 265,
74 PERCENT_LEFT = 266,
75 PERCENT_RIGHT = 267,
76 PERCENT_NONASSOC = 268,
77 PERCENT_PREC = 269,
78 PERCENT_DPREC = 270,
79 PERCENT_MERGE = 271,
80 PERCENT_DEBUG = 272,
81 PERCENT_DEFAULT_PREC = 273,
82 PERCENT_DEFINE = 274,
83 PERCENT_DEFINES = 275,
84 PERCENT_ERROR_VERBOSE = 276,
85 PERCENT_EXPECT = 277,
86 PERCENT_FILE_PREFIX = 278,
87 PERCENT_GLR_PARSER = 279,
88 PERCENT_INITIAL_ACTION = 280,
89 PERCENT_LEX_PARAM = 281,
90 PERCENT_LOCATIONS = 282,
91 PERCENT_NAME_PREFIX = 283,
92 PERCENT_NO_DEFAULT_PREC = 284,
93 PERCENT_NO_LINES = 285,
94 PERCENT_NONDETERMINISTIC_PARSER = 286,
95 PERCENT_OUTPUT = 287,
96 PERCENT_PARSE_PARAM = 288,
97 PERCENT_PURE_PARSER = 289,
98 PERCENT_SKELETON = 290,
99 PERCENT_START = 291,
100 PERCENT_TOKEN_TABLE = 292,
101 PERCENT_VERBOSE = 293,
102 PERCENT_YACC = 294,
103 TYPE = 295,
104 EQUAL = 296,
105 SEMICOLON = 297,
106 PIPE = 298,
107 ID = 299,
108 ID_COLON = 300,
109 PERCENT_PERCENT = 301,
110 PROLOGUE = 302,
111 EPILOGUE = 303,
112 BRACED_CODE = 304
113 };
114#endif
115#define GRAM_EOF 0
116#define STRING 258
117#define INT 259
118#define PERCENT_TOKEN 260
119#define PERCENT_NTERM 261
120#define PERCENT_TYPE 262
121#define PERCENT_DESTRUCTOR 263
122#define PERCENT_PRINTER 264
123#define PERCENT_UNION 265
124#define PERCENT_LEFT 266
125#define PERCENT_RIGHT 267
126#define PERCENT_NONASSOC 268
127#define PERCENT_PREC 269
128#define PERCENT_DPREC 270
129#define PERCENT_MERGE 271
130#define PERCENT_DEBUG 272
131#define PERCENT_DEFAULT_PREC 273
132#define PERCENT_DEFINE 274
133#define PERCENT_DEFINES 275
134#define PERCENT_ERROR_VERBOSE 276
135#define PERCENT_EXPECT 277
136#define PERCENT_FILE_PREFIX 278
137#define PERCENT_GLR_PARSER 279
138#define PERCENT_INITIAL_ACTION 280
139#define PERCENT_LEX_PARAM 281
140#define PERCENT_LOCATIONS 282
141#define PERCENT_NAME_PREFIX 283
142#define PERCENT_NO_DEFAULT_PREC 284
143#define PERCENT_NO_LINES 285
144#define PERCENT_NONDETERMINISTIC_PARSER 286
145#define PERCENT_OUTPUT 287
146#define PERCENT_PARSE_PARAM 288
147#define PERCENT_PURE_PARSER 289
148#define PERCENT_SKELETON 290
149#define PERCENT_START 291
150#define PERCENT_TOKEN_TABLE 292
151#define PERCENT_VERBOSE 293
152#define PERCENT_YACC 294
153#define TYPE 295
154#define EQUAL 296
155#define SEMICOLON 297
156#define PIPE 298
157#define ID 299
158#define ID_COLON 300
159#define PERCENT_PERCENT 301
160#define PROLOGUE 302
161#define EPILOGUE 303
162#define BRACED_CODE 304
163
164
165
166
167/* Copy the first part of user declarations. */
168#line 32 "parse-gram.y"
169
170#include "system.h"
171
172#include "complain.h"
173#include "conflicts.h"
174#include "files.h"
175#include "getargs.h"
176#include "gram.h"
177#include "muscle_tab.h"
178#include "output.h"
179#include "reader.h"
180#include "symlist.h"
181
182#define YYLLOC_DEFAULT(Current, Rhs, N) (Current) = lloc_default (Rhs, N)
183static YYLTYPE lloc_default (YYLTYPE const *, int);
184
185/* Request detailed syntax error messages, and pass them to GRAM_ERROR.
186 FIXME: depends on the undocumented availability of YYLLOC. */
187#undef yyerror
188#define yyerror(Msg) \
189 gram_error (&yylloc, Msg)
190static void gram_error (location const *, char const *);
191
192#define YYPRINT(File, Type, Value) \
193 print_token_value (File, Type, &Value)
194static void print_token_value (FILE *, int, YYSTYPE const *);
195
196static void add_param (char const *, char *, location);
197
198symbol_class current_class = unknown_sym;
199uniqstr current_type = 0;
200symbol *current_lhs;
201location current_lhs_location;
202assoc current_assoc;
203int current_prec = 0;
204
205
206/* Enabling traces. */
207#ifndef YYDEBUG
208# define YYDEBUG 1
209#endif
210
211/* Enabling verbose error messages. */
212#ifdef YYERROR_VERBOSE
213# undef YYERROR_VERBOSE
214# define YYERROR_VERBOSE 1
215#else
216# define YYERROR_VERBOSE 1
217#endif
218
219#if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED)
220#line 80 "parse-gram.y"
221typedef union YYSTYPE {
222 symbol *symbol;
223 symbol_list *list;
224 int integer;
225 char *chars;
226 assoc assoc;
227 uniqstr uniqstr;
228} YYSTYPE;
229/* Line 191 of yacc.c. */
230#line 231 "parse-gram.c"
231# define yystype YYSTYPE /* obsolescent; will be withdrawn */
232# define YYSTYPE_IS_DECLARED 1
233# define YYSTYPE_IS_TRIVIAL 1
234#endif
235
236#if ! defined (YYLTYPE) && ! defined (YYLTYPE_IS_DECLARED)
237typedef struct YYLTYPE
238{
239 int first_line;
240 int first_column;
241 int last_line;
242 int last_column;
243} YYLTYPE;
244# define yyltype YYLTYPE /* obsolescent; will be withdrawn */
245# define YYLTYPE_IS_DECLARED 1
246# define YYLTYPE_IS_TRIVIAL 1
247#endif
248
249
250/* Copy the second part of user declarations. */
251
252
253/* Line 214 of yacc.c. */
254#line 255 "parse-gram.c"
255
256#if ! defined (yyoverflow) || YYERROR_VERBOSE
257
258# ifndef YYFREE
259# define YYFREE free
260# endif
261# ifndef YYMALLOC
262# define YYMALLOC malloc
263# endif
264
265/* The parser invokes alloca or malloc; define the necessary symbols. */
266
267# ifdef YYSTACK_USE_ALLOCA
268# if YYSTACK_USE_ALLOCA
269# define YYSTACK_ALLOC alloca
270# endif
271# else
272# if defined (alloca) || defined (_ALLOCA_H)
273# define YYSTACK_ALLOC alloca
274# else
275# ifdef __GNUC__
276# define YYSTACK_ALLOC __builtin_alloca
277# endif
278# endif
279# endif
280
281# ifdef YYSTACK_ALLOC
282 /* Pacify GCC's `empty if-body' warning. */
283# define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
284# else
285# if defined (__STDC__) || defined (__cplusplus)
286# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
287# define YYSIZE_T size_t
288# endif
289# define YYSTACK_ALLOC YYMALLOC
290# define YYSTACK_FREE YYFREE
291# endif
292#endif /* ! defined (yyoverflow) || YYERROR_VERBOSE */
293
294
295#if (! defined (yyoverflow) \
296 && (! defined (__cplusplus) \
297 || (defined (YYLTYPE_IS_TRIVIAL) && YYLTYPE_IS_TRIVIAL \
298 && defined (YYSTYPE_IS_TRIVIAL) && YYSTYPE_IS_TRIVIAL)))
299
300/* A type that is properly aligned for any stack member. */
301union yyalloc
302{
303 short yyss;
304 YYSTYPE yyvs;
305 YYLTYPE yyls;
306};
307
308/* The size of the maximum gap between one aligned stack and the next. */
309# define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
310
311/* The size of an array large to enough to hold all stacks, each with
312 N elements. */
313# define YYSTACK_BYTES(N) \
314 ((N) * (sizeof (short) + sizeof (YYSTYPE) + sizeof (YYLTYPE)) \
315 + 2 * YYSTACK_GAP_MAXIMUM)
316
317/* Copy COUNT objects from FROM to TO. The source and destination do
318 not overlap. */
319# ifndef YYCOPY
320# if defined (__GNUC__) && 1 < __GNUC__
321# define YYCOPY(To, From, Count) \
322 __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
323# else
324# define YYCOPY(To, From, Count) \
325 do \
326 { \
327 register YYSIZE_T yyi; \
328 for (yyi = 0; yyi < (Count); yyi++) \
329 (To)[yyi] = (From)[yyi]; \
330 } \
331 while (0)
332# endif
333# endif
334
335/* Relocate STACK from its old location to the new one. The
336 local variables YYSIZE and YYSTACKSIZE give the old and new number of
337 elements in the stack, and YYPTR gives the new location of the
338 stack. Advance YYPTR to a properly aligned location for the next
339 stack. */
340# define YYSTACK_RELOCATE(Stack) \
341 do \
342 { \
343 YYSIZE_T yynewbytes; \
344 YYCOPY (&yyptr->Stack, Stack, yysize); \
345 Stack = &yyptr->Stack; \
346 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
347 yyptr += yynewbytes / sizeof (*yyptr); \
348 } \
349 while (0)
350
351#endif
352
353#if defined (__STDC__) || defined (__cplusplus)
354 typedef signed char yysigned_char;
355#else
356 typedef short yysigned_char;
357#endif
358
359/* YYFINAL -- State number of the termination state. */
360#define YYFINAL 3
361/* YYLAST -- Last index in YYTABLE. */
362#define YYLAST 156
363
364/* YYNTOKENS -- Number of terminals. */
365#define YYNTOKENS 50
366/* YYNNTS -- Number of nonterminals. */
367#define YYNNTS 25
368/* YYNRULES -- Number of rules. */
369#define YYNRULES 78
370/* YYNRULES -- Number of states. */
371#define YYNSTATES 106
372
373/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
374#define YYUNDEFTOK 2
375#define YYMAXUTOK 304
376
377#define YYTRANSLATE(YYX) \
378 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
379
380/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
381static const unsigned char yytranslate[] =
382{
383 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
384 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
385 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
386 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
387 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
388 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
389 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
390 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
391 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
392 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
393 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
394 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
395 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
396 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
397 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
398 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
399 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
400 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
401 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
402 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
403 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
404 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
405 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
406 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
407 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
408 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
409 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
410 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
411 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
412 35, 36, 37, 38, 39, 40, 41, 42, 43, 44,
413 45, 46, 47, 48, 49
414};
415
416#if YYDEBUG
417/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
418 YYRHS. */
419static const unsigned char yyprhs[] =
420{
421 0, 0, 3, 8, 9, 12, 14, 16, 18, 22,
422 24, 26, 29, 33, 35, 37, 39, 41, 45, 47,
423 49, 53, 55, 57, 60, 62, 64, 66, 68, 70,
424 72, 75, 77, 80, 83, 85, 87, 88, 92, 93,
425 97, 101, 105, 107, 109, 111, 112, 114, 116, 119,
426 121, 123, 126, 129, 133, 135, 138, 140, 143, 145,
427 148, 151, 152, 156, 158, 162, 165, 166, 169, 172,
428 176, 180, 184, 186, 188, 190, 192, 194, 195
429};
430
431/* YYRHS -- A `-1'-separated list of the rules' RHS. */
432static const yysigned_char yyrhs[] =
433{
434 51, 0, -1, 52, 46, 64, 74, -1, -1, 52,
435 53, -1, 54, -1, 47, -1, 17, -1, 19, 73,
436 73, -1, 20, -1, 21, -1, 22, 4, -1, 23,
437 41, 73, -1, 24, -1, 25, -1, 26, -1, 27,
438 -1, 28, 41, 73, -1, 30, -1, 31, -1, 32,
439 41, 73, -1, 33, -1, 34, -1, 35, 73, -1,
440 37, -1, 38, -1, 39, -1, 42, -1, 58, -1,
441 55, -1, 36, 70, -1, 10, -1, 8, 61, -1,
442 9, 61, -1, 18, -1, 29, -1, -1, 6, 56,
443 63, -1, -1, 5, 57, 63, -1, 7, 40, 61,
444 -1, 59, 60, 61, -1, 11, -1, 12, -1, 13,
445 -1, -1, 40, -1, 70, -1, 61, 70, -1, 40,
446 -1, 44, -1, 44, 4, -1, 44, 72, -1, 44,
447 4, 72, -1, 62, -1, 63, 62, -1, 65, -1,
448 64, 65, -1, 66, -1, 54, 42, -1, 1, 42,
449 -1, -1, 45, 67, 68, -1, 69, -1, 68, 43,
450 69, -1, 68, 42, -1, -1, 69, 70, -1, 69,
451 71, -1, 69, 14, 70, -1, 69, 15, 4, -1,
452 69, 16, 40, -1, 44, -1, 72, -1, 49, -1,
453 3, -1, 3, -1, -1, 46, 48, -1
454};
455
456/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
457static const unsigned short yyrline[] =
458{
459 0, 172, 172, 180, 182, 186, 187, 188, 189, 190,
460 191, 192, 193, 194, 199, 203, 204, 205, 206, 207,
461 208, 209, 210, 211, 212, 213, 214, 215, 219, 220,
462 221, 225, 231, 238, 245, 249, 256, 256, 261, 261,
463 266, 276, 291, 292, 293, 297, 298, 304, 305, 310,
464 314, 319, 325, 331, 342, 343, 352, 353, 359, 360,
465 365, 372, 372, 376, 377, 378, 383, 384, 386, 388,
466 390, 392, 397, 398, 402, 408, 417, 424, 426
467};
468#endif
469
470#if YYDEBUG || YYERROR_VERBOSE
471/* YYTNME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
472 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
473static const char *const yytname[] =
474{
475 "\"end of file\"", "error", "$undefined", "\"string\"", "\"integer\"",
476 "\"%token\"", "\"%nterm\"", "\"%type\"", "\"%destructor {...}\"",
477 "\"%printer {...}\"", "\"%union {...}\"", "\"%left\"", "\"%right\"",
478 "\"%nonassoc\"", "\"%prec\"", "\"%dprec\"", "\"%merge\"", "\"%debug\"",
479 "\"%default-prec\"", "\"%define\"", "\"%defines\"", "\"%error-verbose\"",
480 "\"%expect\"", "\"%file-prefix\"", "\"%glr-parser\"",
481 "\"%initial-action {...}\"", "\"%lex-param {...}\"", "\"%locations\"",
482 "\"%name-prefix\"", "\"%no-default-prec\"", "\"%no-lines\"",
483 "\"%nondeterministic-parser\"", "\"%output\"", "\"%parse-param {...}\"",
484 "\"%pure-parser\"", "\"%skeleton\"", "\"%start\"", "\"%token-table\"",
485 "\"%verbose\"", "\"%yacc\"", "\"type\"", "\"=\"", "\";\"", "\"|\"",
486 "\"identifier\"", "\"identifier:\"", "\"%%\"", "\"%{...%}\"",
487 "\"epilogue\"", "\"{...}\"", "$accept", "input", "declarations",
488 "declaration", "grammar_declaration", "symbol_declaration", "@1", "@2",
489 "precedence_declaration", "precedence_declarator", "type.opt",
490 "symbols.1", "symbol_def", "symbol_defs.1", "grammar",
491 "rules_or_grammar_declaration", "rules", "@3", "rhses.1", "rhs",
492 "symbol", "action", "string_as_id", "string_content", "epilogue.opt", 0
493};
494#endif
495
496# ifdef YYPRINT
497/* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
498 token YYLEX-NUM. */
499static const unsigned short yytoknum[] =
500{
501 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
502 265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
503 275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
504 285, 286, 287, 288, 289, 290, 291, 292, 293, 294,
505 295, 296, 297, 298, 299, 300, 301, 302, 303, 304
506};
507# endif
508
509/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
510static const unsigned char yyr1[] =
511{
512 0, 50, 51, 52, 52, 53, 53, 53, 53, 53,
513 53, 53, 53, 53, 53, 53, 53, 53, 53, 53,
514 53, 53, 53, 53, 53, 53, 53, 53, 54, 54,
515 54, 54, 54, 54, 54, 54, 56, 55, 57, 55,
516 55, 58, 59, 59, 59, 60, 60, 61, 61, 62,
517 62, 62, 62, 62, 63, 63, 64, 64, 65, 65,
518 65, 67, 66, 68, 68, 68, 69, 69, 69, 69,
519 69, 69, 70, 70, 71, 72, 73, 74, 74
520};
521
522/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
523static const unsigned char yyr2[] =
524{
525 0, 2, 4, 0, 2, 1, 1, 1, 3, 1,
526 1, 2, 3, 1, 1, 1, 1, 3, 1, 1,
527 3, 1, 1, 2, 1, 1, 1, 1, 1, 1,
528 2, 1, 2, 2, 1, 1, 0, 3, 0, 3,
529 3, 3, 1, 1, 1, 0, 1, 1, 2, 1,
530 1, 2, 2, 3, 1, 2, 1, 2, 1, 2,
531 2, 0, 3, 1, 3, 2, 0, 2, 2, 3,
532 3, 3, 1, 1, 1, 1, 1, 0, 2
533};
534
535/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
536 STATE-NUM when YYTABLE doesn't specify something else to do. Zero
537 means the default is an error. */
538static const unsigned char yydefact[] =
539{
540 3, 0, 0, 1, 38, 36, 0, 0, 0, 31,
541 42, 43, 44, 7, 34, 0, 9, 10, 0, 0,
542 13, 14, 15, 16, 0, 35, 18, 19, 0, 21,
543 22, 0, 0, 24, 25, 26, 27, 0, 6, 4,
544 5, 29, 28, 45, 0, 0, 0, 75, 72, 32,
545 47, 73, 33, 76, 0, 11, 0, 0, 0, 23,
546 30, 0, 61, 0, 0, 56, 58, 46, 0, 49,
547 50, 54, 39, 37, 40, 48, 8, 12, 17, 20,
548 60, 66, 59, 0, 57, 2, 41, 51, 52, 55,
549 62, 63, 78, 53, 65, 66, 0, 0, 0, 74,
550 67, 68, 64, 69, 70, 71
551};
552
553/* YYDEFGOTO[NTERM-NUM]. */
554static const yysigned_char yydefgoto[] =
555{
556 -1, 1, 2, 39, 63, 41, 45, 44, 42, 43,
557 68, 49, 71, 72, 64, 65, 66, 81, 90, 91,
558 50, 101, 51, 54, 85
559};
560
561/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
562 STATE-NUM. */
563#define YYPACT_NINF -67
564static const yysigned_char yypact[] =
565{
566 -67, 8, 109, -67, -67, -67, -30, 0, 0, -67,
567 -67, -67, -67, -67, -67, 13, -67, -67, 20, -16,
568 -67, -67, -67, -67, -15, -67, -67, -67, -5, -67,
569 -67, 13, 0, -67, -67, -67, -67, 68, -67, -67,
570 -67, -67, -67, -3, -35, -35, 0, -67, -67, 0,
571 -67, -67, 0, -67, 13, -67, 13, 13, 13, -67,
572 -67, -4, -67, 4, 22, -67, -67, -67, 0, -67,
573 3, -67, -35, -35, 0, -67, -67, -67, -67, -67,
574 -67, -67, -67, 1, -67, -67, 0, 38, -67, -67,
575 -31, -1, -67, -67, -67, -67, 0, 41, 7, -67,
576 -67, -67, -1, -67, -67, -67
577};
578
579/* YYPGOTO[NTERM-NUM]. */
580static const yysigned_char yypgoto[] =
581{
582 -67, -67, -67, -67, 48, -67, -67, -67, -67, -67,
583 -67, -7, -54, 10, -67, -12, -67, -67, -67, -42,
584 -32, -67, -66, 31, -67
585};
586
587/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
588 positive, shift that token. If negative, reduce the rule which
589 number is the opposite. If zero, do what YYDEFACT says.
590 If YYTABLE_NINF, syntax error. */
591#define YYTABLE_NINF -78
592static const yysigned_char yytable[] =
593{
594 60, 52, 47, 47, 88, 69, 47, 87, 3, 70,
595 46, 94, 95, 96, 97, 98, 53, 75, 89, 89,
596 75, 93, -77, 61, 55, 56, 57, 4, 5, 6,
597 7, 8, 9, 10, 11, 12, 58, 67, 80, 74,
598 14, 47, 75, 48, 48, 104, 82, 105, 99, 92,
599 40, 25, 84, 102, 75, 73, 0, 0, 32, 100,
600 0, 86, 59, 0, 103, 0, 0, 62, 83, 61,
601 100, 0, 0, 4, 5, 6, 7, 8, 9, 10,
602 11, 12, 0, 0, 0, 76, 14, 77, 78, 79,
603 0, 0, 0, 0, 0, 0, 0, 25, 0, 0,
604 0, 0, 0, 0, 32, 0, 0, 0, 0, 0,
605 0, 0, 0, 62, 4, 5, 6, 7, 8, 9,
606 10, 11, 12, 0, 0, 0, 13, 14, 15, 16,
607 17, 18, 19, 20, 21, 22, 23, 24, 25, 26,
608 27, 28, 29, 30, 31, 32, 33, 34, 35, 0,
609 0, 36, 0, 0, 0, 37, 38
610};
611
612static const yysigned_char yycheck[] =
613{
614 32, 8, 3, 3, 70, 40, 3, 4, 0, 44,
615 40, 42, 43, 14, 15, 16, 3, 49, 72, 73,
616 52, 87, 0, 1, 4, 41, 41, 5, 6, 7,
617 8, 9, 10, 11, 12, 13, 41, 40, 42, 46,
618 18, 3, 74, 44, 44, 4, 42, 40, 49, 48,
619 2, 29, 64, 95, 86, 45, -1, -1, 36, 91,
620 -1, 68, 31, -1, 96, -1, -1, 45, 46, 1,
621 102, -1, -1, 5, 6, 7, 8, 9, 10, 11,
622 12, 13, -1, -1, -1, 54, 18, 56, 57, 58,
623 -1, -1, -1, -1, -1, -1, -1, 29, -1, -1,
624 -1, -1, -1, -1, 36, -1, -1, -1, -1, -1,
625 -1, -1, -1, 45, 5, 6, 7, 8, 9, 10,
626 11, 12, 13, -1, -1, -1, 17, 18, 19, 20,
627 21, 22, 23, 24, 25, 26, 27, 28, 29, 30,
628 31, 32, 33, 34, 35, 36, 37, 38, 39, -1,
629 -1, 42, -1, -1, -1, 46, 47
630};
631
632/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
633 symbol of state STATE-NUM. */
634static const unsigned char yystos[] =
635{
636 0, 51, 52, 0, 5, 6, 7, 8, 9, 10,
637 11, 12, 13, 17, 18, 19, 20, 21, 22, 23,
638 24, 25, 26, 27, 28, 29, 30, 31, 32, 33,
639 34, 35, 36, 37, 38, 39, 42, 46, 47, 53,
640 54, 55, 58, 59, 57, 56, 40, 3, 44, 61,
641 70, 72, 61, 3, 73, 4, 41, 41, 41, 73,
642 70, 1, 45, 54, 64, 65, 66, 40, 60, 40,
643 44, 62, 63, 63, 61, 70, 73, 73, 73, 73,
644 42, 67, 42, 46, 65, 74, 61, 4, 72, 62,
645 68, 69, 48, 72, 42, 43, 14, 15, 16, 49,
646 70, 71, 69, 70, 4, 40
647};
648
649#if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__)
650# define YYSIZE_T __SIZE_TYPE__
651#endif
652#if ! defined (YYSIZE_T) && defined (size_t)
653# define YYSIZE_T size_t
654#endif
655#if ! defined (YYSIZE_T)
656# if defined (__STDC__) || defined (__cplusplus)
657# include <stddef.h> /* INFRINGES ON USER NAME SPACE */
658# define YYSIZE_T size_t
659# endif
660#endif
661#if ! defined (YYSIZE_T)
662# define YYSIZE_T unsigned int
663#endif
664
665#define yyerrok (yyerrstatus = 0)
666#define yyclearin (yychar = YYEMPTY)
667#define YYEMPTY (-2)
668#define YYEOF 0
669
670#define YYACCEPT goto yyacceptlab
671#define YYABORT goto yyabortlab
672#define YYERROR goto yyerrorlab
673
674
675/* Like YYERROR except do call yyerror. This remains here temporarily
676 to ease the transition to the new meaning of YYERROR, for GCC.
677 Once GCC version 2 has supplanted version 1, this can go. */
678
679#define YYFAIL goto yyerrlab
680
681#define YYRECOVERING() (!!yyerrstatus)
682
683#define YYBACKUP(Token, Value) \
684do \
685 if (yychar == YYEMPTY && yylen == 1) \
686 { \
687 yychar = (Token); \
688 yylval = (Value); \
689 yytoken = YYTRANSLATE (yychar); \
690 YYPOPSTACK; \
691 goto yybackup; \
692 } \
693 else \
694 { \
695 yyerror ("syntax error: cannot back up");\
696 YYERROR; \
697 } \
698while (0)
699
700#define YYTERROR 1
701#define YYERRCODE 256
702
703/* YYLLOC_DEFAULT -- Compute the default location (before the actions
704 are run). */
705
706#ifndef YYLLOC_DEFAULT
707# define YYLLOC_DEFAULT(Current, Rhs, N) \
708 ((Current).first_line = (Rhs)[1].first_line, \
709 (Current).first_column = (Rhs)[1].first_column, \
710 (Current).last_line = (Rhs)[N].last_line, \
711 (Current).last_column = (Rhs)[N].last_column)
712#endif
713
714/* YYLEX -- calling `yylex' with the right arguments. */
715
716#ifdef YYLEX_PARAM
717# define YYLEX yylex (&yylval, &yylloc, YYLEX_PARAM)
718#else
719# define YYLEX yylex (&yylval, &yylloc)
720#endif
721
722/* Enable debugging if requested. */
723#if YYDEBUG
724
725# ifndef YYFPRINTF
726# include <stdio.h> /* INFRINGES ON USER NAME SPACE */
727# define YYFPRINTF fprintf
728# endif
729
730# define YYDPRINTF(Args) \
731do { \
732 if (yydebug) \
733 YYFPRINTF Args; \
734} while (0)
735
736# define YYDSYMPRINT(Args) \
737do { \
738 if (yydebug) \
739 yysymprint Args; \
740} while (0)
741
742# define YYDSYMPRINTF(Title, Token, Value, Location) \
743do { \
744 if (yydebug) \
745 { \
746 YYFPRINTF (stderr, "%s ", Title); \
747 yysymprint (stderr, \
748 Token, Value, Location); \
749 YYFPRINTF (stderr, "\n"); \
750 } \
751} while (0)
752
753/*------------------------------------------------------------------.
754| yy_stack_print -- Print the state stack from its BOTTOM up to its |
755| TOP (included). |
756`------------------------------------------------------------------*/
757
758#if defined (__STDC__) || defined (__cplusplus)
759static void
760yy_stack_print (short *bottom, short *top)
761#else
762static void
763yy_stack_print (bottom, top)
764 short *bottom;
765 short *top;
766#endif
767{
768 YYFPRINTF (stderr, "Stack now");
769 for (/* Nothing. */; bottom <= top; ++bottom)
770 YYFPRINTF (stderr, " %d", *bottom);
771 YYFPRINTF (stderr, "\n");
772}
773
774# define YY_STACK_PRINT(Bottom, Top) \
775do { \
776 if (yydebug) \
777 yy_stack_print ((Bottom), (Top)); \
778} while (0)
779
780
781/*------------------------------------------------.
782| Report that the YYRULE is going to be reduced. |
783`------------------------------------------------*/
784
785#if defined (__STDC__) || defined (__cplusplus)
786static void
787yy_reduce_print (int yyrule)
788#else
789static void
790yy_reduce_print (yyrule)
791 int yyrule;
792#endif
793{
794 int yyi;
795 unsigned int yylno = yyrline[yyrule];
796 YYFPRINTF (stderr, "Reducing stack by rule %d (line %u), ",
797 yyrule - 1, yylno);
798 /* Print the symbols being reduced, and their result. */
799 for (yyi = yyprhs[yyrule]; 0 <= yyrhs[yyi]; yyi++)
800 YYFPRINTF (stderr, "%s ", yytname [yyrhs[yyi]]);
801 YYFPRINTF (stderr, "-> %s\n", yytname [yyr1[yyrule]]);
802}
803
804# define YY_REDUCE_PRINT(Rule) \
805do { \
806 if (yydebug) \
807 yy_reduce_print (Rule); \
808} while (0)
809
810/* Nonzero means print parse trace. It is left uninitialized so that
811 multiple parsers can coexist. */
812int yydebug;
813#else /* !YYDEBUG */
814# define YYDPRINTF(Args)
815# define YYDSYMPRINT(Args)
816# define YYDSYMPRINTF(Title, Token, Value, Location)
817# define YY_STACK_PRINT(Bottom, Top)
818# define YY_REDUCE_PRINT(Rule)
819#endif /* !YYDEBUG */
820
821
822/* YYINITDEPTH -- initial size of the parser's stacks. */
823#ifndef YYINITDEPTH
824# define YYINITDEPTH 200
825#endif
826
827/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
828 if the built-in stack extension method is used).
829
830 Do not make this value too large; the results are undefined if
831 SIZE_MAX < YYSTACK_BYTES (YYMAXDEPTH)
832 evaluated with infinite-precision integer arithmetic. */
833
834#if defined (YYMAXDEPTH) && YYMAXDEPTH == 0
835# undef YYMAXDEPTH
836#endif
837
838#ifndef YYMAXDEPTH
839# define YYMAXDEPTH 10000
840#endif
841
842\f
843
844#if YYERROR_VERBOSE
845
846# ifndef yystrlen
847# if defined (__GLIBC__) && defined (_STRING_H)
848# define yystrlen strlen
849# else
850/* Return the length of YYSTR. */
851static YYSIZE_T
852# if defined (__STDC__) || defined (__cplusplus)
853yystrlen (const char *yystr)
854# else
855yystrlen (yystr)
856 const char *yystr;
857# endif
858{
859 register const char *yys = yystr;
860
861 while (*yys++ != '\0')
862 continue;
863
864 return yys - yystr - 1;
865}
866# endif
867# endif
868
869# ifndef yystpcpy
870# if defined (__GLIBC__) && defined (_STRING_H) && defined (_GNU_SOURCE)
871# define yystpcpy stpcpy
872# else
873/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
874 YYDEST. */
875static char *
876# if defined (__STDC__) || defined (__cplusplus)
877yystpcpy (char *yydest, const char *yysrc)
878# else
879yystpcpy (yydest, yysrc)
880 char *yydest;
881 const char *yysrc;
882# endif
883{
884 register char *yyd = yydest;
885 register const char *yys = yysrc;
886
887 while ((*yyd++ = *yys++) != '\0')
888 continue;
889
890 return yyd - 1;
891}
892# endif
893# endif
894
895#endif /* !YYERROR_VERBOSE */
896
897\f
898
899#if YYDEBUG
900/*--------------------------------.
901| Print this symbol on YYOUTPUT. |
902`--------------------------------*/
903
904#if defined (__STDC__) || defined (__cplusplus)
905static void
906yysymprint (FILE *yyoutput, int yytype, YYSTYPE *yyvaluep, YYLTYPE *yylocationp)
907#else
908static void
909yysymprint (yyoutput, yytype, yyvaluep, yylocationp)
910 FILE *yyoutput;
911 int yytype;
912 YYSTYPE *yyvaluep;
913 YYLTYPE *yylocationp;
914#endif
915{
916 /* Pacify ``unused variable'' warnings. */
917 (void) yyvaluep;
918 (void) yylocationp;
919
920 if (yytype < YYNTOKENS)
921 {
922 YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
923# ifdef YYPRINT
924 YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
925# endif
926 }
927 else
928 YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
929
930 switch (yytype)
931 {
932 default:
933 break;
934 }
935 YYFPRINTF (yyoutput, ")");
936}
937
938#endif /* ! YYDEBUG */
939/*-----------------------------------------------.
940| Release the memory associated to this symbol. |
941`-----------------------------------------------*/
942
943#if defined (__STDC__) || defined (__cplusplus)
944static void
945yydestruct (int yytype, YYSTYPE *yyvaluep, YYLTYPE *yylocationp)
946#else
947static void
948yydestruct (yytype, yyvaluep, yylocationp)
949 int yytype;
950 YYSTYPE *yyvaluep;
951 YYLTYPE *yylocationp;
952#endif
953{
954 /* Pacify ``unused variable'' warnings. */
955 (void) yyvaluep;
956 (void) yylocationp;
957
958 switch (yytype)
959 {
960
961 default:
962 break;
963 }
964}
965\f
966
967/* Prevent warnings from -Wmissing-prototypes. */
968
969#ifdef YYPARSE_PARAM
970# if defined (__STDC__) || defined (__cplusplus)
971int yyparse (void *YYPARSE_PARAM);
972# else
973int yyparse ();
974# endif
975#else /* ! YYPARSE_PARAM */
976#if defined (__STDC__) || defined (__cplusplus)
977int yyparse (void);
978#else
979int yyparse ();
980#endif
981#endif /* ! YYPARSE_PARAM */
982
983
984
985
986
987
988/*----------.
989| yyparse. |
990`----------*/
991
992#ifdef YYPARSE_PARAM
993# if defined (__STDC__) || defined (__cplusplus)
994int yyparse (void *YYPARSE_PARAM)
995# else
996int yyparse (YYPARSE_PARAM)
997 void *YYPARSE_PARAM;
998# endif
999#else /* ! YYPARSE_PARAM */
1000#if defined (__STDC__) || defined (__cplusplus)
1001int
1002yyparse (void)
1003#else
1004int
1005yyparse ()
1006
1007#endif
1008#endif
1009{
1010 /* The lookahead symbol. */
1011int yychar;
1012
1013/* The semantic value of the lookahead symbol. */
1014YYSTYPE yylval;
1015
1016/* Number of syntax errors so far. */
1017int yynerrs;
1018/* Location data for the lookahead symbol. */
1019YYLTYPE yylloc;
1020
1021 register int yystate;
1022 register int yyn;
1023 int yyresult;
1024 /* Number of tokens to shift before error messages enabled. */
1025 int yyerrstatus;
1026 /* Lookahead token as an internal (translated) token number. */
1027 int yytoken = 0;
1028
1029 /* Three stacks and their tools:
1030 `yyss': related to states,
1031 `yyvs': related to semantic values,
1032 `yyls': related to locations.
1033
1034 Refer to the stacks thru separate pointers, to allow yyoverflow
1035 to reallocate them elsewhere. */
1036
1037 /* The state stack. */
1038 short yyssa[YYINITDEPTH];
1039 short *yyss = yyssa;
1040 register short *yyssp;
1041
1042 /* The semantic value stack. */
1043 YYSTYPE yyvsa[YYINITDEPTH];
1044 YYSTYPE *yyvs = yyvsa;
1045 register YYSTYPE *yyvsp;
1046
1047 /* The location stack. */
1048 YYLTYPE yylsa[YYINITDEPTH];
1049 YYLTYPE *yyls = yylsa;
1050 YYLTYPE *yylsp;
1051 YYLTYPE *yylerrsp;
1052
1053#define YYPOPSTACK (yyvsp--, yyssp--, yylsp--)
1054
1055 YYSIZE_T yystacksize = YYINITDEPTH;
1056
1057 /* The variables used to return semantic value and location from the
1058 action routines. */
1059 YYSTYPE yyval;
1060 YYLTYPE yyloc;
1061
1062 /* When reducing, the number of symbols on the RHS of the reduced
1063 rule. */
1064 int yylen;
1065
1066 YYDPRINTF ((stderr, "Starting parse\n"));
1067
1068 yystate = 0;
1069 yyerrstatus = 0;
1070 yynerrs = 0;
1071 yychar = YYEMPTY; /* Cause a token to be read. */
1072
1073 /* Initialize stack pointers.
1074 Waste one element of value and location stack
1075 so that they stay on the same level as the state stack.
1076 The wasted elements are never initialized. */
1077
1078 yyssp = yyss;
1079 yyvsp = yyvs;
1080 yylsp = yyls;
1081
1082 /* User initialization code. */
1083 #line 70 "parse-gram.y"
1084{
1085 /* Bison's grammar can initial empty locations, hence a default
1086 location is needed. */
1087 (*yylsp).start.file = (*yylsp).end.file = current_file;
1088 (*yylsp).start.line = (*yylsp).end.line = 1;
1089 (*yylsp).start.column = (*yylsp).end.column = 0;
1090}
1091/* Line 818 of yacc.c. */
1092#line 1093 "parse-gram.c"
1093 goto yysetstate;
1094
1095/*------------------------------------------------------------.
1096| yynewstate -- Push a new state, which is found in yystate. |
1097`------------------------------------------------------------*/
1098 yynewstate:
1099 /* In all cases, when you get here, the value and location stacks
1100 have just been pushed. so pushing a state here evens the stacks.
1101 */
1102 yyssp++;
1103
1104 yysetstate:
1105 *yyssp = yystate;
1106
1107 if (yyss + yystacksize - 1 <= yyssp)
1108 {
1109 /* Get the current used size of the three stacks, in elements. */
1110 YYSIZE_T yysize = yyssp - yyss + 1;
1111
1112#ifdef yyoverflow
1113 {
1114 /* Give user a chance to reallocate the stack. Use copies of
1115 these so that the &'s don't force the real ones into
1116 memory. */
1117 YYSTYPE *yyvs1 = yyvs;
1118 short *yyss1 = yyss;
1119 YYLTYPE *yyls1 = yyls;
1120
1121 /* Each stack pointer address is followed by the size of the
1122 data in use in that stack, in bytes. This used to be a
1123 conditional around just the two extra args, but that might
1124 be undefined if yyoverflow is a macro. */
1125 yyoverflow ("parser stack overflow",
1126 &yyss1, yysize * sizeof (*yyssp),
1127 &yyvs1, yysize * sizeof (*yyvsp),
1128 &yyls1, yysize * sizeof (*yylsp),
1129 &yystacksize);
1130 yyls = yyls1;
1131 yyss = yyss1;
1132 yyvs = yyvs1;
1133 }
1134#else /* no yyoverflow */
1135# ifndef YYSTACK_RELOCATE
1136 goto yyoverflowlab;
1137# else
1138 /* Extend the stack our own way. */
1139 if (YYMAXDEPTH <= yystacksize)
1140 goto yyoverflowlab;
1141 yystacksize *= 2;
1142 if (YYMAXDEPTH < yystacksize)
1143 yystacksize = YYMAXDEPTH;
1144
1145 {
1146 short *yyss1 = yyss;
1147 union yyalloc *yyptr =
1148 (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
1149 if (! yyptr)
1150 goto yyoverflowlab;
1151 YYSTACK_RELOCATE (yyss);
1152 YYSTACK_RELOCATE (yyvs);
1153 YYSTACK_RELOCATE (yyls);
1154# undef YYSTACK_RELOCATE
1155 if (yyss1 != yyssa)
1156 YYSTACK_FREE (yyss1);
1157 }
1158# endif
1159#endif /* no yyoverflow */
1160
1161 yyssp = yyss + yysize - 1;
1162 yyvsp = yyvs + yysize - 1;
1163 yylsp = yyls + yysize - 1;
1164
1165 YYDPRINTF ((stderr, "Stack size increased to %lu\n",
1166 (unsigned long int) yystacksize));
1167
1168 if (yyss + yystacksize - 1 <= yyssp)
1169 YYABORT;
1170 }
1171
1172 YYDPRINTF ((stderr, "Entering state %d\n", yystate));
1173
1174 goto yybackup;
1175
1176/*-----------.
1177| yybackup. |
1178`-----------*/
1179yybackup:
1180
1181/* Do appropriate processing given the current state. */
1182/* Read a lookahead token if we need one and don't already have one. */
1183/* yyresume: */
1184
1185 /* First try to decide what to do without reference to lookahead token. */
1186
1187 yyn = yypact[yystate];
1188 if (yyn == YYPACT_NINF)
1189 goto yydefault;
1190
1191 /* Not known => get a lookahead token if don't already have one. */
1192
1193 /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */
1194 if (yychar == YYEMPTY)
1195 {
1196 YYDPRINTF ((stderr, "Reading a token: "));
1197 yychar = YYLEX;
1198 }
1199
1200 if (yychar <= YYEOF)
1201 {
1202 yychar = yytoken = YYEOF;
1203 YYDPRINTF ((stderr, "Now at end of input.\n"));
1204 }
1205 else
1206 {
1207 yytoken = YYTRANSLATE (yychar);
1208 YYDSYMPRINTF ("Next token is", yytoken, &yylval, &yylloc);
1209 }
1210
1211 /* If the proper action on seeing token YYTOKEN is to reduce or to
1212 detect an error, take that action. */
1213 yyn += yytoken;
1214 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
1215 goto yydefault;
1216 yyn = yytable[yyn];
1217 if (yyn <= 0)
1218 {
1219 if (yyn == 0 || yyn == YYTABLE_NINF)
1220 goto yyerrlab;
1221 yyn = -yyn;
1222 goto yyreduce;
1223 }
1224
1225 if (yyn == YYFINAL)
1226 YYACCEPT;
1227
1228 /* Shift the lookahead token. */
1229 YYDPRINTF ((stderr, "Shifting token %s, ", yytname[yytoken]));
1230
1231 /* Discard the token being shifted unless it is eof. */
1232 if (yychar != YYEOF)
1233 yychar = YYEMPTY;
1234
1235 *++yyvsp = yylval;
1236 *++yylsp = yylloc;
1237
1238 /* Count tokens shifted since error; after three, turn off error
1239 status. */
1240 if (yyerrstatus)
1241 yyerrstatus--;
1242
1243 yystate = yyn;
1244 goto yynewstate;
1245
1246
1247/*-----------------------------------------------------------.
1248| yydefault -- do the default action for the current state. |
1249`-----------------------------------------------------------*/
1250yydefault:
1251 yyn = yydefact[yystate];
1252 if (yyn == 0)
1253 goto yyerrlab;
1254 goto yyreduce;
1255
1256
1257/*-----------------------------.
1258| yyreduce -- Do a reduction. |
1259`-----------------------------*/
1260yyreduce:
1261 /* yyn is the number of a rule to reduce with. */
1262 yylen = yyr2[yyn];
1263
1264 /* If YYLEN is nonzero, implement the default value of the action:
1265 `$$ = $1'.
1266
1267 Otherwise, the following line sets YYVAL to garbage.
1268 This behavior is undocumented and Bison
1269 users should not rely upon it. Assigning to YYVAL
1270 unconditionally makes the parser a bit smaller, and it avoids a
1271 GCC warning that YYVAL may be used uninitialized. */
1272 yyval = yyvsp[1-yylen];
1273
1274 /* Default location. */
1275 YYLLOC_DEFAULT (yyloc, yylsp - yylen, yylen);
1276 YY_REDUCE_PRINT (yyn);
1277 switch (yyn)
1278 {
1279 case 6:
1280#line 187 "parse-gram.y"
1281 { prologue_augment (yyvsp[0].chars, yylsp[0]); }
1282 break;
1283
1284 case 7:
1285#line 188 "parse-gram.y"
1286 { debug_flag = true; }
1287 break;
1288
1289 case 8:
1290#line 189 "parse-gram.y"
1291 { muscle_insert (yyvsp[-1].chars, yyvsp[0].chars); }
1292 break;
1293
1294 case 9:
1295#line 190 "parse-gram.y"
1296 { defines_flag = true; }
1297 break;
1298
1299 case 10:
1300#line 191 "parse-gram.y"
1301 { error_verbose = true; }
1302 break;
1303
1304 case 11:
1305#line 192 "parse-gram.y"
1306 { expected_conflicts = yyvsp[0].integer; }
1307 break;
1308
1309 case 12:
1310#line 193 "parse-gram.y"
1311 { spec_file_prefix = yyvsp[0].chars; }
1312 break;
1313
1314 case 13:
1315#line 195 "parse-gram.y"
1316 {
1317 nondeterministic_parser = true;
1318 glr_parser = true;
1319 }
1320 break;
1321
1322 case 14:
1323#line 200 "parse-gram.y"
1324 {
1325 muscle_code_grow ("initial_action", yyvsp[0].chars, yylsp[0]);
1326 }
1327 break;
1328
1329 case 15:
1330#line 203 "parse-gram.y"
1331 { add_param ("lex_param", yyvsp[0].chars, yylsp[0]); }
1332 break;
1333
1334 case 16:
1335#line 204 "parse-gram.y"
1336 { locations_flag = true; }
1337 break;
1338
1339 case 17:
1340#line 205 "parse-gram.y"
1341 { spec_name_prefix = yyvsp[0].chars; }
1342 break;
1343
1344 case 18:
1345#line 206 "parse-gram.y"
1346 { no_lines_flag = true; }
1347 break;
1348
1349 case 19:
1350#line 207 "parse-gram.y"
1351 { nondeterministic_parser = true; }
1352 break;
1353
1354 case 20:
1355#line 208 "parse-gram.y"
1356 { spec_outfile = yyvsp[0].chars; }
1357 break;
1358
1359 case 21:
1360#line 209 "parse-gram.y"
1361 { add_param ("parse_param", yyvsp[0].chars, yylsp[0]); }
1362 break;
1363
1364 case 22:
1365#line 210 "parse-gram.y"
1366 { pure_parser = true; }
1367 break;
1368
1369 case 23:
1370#line 211 "parse-gram.y"
1371 { skeleton = yyvsp[0].chars; }
1372 break;
1373
1374 case 24:
1375#line 212 "parse-gram.y"
1376 { token_table_flag = true; }
1377 break;
1378
1379 case 25:
1380#line 213 "parse-gram.y"
1381 { report_flag = report_states; }
1382 break;
1383
1384 case 26:
1385#line 214 "parse-gram.y"
1386 { yacc_flag = true; }
1387 break;
1388
1389 case 30:
1390#line 222 "parse-gram.y"
1391 {
1392 grammar_start_symbol_set (yyvsp[0].symbol, yylsp[0]);
1393 }
1394 break;
1395
1396 case 31:
1397#line 226 "parse-gram.y"
1398 {
1399 typed = true;
1400 MUSCLE_INSERT_INT ("stype_line", yylsp[0].start.line);
1401 muscle_insert ("stype", yyvsp[0].chars);
1402 }
1403 break;
1404
1405 case 32:
1406#line 232 "parse-gram.y"
1407 {
1408 symbol_list *list;
1409 for (list = yyvsp[0].list; list; list = list->next)
1410 symbol_destructor_set (list->sym, yyvsp[-1].chars, yylsp[-1]);
1411 symbol_list_free (yyvsp[0].list);
1412 }
1413 break;
1414
1415 case 33:
1416#line 239 "parse-gram.y"
1417 {
1418 symbol_list *list;
1419 for (list = yyvsp[0].list; list; list = list->next)
1420 symbol_printer_set (list->sym, yyvsp[-1].chars, list->location);
1421 symbol_list_free (yyvsp[0].list);
1422 }
1423 break;
1424
1425 case 34:
1426#line 246 "parse-gram.y"
1427 {
1428 default_prec = true;
1429 }
1430 break;
1431
1432 case 35:
1433#line 250 "parse-gram.y"
1434 {
1435 default_prec = false;
1436 }
1437 break;
1438
1439 case 36:
1440#line 256 "parse-gram.y"
1441 { current_class = nterm_sym; }
1442 break;
1443
1444 case 37:
1445#line 257 "parse-gram.y"
1446 {
1447 current_class = unknown_sym;
1448 current_type = NULL;
1449 }
1450 break;
1451
1452 case 38:
1453#line 261 "parse-gram.y"
1454 { current_class = token_sym; }
1455 break;
1456
1457 case 39:
1458#line 262 "parse-gram.y"
1459 {
1460 current_class = unknown_sym;
1461 current_type = NULL;
1462 }
1463 break;
1464
1465 case 40:
1466#line 267 "parse-gram.y"
1467 {
1468 symbol_list *list;
1469 for (list = yyvsp[0].list; list; list = list->next)
1470 symbol_type_set (list->sym, yyvsp[-1].uniqstr, yylsp[-1]);
1471 symbol_list_free (yyvsp[0].list);
1472 }
1473 break;
1474
1475 case 41:
1476#line 277 "parse-gram.y"
1477 {
1478 symbol_list *list;
1479 ++current_prec;
1480 for (list = yyvsp[0].list; list; list = list->next)
1481 {
1482 symbol_type_set (list->sym, current_type, yylsp[-1]);
1483 symbol_precedence_set (list->sym, current_prec, yyvsp[-2].assoc, yylsp[-2]);
1484 }
1485 symbol_list_free (yyvsp[0].list);
1486 current_type = NULL;
1487 }
1488 break;
1489
1490 case 42:
1491#line 291 "parse-gram.y"
1492 { yyval.assoc = left_assoc; }
1493 break;
1494
1495 case 43:
1496#line 292 "parse-gram.y"
1497 { yyval.assoc = right_assoc; }
1498 break;
1499
1500 case 44:
1501#line 293 "parse-gram.y"
1502 { yyval.assoc = non_assoc; }
1503 break;
1504
1505 case 45:
1506#line 297 "parse-gram.y"
1507 { current_type = NULL; }
1508 break;
1509
1510 case 46:
1511#line 298 "parse-gram.y"
1512 { current_type = yyvsp[0].uniqstr; }
1513 break;
1514
1515 case 47:
1516#line 304 "parse-gram.y"
1517 { yyval.list = symbol_list_new (yyvsp[0].symbol, yylsp[0]); }
1518 break;
1519
1520 case 48:
1521#line 305 "parse-gram.y"
1522 { yyval.list = symbol_list_prepend (yyvsp[-1].list, yyvsp[0].symbol, yylsp[0]); }
1523 break;
1524
1525 case 49:
1526#line 311 "parse-gram.y"
1527 {
1528 current_type = yyvsp[0].uniqstr;
1529 }
1530 break;
1531
1532 case 50:
1533#line 315 "parse-gram.y"
1534 {
1535 symbol_class_set (yyvsp[0].symbol, current_class, yylsp[0]);
1536 symbol_type_set (yyvsp[0].symbol, current_type, yylsp[0]);
1537 }
1538 break;
1539
1540 case 51:
1541#line 320 "parse-gram.y"
1542 {
1543 symbol_class_set (yyvsp[-1].symbol, current_class, yylsp[-1]);
1544 symbol_type_set (yyvsp[-1].symbol, current_type, yylsp[-1]);
1545 symbol_user_token_number_set (yyvsp[-1].symbol, yyvsp[0].integer, yylsp[0]);
1546 }
1547 break;
1548
1549 case 52:
1550#line 326 "parse-gram.y"
1551 {
1552 symbol_class_set (yyvsp[-1].symbol, current_class, yylsp[-1]);
1553 symbol_type_set (yyvsp[-1].symbol, current_type, yylsp[-1]);
1554 symbol_make_alias (yyvsp[-1].symbol, yyvsp[0].symbol, yyloc);
1555 }
1556 break;
1557
1558 case 53:
1559#line 332 "parse-gram.y"
1560 {
1561 symbol_class_set (yyvsp[-2].symbol, current_class, yylsp[-2]);
1562 symbol_type_set (yyvsp[-2].symbol, current_type, yylsp[-2]);
1563 symbol_user_token_number_set (yyvsp[-2].symbol, yyvsp[-1].integer, yylsp[-1]);
1564 symbol_make_alias (yyvsp[-2].symbol, yyvsp[0].symbol, yyloc);
1565 }
1566 break;
1567
1568 case 59:
1569#line 361 "parse-gram.y"
1570 {
1571 if (yacc_flag)
1572 complain_at (yyloc, _("POSIX forbids declarations in the grammar"));
1573 }
1574 break;
1575
1576 case 60:
1577#line 366 "parse-gram.y"
1578 {
1579 yyerrok;
1580 }
1581 break;
1582
1583 case 61:
1584#line 372 "parse-gram.y"
1585 { current_lhs = yyvsp[0].symbol; current_lhs_location = yylsp[0]; }
1586 break;
1587
1588 case 63:
1589#line 376 "parse-gram.y"
1590 { grammar_rule_end (yylsp[0]); }
1591 break;
1592
1593 case 64:
1594#line 377 "parse-gram.y"
1595 { grammar_rule_end (yylsp[0]); }
1596 break;
1597
1598 case 66:
1599#line 383 "parse-gram.y"
1600 { grammar_rule_begin (current_lhs, current_lhs_location); }
1601 break;
1602
1603 case 67:
1604#line 385 "parse-gram.y"
1605 { grammar_current_rule_symbol_append (yyvsp[0].symbol, yylsp[0]); }
1606 break;
1607
1608 case 68:
1609#line 387 "parse-gram.y"
1610 { grammar_current_rule_action_append (yyvsp[0].chars, yylsp[0]); }
1611 break;
1612
1613 case 69:
1614#line 389 "parse-gram.y"
1615 { grammar_current_rule_prec_set (yyvsp[0].symbol, yylsp[0]); }
1616 break;
1617
1618 case 70:
1619#line 391 "parse-gram.y"
1620 { grammar_current_rule_dprec_set (yyvsp[0].integer, yylsp[0]); }
1621 break;
1622
1623 case 71:
1624#line 393 "parse-gram.y"
1625 { grammar_current_rule_merge_set (yyvsp[0].uniqstr, yylsp[0]); }
1626 break;
1627
1628 case 72:
1629#line 397 "parse-gram.y"
1630 { yyval.symbol = yyvsp[0].symbol; }
1631 break;
1632
1633 case 73:
1634#line 398 "parse-gram.y"
1635 { yyval.symbol = yyvsp[0].symbol; }
1636 break;
1637
1638 case 74:
1639#line 403 "parse-gram.y"
1640 { yyval.chars = yyvsp[0].chars; }
1641 break;
1642
1643 case 75:
1644#line 409 "parse-gram.y"
1645 {
1646 yyval.symbol = symbol_get (yyvsp[0].chars, yylsp[0]);
1647 symbol_class_set (yyval.symbol, token_sym, yylsp[0]);
1648 }
1649 break;
1650
1651 case 76:
1652#line 418 "parse-gram.y"
1653 {
1654 yyval.chars = yyvsp[0].chars + 1;
1655 yyval.chars[strlen (yyval.chars) - 1] = '\0';
1656 }
1657 break;
1658
1659 case 78:
1660#line 427 "parse-gram.y"
1661 {
1662 muscle_code_grow ("epilogue", yyvsp[0].chars, yylsp[0]);
1663 scanner_last_string_free ();
1664 }
1665 break;
1666
1667
1668 }
1669
1670/* Line 1010 of yacc.c. */
1671#line 1672 "parse-gram.c"
1672\f
1673 yyvsp -= yylen;
1674 yyssp -= yylen;
1675 yylsp -= yylen;
1676
1677 YY_STACK_PRINT (yyss, yyssp);
1678
1679 *++yyvsp = yyval;
1680 *++yylsp = yyloc;
1681
1682 /* Now `shift' the result of the reduction. Determine what state
1683 that goes to, based on the state we popped back to and the rule
1684 number reduced by. */
1685
1686 yyn = yyr1[yyn];
1687
1688 yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
1689 if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
1690 yystate = yytable[yystate];
1691 else
1692 yystate = yydefgoto[yyn - YYNTOKENS];
1693
1694 goto yynewstate;
1695
1696
1697/*------------------------------------.
1698| yyerrlab -- here on detecting error |
1699`------------------------------------*/
1700yyerrlab:
1701 /* If not already recovering from an error, report this error. */
1702 if (!yyerrstatus)
1703 {
1704 ++yynerrs;
1705#if YYERROR_VERBOSE
1706 yyn = yypact[yystate];
1707
1708 if (YYPACT_NINF < yyn && yyn < YYLAST)
1709 {
1710 YYSIZE_T yysize = 0;
1711 int yytype = YYTRANSLATE (yychar);
1712 const char* yyprefix;
1713 char *yymsg;
1714 int yyx;
1715
1716 /* Start YYX at -YYN if negative to avoid negative indexes in
1717 YYCHECK. */
1718 int yyxbegin = yyn < 0 ? -yyn : 0;
1719
1720 /* Stay within bounds of both yycheck and yytname. */
1721 int yychecklim = YYLAST - yyn;
1722 int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
1723 int yycount = 0;
1724
1725 yyprefix = ", expecting ";
1726 for (yyx = yyxbegin; yyx < yyxend; ++yyx)
1727 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
1728 {
1729 yysize += yystrlen (yyprefix) + yystrlen (yytname [yyx]);
1730 yycount += 1;
1731 if (yycount == 5)
1732 {
1733 yysize = 0;
1734 break;
1735 }
1736 }
1737 yysize += (sizeof ("syntax error, unexpected ")
1738 + yystrlen (yytname[yytype]));
1739 yymsg = (char *) YYSTACK_ALLOC (yysize);
1740 if (yymsg != 0)
1741 {
1742 char *yyp = yystpcpy (yymsg, "syntax error, unexpected ");
1743 yyp = yystpcpy (yyp, yytname[yytype]);
1744
1745 if (yycount < 5)
1746 {
1747 yyprefix = ", expecting ";
1748 for (yyx = yyxbegin; yyx < yyxend; ++yyx)
1749 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
1750 {
1751 yyp = yystpcpy (yyp, yyprefix);
1752 yyp = yystpcpy (yyp, yytname[yyx]);
1753 yyprefix = " or ";
1754 }
1755 }
1756 yyerror (yymsg);
1757 YYSTACK_FREE (yymsg);
1758 }
1759 else
1760 yyerror ("syntax error; also virtual memory exhausted");
1761 }
1762 else
1763#endif /* YYERROR_VERBOSE */
1764 yyerror ("syntax error");
1765 }
1766
1767 yylerrsp = yylsp;
1768
1769 if (yyerrstatus == 3)
1770 {
1771 /* If just tried and failed to reuse lookahead token after an
1772 error, discard it. */
1773
1774 if (yychar <= YYEOF)
1775 {
1776 /* If at end of input, pop the error token,
1777 then the rest of the stack, then return failure. */
1778 if (yychar == YYEOF)
1779 for (;;)
1780 {
1781 YYPOPSTACK;
1782 if (yyssp == yyss)
1783 YYABORT;
1784 YYDSYMPRINTF ("Error: popping", yystos[*yyssp], yyvsp, yylsp);
1785 yydestruct (yystos[*yyssp], yyvsp, yylsp);
1786 }
1787 }
1788 else
1789 {
1790 YYDSYMPRINTF ("Error: discarding", yytoken, &yylval, &yylloc);
1791 yydestruct (yytoken, &yylval, &yylloc);
1792 yychar = YYEMPTY;
1793 *++yylerrsp = yylloc;
1794 }
1795 }
1796
1797 /* Else will try to reuse lookahead token after shifting the error
1798 token. */
1799 goto yyerrlab1;
1800
1801
1802/*---------------------------------------------------.
1803| yyerrorlab -- error raised explicitly by YYERROR. |
1804`---------------------------------------------------*/
1805yyerrorlab:
1806
1807#ifdef __GNUC__
1808 /* Pacify GCC when the user code never invokes YYERROR and the label
1809 yyerrorlab therefore never appears in user code. */
1810 if (0)
1811 goto yyerrorlab;
1812#endif
1813
1814 yyvsp -= yylen;
1815 yyssp -= yylen;
1816 yystate = *yyssp;
1817 yylerrsp = yylsp;
1818 *++yylerrsp = yyloc;
1819 yylsp -= yylen;
1820 goto yyerrlab1;
1821
1822
1823/*-------------------------------------------------------------.
1824| yyerrlab1 -- common code for both syntax error and YYERROR. |
1825`-------------------------------------------------------------*/
1826yyerrlab1:
1827 yyerrstatus = 3; /* Each real token shifted decrements this. */
1828
1829 for (;;)
1830 {
1831 yyn = yypact[yystate];
1832 if (yyn != YYPACT_NINF)
1833 {
1834 yyn += YYTERROR;
1835 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
1836 {
1837 yyn = yytable[yyn];
1838 if (0 < yyn)
1839 break;
1840 }
1841 }
1842
1843 /* Pop the current state because it cannot handle the error token. */
1844 if (yyssp == yyss)
1845 YYABORT;
1846
1847 YYDSYMPRINTF ("Error: popping", yystos[*yyssp], yyvsp, yylsp);
1848 yydestruct (yystos[yystate], yyvsp, yylsp);
1849 YYPOPSTACK;
1850 yystate = *yyssp;
1851 YY_STACK_PRINT (yyss, yyssp);
1852 }
1853
1854 if (yyn == YYFINAL)
1855 YYACCEPT;
1856
1857 YYDPRINTF ((stderr, "Shifting error token, "));
1858
1859 *++yyvsp = yylval;
1860 YYLLOC_DEFAULT (yyloc, yylsp, yylerrsp - yylsp);
1861 *++yylsp = yyloc;
1862
1863 yystate = yyn;
1864 goto yynewstate;
1865
1866
1867/*-------------------------------------.
1868| yyacceptlab -- YYACCEPT comes here. |
1869`-------------------------------------*/
1870yyacceptlab:
1871 yyresult = 0;
1872 goto yyreturn;
1873
1874/*-----------------------------------.
1875| yyabortlab -- YYABORT comes here. |
1876`-----------------------------------*/
1877yyabortlab:
1878 yyresult = 1;
1879 goto yyreturn;
1880
1881#ifndef yyoverflow
1882/*----------------------------------------------.
1883| yyoverflowlab -- parser overflow comes here. |
1884`----------------------------------------------*/
1885yyoverflowlab:
1886 yyerror ("parser stack overflow");
1887 yyresult = 2;
1888 /* Fall through. */
1889#endif
1890
1891yyreturn:
1892#ifndef yyoverflow
1893 if (yyss != yyssa)
1894 YYSTACK_FREE (yyss);
1895#endif
1896 return yyresult;
1897}
1898
1899
1900#line 433 "parse-gram.y"
1901
1902
1903
1904/* Return the location of the left-hand side of a rule whose
1905 right-hand side is RHS[1] ... RHS[N]. Ignore empty nonterminals in
1906 the right-hand side, and return an empty location equal to the end
1907 boundary of RHS[0] if the right-hand side is empty. */
1908
1909static YYLTYPE
1910lloc_default (YYLTYPE const *rhs, int n)
1911{
1912 int i;
1913 YYLTYPE loc;
1914 loc.start = loc.end = rhs[n].end;
1915
1916 /* Ignore empty nonterminals the start of the the right-hand side.
1917 Do not bother to ignore them at the end of the right-hand side,
1918 since empty nonterminals have the same end as their predecessors. */
1919 for (i = 1; i <= n; i++)
1920 if (! equal_boundaries (rhs[i].start, rhs[i].end))
1921 {
1922 loc.start = rhs[i].start;
1923 break;
1924 }
1925
1926 return loc;
1927}
1928
1929
1930/* Add a lex-param or a parse-param (depending on TYPE) with
1931 declaration DECL and location LOC. */
1932
1933static void
1934add_param (char const *type, char *decl, location loc)
1935{
1936 static char const alphanum[] =
1937 "0123456789"
1938 "abcdefghijklmnopqrstuvwxyz"
1939 "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
1940 "_";
1941 char const *alpha = alphanum + 10;
1942 char const *name_start = NULL;
1943 char *p;
1944
1945 for (p = decl; *p; p++)
1946 if ((p == decl || ! strchr (alphanum, p[-1])) && strchr (alpha, p[0]))
1947 name_start = p;
1948
1949 /* Strip the surrounding '{' and '}'. */
1950 decl++;
1951 p[-1] = '\0';
1952
1953 if (! name_start)
1954 complain_at (loc, _("missing identifier in parameter declaration"));
1955 else
1956 {
1957 char *name;
1958 size_t name_len;
1959
1960 for (name_len = 1;
1961 name_start[name_len] && strchr (alphanum, name_start[name_len]);
1962 name_len++)
1963 continue;
1964
1965 name = xmalloc (name_len + 1);
1966 memcpy (name, name_start, name_len);
1967 name[name_len] = '\0';
1968 muscle_pair_list_grow (type, decl, name);
1969 free (name);
1970 }
1971
1972 scanner_last_string_free ();
1973}
1974
1975/*----------------------------------------------------.
1976| When debugging the parser, display tokens' values. |
1977`----------------------------------------------------*/
1978
1979static void
1980print_token_value (FILE *file, int type, YYSTYPE const *value)
1981{
1982 fputc (' ', file);
1983 switch (type)
1984 {
1985 case ID:
1986 fprintf (file, " = %s", value->symbol->tag);
1987 break;
1988
1989 case INT:
1990 fprintf (file, " = %d", value->integer);
1991 break;
1992
1993 case STRING:
1994 fprintf (file, " = \"%s\"", value->chars);
1995 break;
1996
1997 case TYPE:
1998 fprintf (file, " = <%s>", value->uniqstr);
1999 break;
2000
2001 case BRACED_CODE:
2002 case PERCENT_DESTRUCTOR:
2003 case PERCENT_LEX_PARAM:
2004 case PERCENT_PARSE_PARAM:
2005 case PERCENT_PRINTER:
2006 case PERCENT_UNION:
2007 case PROLOGUE:
2008 case EPILOGUE:
2009 fprintf (file, " = {{ %s }}", value->chars);
2010 break;
2011
2012 default:
2013 fprintf (file, "unknown token type");
2014 break;
2015 }
2016}
2017
2018static void
2019gram_error (location const *loc, char const *msg)
2020{
2021 complain_at (*loc, "%s", msg);
2022}
2023
2024char const *
2025token_name (int type)
2026{
2027 return yytname[type];
2028}
2029