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