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