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