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