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