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