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