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