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