Line | Count | Source |
1 | | /* A Bison parser, made by GNU Bison 3.5.1. */ |
2 | | |
3 | | /* Bison implementation for Yacc-like parsers in C |
4 | | |
5 | | Copyright (C) 1984, 1989-1990, 2000-2015, 2018-2020 Free Software Foundation, |
6 | | Inc. |
7 | | |
8 | | This program is free software: you can redistribute it and/or modify |
9 | | it under the terms of the GNU General Public License as published by |
10 | | the Free Software Foundation, either version 3 of the License, or |
11 | | (at your option) any later version. |
12 | | |
13 | | This program is distributed in the hope that it will be useful, |
14 | | but WITHOUT ANY WARRANTY; without even the implied warranty of |
15 | | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
16 | | GNU General Public License for more details. |
17 | | |
18 | | You should have received a copy of the GNU General Public License |
19 | | along with this program. If not, see <http://www.gnu.org/licenses/>. */ |
20 | | |
21 | | /* As a special exception, you may create a larger work that contains |
22 | | part or all of the Bison parser skeleton and distribute that work |
23 | | under terms of your choice, so long as that work isn't itself a |
24 | | parser generator using the skeleton or a modified version thereof |
25 | | as a parser skeleton. Alternatively, if you modify or redistribute |
26 | | the parser skeleton itself, you may (at your option) remove this |
27 | | special exception, which will cause the skeleton and the resulting |
28 | | Bison output files to be licensed under the GNU General Public |
29 | | License without this special exception. |
30 | | |
31 | | This special exception was added by the Free Software Foundation in |
32 | | version 2.2 of Bison. */ |
33 | | |
34 | | /* C LALR(1) parser skeleton written by Richard Stallman, by |
35 | | simplifying the original so-called "semantic" parser. */ |
36 | | |
37 | | /* All symbols defined below should begin with yy or YY, to avoid |
38 | | infringing on user name space. This should be done even for local |
39 | | variables, as they might otherwise be expanded by user macros. |
40 | | There are some unavoidable exceptions within include files to |
41 | | define necessary library symbols; they are noted "INFRINGES ON |
42 | | USER NAME SPACE" below. */ |
43 | | |
44 | | /* Undocumented macros, especially those whose name start with YY_, |
45 | | are private implementation details. Do not rely on them. */ |
46 | | |
47 | | /* Identify Bison output. */ |
48 | | #define YYBISON 1 |
49 | | |
50 | | /* Bison version. */ |
51 | | #define YYBISON_VERSION "3.5.1" |
52 | | |
53 | | /* Skeleton name. */ |
54 | | #define YYSKELETON_NAME "yacc.c" |
55 | | |
56 | | /* Pure parsers. */ |
57 | | #define YYPURE 0 |
58 | | |
59 | | /* Push parsers. */ |
60 | | #define YYPUSH 0 |
61 | | |
62 | | /* Pull parsers. */ |
63 | | #define YYPULL 1 |
64 | | |
65 | | |
66 | | |
67 | | |
68 | | /* First part of user prologue. */ |
69 | | #line 1 "cue_parser.y" |
70 | | |
71 | | /* |
72 | | * Copyright (c) 2004, 2005, 2006, 2007, Svend Sorensen |
73 | | * Copyright (c) 2009, 2010 Jochen Keil |
74 | | * For license terms, see the file COPYING in this distribution. |
75 | | */ |
76 | | |
77 | | #include <stdlib.h> |
78 | | #include <stdio.h> |
79 | | #include <string.h> |
80 | | |
81 | | #include "cd.h" |
82 | | #include "time.h" |
83 | | |
84 | | #ifdef YY_BUF_SIZE |
85 | | #undef YY_BUF_SIZE |
86 | | #endif |
87 | 0 | #define YY_BUF_SIZE 16384 |
88 | | |
89 | | #define YYDEBUG 1 |
90 | | |
91 | | char fnamebuf[PARSER_BUFFER]; |
92 | | |
93 | | /* debugging */ |
94 | | //int yydebug = 1; |
95 | | |
96 | | extern int yylineno; |
97 | | extern FILE* yyin; |
98 | | |
99 | | static Cd *cd = NULL; |
100 | | static Track *track = NULL; |
101 | | static Track *prev_track = NULL; |
102 | | static Cdtext *cdtext = NULL; |
103 | | static Rem *rem = NULL; |
104 | | static char *prev_filename = NULL; /* last file in or before last track */ |
105 | | static char *cur_filename = NULL; /* last file in the last track */ |
106 | | static char *new_filename = NULL; /* last file in this track */ |
107 | | |
108 | | /* lexer interface */ |
109 | | typedef struct yy_buffer_state* YY_BUFFER_STATE; |
110 | | |
111 | | int yylex(void); |
112 | | void yyerror(const char*); |
113 | | YY_BUFFER_STATE yy_scan_string(const char*); |
114 | | YY_BUFFER_STATE yy_create_buffer(FILE*, int); |
115 | | void yy_switch_to_buffer(YY_BUFFER_STATE); |
116 | | void yy_delete_buffer(YY_BUFFER_STATE); |
117 | | |
118 | | /* parser interface */ |
119 | | int yyparse(void); |
120 | | Cd *cue_parse_file(FILE *fp); |
121 | | Cd *cue_parse_string(const char*); |
122 | | |
123 | | #line 124 "/work/cue_parser.c" |
124 | | |
125 | | # ifndef YY_CAST |
126 | | # ifdef __cplusplus |
127 | | # define YY_CAST(Type, Val) static_cast<Type> (Val) |
128 | | # define YY_REINTERPRET_CAST(Type, Val) reinterpret_cast<Type> (Val) |
129 | | # else |
130 | 341k | # define YY_CAST(Type, Val) ((Type) (Val)) |
131 | | # define YY_REINTERPRET_CAST(Type, Val) ((Type) (Val)) |
132 | | # endif |
133 | | # endif |
134 | | # ifndef YY_NULLPTR |
135 | | # if defined __cplusplus |
136 | | # if 201103L <= __cplusplus |
137 | | # define YY_NULLPTR nullptr |
138 | | # else |
139 | | # define YY_NULLPTR 0 |
140 | | # endif |
141 | | # else |
142 | | # define YY_NULLPTR ((void*)0) |
143 | | # endif |
144 | | # endif |
145 | | |
146 | | /* Enabling verbose error messages. */ |
147 | | #ifdef YYERROR_VERBOSE |
148 | | # undef YYERROR_VERBOSE |
149 | | # define YYERROR_VERBOSE 1 |
150 | | #else |
151 | | # define YYERROR_VERBOSE 0 |
152 | | #endif |
153 | | |
154 | | /* Use api.header.include to #include this header |
155 | | instead of duplicating it here. */ |
156 | | #ifndef YY_YY_WORK_CUE_PARSER_H_INCLUDED |
157 | | # define YY_YY_WORK_CUE_PARSER_H_INCLUDED |
158 | | /* Debug traces. */ |
159 | | #ifndef YYDEBUG |
160 | | # define YYDEBUG 0 |
161 | | #endif |
162 | | #if YYDEBUG |
163 | | extern int yydebug; |
164 | | #endif |
165 | | |
166 | | /* Token type. */ |
167 | | #ifndef YYTOKENTYPE |
168 | | # define YYTOKENTYPE |
169 | | enum yytokentype |
170 | | { |
171 | | NUMBER = 258, |
172 | | STRING = 259, |
173 | | CATALOG = 260, |
174 | | CDTEXTFILE = 261, |
175 | | FFILE = 262, |
176 | | BINARY = 263, |
177 | | MOTOROLA = 264, |
178 | | AIFF = 265, |
179 | | WAVE = 266, |
180 | | MP3 = 267, |
181 | | FLAC = 268, |
182 | | TRACK = 269, |
183 | | AUDIO = 270, |
184 | | MODE1_2048 = 271, |
185 | | MODE1_2352 = 272, |
186 | | MODE2_2336 = 273, |
187 | | MODE2_2048 = 274, |
188 | | MODE2_2342 = 275, |
189 | | MODE2_2332 = 276, |
190 | | MODE2_2352 = 277, |
191 | | TRACK_ISRC = 278, |
192 | | FLAGS = 279, |
193 | | PRE = 280, |
194 | | DCP = 281, |
195 | | FOUR_CH = 282, |
196 | | SCMS = 283, |
197 | | PREGAP = 284, |
198 | | INDEX = 285, |
199 | | POSTGAP = 286, |
200 | | TITLE = 287, |
201 | | PERFORMER = 288, |
202 | | SONGWRITER = 289, |
203 | | COMPOSER = 290, |
204 | | ARRANGER = 291, |
205 | | MESSAGE = 292, |
206 | | DISC_ID = 293, |
207 | | GENRE = 294, |
208 | | TOC_INFO1 = 295, |
209 | | TOC_INFO2 = 296, |
210 | | UPC_EAN = 297, |
211 | | ISRC = 298, |
212 | | SIZE_INFO = 299, |
213 | | DATE = 300, |
214 | | XXX_GENRE = 301, |
215 | | REPLAYGAIN_ALBUM_GAIN = 302, |
216 | | REPLAYGAIN_ALBUM_PEAK = 303, |
217 | | REPLAYGAIN_TRACK_GAIN = 304, |
218 | | REPLAYGAIN_TRACK_PEAK = 305, |
219 | | COMMENT = 306, |
220 | | DISCNUMBER = 307, |
221 | | TOTALDISCS = 308 |
222 | | }; |
223 | | #endif |
224 | | |
225 | | /* Value type. */ |
226 | | #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED |
227 | | union YYSTYPE |
228 | | { |
229 | | #line 57 "cue_parser.y" |
230 | | |
231 | | long ival; |
232 | | char *sval; |
233 | | |
234 | | #line 235 "/work/cue_parser.c" |
235 | | |
236 | | }; |
237 | | typedef union YYSTYPE YYSTYPE; |
238 | | # define YYSTYPE_IS_TRIVIAL 1 |
239 | | # define YYSTYPE_IS_DECLARED 1 |
240 | | #endif |
241 | | |
242 | | |
243 | | extern YYSTYPE yylval; |
244 | | |
245 | | int yyparse (void); |
246 | | |
247 | | #endif /* !YY_YY_WORK_CUE_PARSER_H_INCLUDED */ |
248 | | |
249 | | |
250 | | |
251 | | #ifdef short |
252 | | # undef short |
253 | | #endif |
254 | | |
255 | | /* On compilers that do not define __PTRDIFF_MAX__ etc., make sure |
256 | | <limits.h> and (if available) <stdint.h> are included |
257 | | so that the code can choose integer types of a good width. */ |
258 | | |
259 | | #ifndef __PTRDIFF_MAX__ |
260 | | # include <limits.h> /* INFRINGES ON USER NAME SPACE */ |
261 | | # if defined __STDC_VERSION__ && 199901 <= __STDC_VERSION__ |
262 | | # include <stdint.h> /* INFRINGES ON USER NAME SPACE */ |
263 | | # define YY_STDINT_H |
264 | | # endif |
265 | | #endif |
266 | | |
267 | | /* Narrow types that promote to a signed type and that can represent a |
268 | | signed or unsigned integer of at least N bits. In tables they can |
269 | | save space and decrease cache pressure. Promoting to a signed type |
270 | | helps avoid bugs in integer arithmetic. */ |
271 | | |
272 | | #ifdef __INT_LEAST8_MAX__ |
273 | | typedef __INT_LEAST8_TYPE__ yytype_int8; |
274 | | #elif defined YY_STDINT_H |
275 | | typedef int_least8_t yytype_int8; |
276 | | #else |
277 | | typedef signed char yytype_int8; |
278 | | #endif |
279 | | |
280 | | #ifdef __INT_LEAST16_MAX__ |
281 | | typedef __INT_LEAST16_TYPE__ yytype_int16; |
282 | | #elif defined YY_STDINT_H |
283 | | typedef int_least16_t yytype_int16; |
284 | | #else |
285 | | typedef short yytype_int16; |
286 | | #endif |
287 | | |
288 | | #if defined __UINT_LEAST8_MAX__ && __UINT_LEAST8_MAX__ <= __INT_MAX__ |
289 | | typedef __UINT_LEAST8_TYPE__ yytype_uint8; |
290 | | #elif (!defined __UINT_LEAST8_MAX__ && defined YY_STDINT_H \ |
291 | | && UINT_LEAST8_MAX <= INT_MAX) |
292 | | typedef uint_least8_t yytype_uint8; |
293 | | #elif !defined __UINT_LEAST8_MAX__ && UCHAR_MAX <= INT_MAX |
294 | | typedef unsigned char yytype_uint8; |
295 | | #else |
296 | | typedef short yytype_uint8; |
297 | | #endif |
298 | | |
299 | | #if defined __UINT_LEAST16_MAX__ && __UINT_LEAST16_MAX__ <= __INT_MAX__ |
300 | | typedef __UINT_LEAST16_TYPE__ yytype_uint16; |
301 | | #elif (!defined __UINT_LEAST16_MAX__ && defined YY_STDINT_H \ |
302 | | && UINT_LEAST16_MAX <= INT_MAX) |
303 | | typedef uint_least16_t yytype_uint16; |
304 | | #elif !defined __UINT_LEAST16_MAX__ && USHRT_MAX <= INT_MAX |
305 | | typedef unsigned short yytype_uint16; |
306 | | #else |
307 | | typedef int yytype_uint16; |
308 | | #endif |
309 | | |
310 | | #ifndef YYPTRDIFF_T |
311 | | # if defined __PTRDIFF_TYPE__ && defined __PTRDIFF_MAX__ |
312 | 2.01k | # define YYPTRDIFF_T __PTRDIFF_TYPE__ |
313 | | # define YYPTRDIFF_MAXIMUM __PTRDIFF_MAX__ |
314 | | # elif defined PTRDIFF_MAX |
315 | | # ifndef ptrdiff_t |
316 | | # include <stddef.h> /* INFRINGES ON USER NAME SPACE */ |
317 | | # endif |
318 | | # define YYPTRDIFF_T ptrdiff_t |
319 | | # define YYPTRDIFF_MAXIMUM PTRDIFF_MAX |
320 | | # else |
321 | | # define YYPTRDIFF_T long |
322 | | # define YYPTRDIFF_MAXIMUM LONG_MAX |
323 | | # endif |
324 | | #endif |
325 | | |
326 | | #ifndef YYSIZE_T |
327 | | # ifdef __SIZE_TYPE__ |
328 | | # define YYSIZE_T __SIZE_TYPE__ |
329 | | # elif defined size_t |
330 | | # define YYSIZE_T size_t |
331 | | # elif defined __STDC_VERSION__ && 199901 <= __STDC_VERSION__ |
332 | | # include <stddef.h> /* INFRINGES ON USER NAME SPACE */ |
333 | | # define YYSIZE_T size_t |
334 | | # else |
335 | | # define YYSIZE_T unsigned |
336 | | # endif |
337 | | #endif |
338 | | |
339 | | #define YYSIZE_MAXIMUM \ |
340 | | YY_CAST (YYPTRDIFF_T, \ |
341 | | (YYPTRDIFF_MAXIMUM < YY_CAST (YYSIZE_T, -1) \ |
342 | | ? YYPTRDIFF_MAXIMUM \ |
343 | | : YY_CAST (YYSIZE_T, -1))) |
344 | | |
345 | 234 | #define YYSIZEOF(X) YY_CAST (YYPTRDIFF_T, sizeof (X)) |
346 | | |
347 | | /* Stored state numbers (used for stacks). */ |
348 | | typedef yytype_int8 yy_state_t; |
349 | | |
350 | | /* State numbers in computations. */ |
351 | | typedef int yy_state_fast_t; |
352 | | |
353 | | #ifndef YY_ |
354 | | # if defined YYENABLE_NLS && YYENABLE_NLS |
355 | | # if ENABLE_NLS |
356 | | # include <libintl.h> /* INFRINGES ON USER NAME SPACE */ |
357 | | # define YY_(Msgid) dgettext ("bison-runtime", Msgid) |
358 | | # endif |
359 | | # endif |
360 | | # ifndef YY_ |
361 | 2.87k | # define YY_(Msgid) Msgid |
362 | | # endif |
363 | | #endif |
364 | | |
365 | | #ifndef YY_ATTRIBUTE_PURE |
366 | | # if defined __GNUC__ && 2 < __GNUC__ + (96 <= __GNUC_MINOR__) |
367 | | # define YY_ATTRIBUTE_PURE __attribute__ ((__pure__)) |
368 | | # else |
369 | | # define YY_ATTRIBUTE_PURE |
370 | | # endif |
371 | | #endif |
372 | | |
373 | | #ifndef YY_ATTRIBUTE_UNUSED |
374 | | # if defined __GNUC__ && 2 < __GNUC__ + (7 <= __GNUC_MINOR__) |
375 | | # define YY_ATTRIBUTE_UNUSED __attribute__ ((__unused__)) |
376 | | # else |
377 | | # define YY_ATTRIBUTE_UNUSED |
378 | | # endif |
379 | | #endif |
380 | | |
381 | | /* Suppress unused-variable warnings by "using" E. */ |
382 | | #if ! defined lint || defined __GNUC__ |
383 | 479k | # define YYUSE(E) ((void) (E)) |
384 | | #else |
385 | | # define YYUSE(E) /* empty */ |
386 | | #endif |
387 | | |
388 | | #if defined __GNUC__ && ! defined __ICC && 407 <= __GNUC__ * 100 + __GNUC_MINOR__ |
389 | | /* Suppress an incorrect diagnostic about yylval being uninitialized. */ |
390 | | # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \ |
391 | | _Pragma ("GCC diagnostic push") \ |
392 | | _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"") \ |
393 | | _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"") |
394 | | # define YY_IGNORE_MAYBE_UNINITIALIZED_END \ |
395 | | _Pragma ("GCC diagnostic pop") |
396 | | #else |
397 | | # define YY_INITIAL_VALUE(Value) Value |
398 | | #endif |
399 | | #ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN |
400 | | # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN |
401 | | # define YY_IGNORE_MAYBE_UNINITIALIZED_END |
402 | | #endif |
403 | | #ifndef YY_INITIAL_VALUE |
404 | | # define YY_INITIAL_VALUE(Value) /* Nothing. */ |
405 | | #endif |
406 | | |
407 | | #if defined __cplusplus && defined __GNUC__ && ! defined __ICC && 6 <= __GNUC__ |
408 | | # define YY_IGNORE_USELESS_CAST_BEGIN \ |
409 | | _Pragma ("GCC diagnostic push") \ |
410 | | _Pragma ("GCC diagnostic ignored \"-Wuseless-cast\"") |
411 | | # define YY_IGNORE_USELESS_CAST_END \ |
412 | | _Pragma ("GCC diagnostic pop") |
413 | | #endif |
414 | | #ifndef YY_IGNORE_USELESS_CAST_BEGIN |
415 | | # define YY_IGNORE_USELESS_CAST_BEGIN |
416 | | # define YY_IGNORE_USELESS_CAST_END |
417 | | #endif |
418 | | |
419 | | |
420 | 341k | #define YY_ASSERT(E) ((void) (0 && (E))) |
421 | | |
422 | | #if ! defined yyoverflow || YYERROR_VERBOSE |
423 | | |
424 | | /* The parser invokes alloca or malloc; define the necessary symbols. */ |
425 | | |
426 | | # ifdef YYSTACK_USE_ALLOCA |
427 | | # if YYSTACK_USE_ALLOCA |
428 | | # ifdef __GNUC__ |
429 | | # define YYSTACK_ALLOC __builtin_alloca |
430 | | # elif defined __BUILTIN_VA_ARG_INCR |
431 | | # include <alloca.h> /* INFRINGES ON USER NAME SPACE */ |
432 | | # elif defined _AIX |
433 | | # define YYSTACK_ALLOC __alloca |
434 | | # elif defined _MSC_VER |
435 | | # include <malloc.h> /* INFRINGES ON USER NAME SPACE */ |
436 | | # define alloca _alloca |
437 | | # else |
438 | | # define YYSTACK_ALLOC alloca |
439 | | # if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS |
440 | | # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ |
441 | | /* Use EXIT_SUCCESS as a witness for stdlib.h. */ |
442 | | # ifndef EXIT_SUCCESS |
443 | | # define EXIT_SUCCESS 0 |
444 | | # endif |
445 | | # endif |
446 | | # endif |
447 | | # endif |
448 | | # endif |
449 | | |
450 | | # ifdef YYSTACK_ALLOC |
451 | | /* Pacify GCC's 'empty if-body' warning. */ |
452 | | # define YYSTACK_FREE(Ptr) do { /* empty */; } while (0) |
453 | | # ifndef YYSTACK_ALLOC_MAXIMUM |
454 | | /* The OS might guarantee only one guard page at the bottom of the stack, |
455 | | and a page size can be as small as 4096 bytes. So we cannot safely |
456 | | invoke alloca (N) if N exceeds 4096. Use a slightly smaller number |
457 | | to allow for a few compiler-allocated temporary stack slots. */ |
458 | | # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */ |
459 | | # endif |
460 | | # else |
461 | | # define YYSTACK_ALLOC YYMALLOC |
462 | 39 | # define YYSTACK_FREE YYFREE |
463 | | # ifndef YYSTACK_ALLOC_MAXIMUM |
464 | | # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM |
465 | | # endif |
466 | | # if (defined __cplusplus && ! defined EXIT_SUCCESS \ |
467 | | && ! ((defined YYMALLOC || defined malloc) \ |
468 | | && (defined YYFREE || defined free))) |
469 | | # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ |
470 | | # ifndef EXIT_SUCCESS |
471 | | # define EXIT_SUCCESS 0 |
472 | | # endif |
473 | | # endif |
474 | | # ifndef YYMALLOC |
475 | | # define YYMALLOC malloc |
476 | | # if ! defined malloc && ! defined EXIT_SUCCESS |
477 | | void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */ |
478 | | # endif |
479 | | # endif |
480 | | # ifndef YYFREE |
481 | 39 | # define YYFREE free |
482 | | # if ! defined free && ! defined EXIT_SUCCESS |
483 | | void free (void *); /* INFRINGES ON USER NAME SPACE */ |
484 | | # endif |
485 | | # endif |
486 | | # endif |
487 | | #endif /* ! defined yyoverflow || YYERROR_VERBOSE */ |
488 | | |
489 | | |
490 | | #if (! defined yyoverflow \ |
491 | | && (! defined __cplusplus \ |
492 | | || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL))) |
493 | | |
494 | | /* A type that is properly aligned for any stack member. */ |
495 | | union yyalloc |
496 | | { |
497 | | yy_state_t yyss_alloc; |
498 | | YYSTYPE yyvs_alloc; |
499 | | }; |
500 | | |
501 | | /* The size of the maximum gap between one aligned stack and the next. */ |
502 | 78 | # define YYSTACK_GAP_MAXIMUM (YYSIZEOF (union yyalloc) - 1) |
503 | | |
504 | | /* The size of an array large to enough to hold all stacks, each with |
505 | | N elements. */ |
506 | | # define YYSTACK_BYTES(N) \ |
507 | | ((N) * (YYSIZEOF (yy_state_t) + YYSIZEOF (YYSTYPE)) \ |
508 | | + YYSTACK_GAP_MAXIMUM) |
509 | | |
510 | | # define YYCOPY_NEEDED 1 |
511 | | |
512 | | /* Relocate STACK from its old location to the new one. The |
513 | | local variables YYSIZE and YYSTACKSIZE give the old and new number of |
514 | | elements in the stack, and YYPTR gives the new location of the |
515 | | stack. Advance YYPTR to a properly aligned location for the next |
516 | | stack. */ |
517 | | # define YYSTACK_RELOCATE(Stack_alloc, Stack) \ |
518 | 78 | do \ |
519 | 78 | { \ |
520 | 78 | YYPTRDIFF_T yynewbytes; \ |
521 | 78 | YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \ |
522 | 78 | Stack = &yyptr->Stack_alloc; \ |
523 | 78 | yynewbytes = yystacksize * YYSIZEOF (*Stack) + YYSTACK_GAP_MAXIMUM; \ |
524 | 78 | yyptr += yynewbytes / YYSIZEOF (*yyptr); \ |
525 | 78 | } \ |
526 | 78 | while (0) |
527 | | |
528 | | #endif |
529 | | |
530 | | #if defined YYCOPY_NEEDED && YYCOPY_NEEDED |
531 | | /* Copy COUNT objects from SRC to DST. The source and destination do |
532 | | not overlap. */ |
533 | | # ifndef YYCOPY |
534 | | # if defined __GNUC__ && 1 < __GNUC__ |
535 | | # define YYCOPY(Dst, Src, Count) \ |
536 | 78 | __builtin_memcpy (Dst, Src, YY_CAST (YYSIZE_T, (Count)) * sizeof (*(Src))) |
537 | | # else |
538 | | # define YYCOPY(Dst, Src, Count) \ |
539 | | do \ |
540 | | { \ |
541 | | YYPTRDIFF_T yyi; \ |
542 | | for (yyi = 0; yyi < (Count); yyi++) \ |
543 | | (Dst)[yyi] = (Src)[yyi]; \ |
544 | | } \ |
545 | | while (0) |
546 | | # endif |
547 | | # endif |
548 | | #endif /* !YYCOPY_NEEDED */ |
549 | | |
550 | | /* YYFINAL -- State number of the termination state. */ |
551 | 341k | #define YYFINAL 3 |
552 | | /* YYLAST -- Last index in YYTABLE. */ |
553 | 638k | #define YYLAST 162 |
554 | | |
555 | | /* YYNTOKENS -- Number of terminals. */ |
556 | 103k | #define YYNTOKENS 56 |
557 | | /* YYNNTS -- Number of nonterminals. */ |
558 | | #define YYNNTS 22 |
559 | | /* YYNRULES -- Number of rules. */ |
560 | | #define YYNRULES 76 |
561 | | /* YYNSTATES -- Number of states. */ |
562 | | #define YYNSTATES 111 |
563 | | |
564 | 0 | #define YYUNDEFTOK 2 |
565 | 358k | #define YYMAXUTOK 308 |
566 | | |
567 | | |
568 | | /* YYTRANSLATE(TOKEN-NUM) -- Symbol number corresponding to TOKEN-NUM |
569 | | as returned by yylex, with out-of-bounds checking. */ |
570 | | #define YYTRANSLATE(YYX) \ |
571 | 473k | (0 <= (YYX) && (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) |
572 | | |
573 | | /* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM |
574 | | as returned by yylex. */ |
575 | | static const yytype_int8 yytranslate[] = |
576 | | { |
577 | | 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
578 | | 54, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
579 | | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
580 | | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
581 | | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
582 | | 2, 2, 2, 2, 2, 2, 2, 2, 55, 2, |
583 | | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
584 | | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
585 | | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
586 | | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
587 | | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
588 | | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
589 | | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
590 | | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
591 | | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
592 | | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
593 | | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
594 | | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
595 | | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
596 | | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
597 | | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
598 | | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
599 | | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
600 | | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
601 | | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
602 | | 2, 2, 2, 2, 2, 2, 1, 2, 3, 4, |
603 | | 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, |
604 | | 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, |
605 | | 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, |
606 | | 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, |
607 | | 45, 46, 47, 48, 49, 50, 51, 52, 53 |
608 | | }; |
609 | | |
610 | | #if YYDEBUG |
611 | | /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */ |
612 | | static const yytype_int16 yyrline[] = |
613 | | { |
614 | | 0, 136, 136, 140, 148, 149, 153, 154, 155, 156, |
615 | | 157, 158, 162, 176, 177, 181, 185, 186, 187, 188, |
616 | | 189, 190, 194, 218, 224, 225, 226, 227, 228, 229, |
617 | | 230, 231, 235, 236, 240, 241, 242, 243, 244, 245, |
618 | | 268, 269, 270, 274, 275, 279, 280, 281, 282, 286, |
619 | | 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, |
620 | | 300, 301, 302, 306, 307, 311, 312, 316, 317, 318, |
621 | | 319, 320, 321, 322, 323, 327, 328 |
622 | | }; |
623 | | #endif |
624 | | |
625 | | #if YYDEBUG || YYERROR_VERBOSE || 0 |
626 | | /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. |
627 | | First, the terminals, then, starting at YYNTOKENS, nonterminals. */ |
628 | | static const char *const yytname[] = |
629 | | { |
630 | | "$end", "error", "$undefined", "NUMBER", "STRING", "CATALOG", |
631 | | "CDTEXTFILE", "FFILE", "BINARY", "MOTOROLA", "AIFF", "WAVE", "MP3", |
632 | | "FLAC", "TRACK", "AUDIO", "MODE1_2048", "MODE1_2352", "MODE2_2336", |
633 | | "MODE2_2048", "MODE2_2342", "MODE2_2332", "MODE2_2352", "TRACK_ISRC", |
634 | | "FLAGS", "PRE", "DCP", "FOUR_CH", "SCMS", "PREGAP", "INDEX", "POSTGAP", |
635 | | "TITLE", "PERFORMER", "SONGWRITER", "COMPOSER", "ARRANGER", "MESSAGE", |
636 | | "DISC_ID", "GENRE", "TOC_INFO1", "TOC_INFO2", "UPC_EAN", "ISRC", |
637 | | "SIZE_INFO", "DATE", "XXX_GENRE", "REPLAYGAIN_ALBUM_GAIN", |
638 | | "REPLAYGAIN_ALBUM_PEAK", "REPLAYGAIN_TRACK_GAIN", |
639 | | "REPLAYGAIN_TRACK_PEAK", "COMMENT", "DISCNUMBER", "TOTALDISCS", "'\\n'", |
640 | | "':'", "$accept", "cuefile", "new_cd", "global_statements", |
641 | | "global_statement", "track_data", "track_list", "track", "file_format", |
642 | | "new_track", "track_def", "track_mode", "track_statements", |
643 | | "track_statement", "track_flags", "track_flag", "cdtext", "cdtext_item", |
644 | | "time", "rem", "rem_item", "end_cd", YY_NULLPTR |
645 | | }; |
646 | | #endif |
647 | | |
648 | | # ifdef YYPRINT |
649 | | /* YYTOKNUM[NUM] -- (External) token number corresponding to the |
650 | | (internal) symbol number NUM (which must be that of a token). */ |
651 | | static const yytype_int16 yytoknum[] = |
652 | | { |
653 | | 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, |
654 | | 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, |
655 | | 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, |
656 | | 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, |
657 | | 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, |
658 | | 305, 306, 307, 308, 10, 58 |
659 | | }; |
660 | | # endif |
661 | | |
662 | 560k | #define YYPACT_NINF (-67) |
663 | | |
664 | | #define yypact_value_is_default(Yyn) \ |
665 | 560k | ((Yyn) == YYPACT_NINF) |
666 | | |
667 | | #define YYTABLE_NINF (-76) |
668 | | |
669 | | #define yytable_value_is_error(Yyn) \ |
670 | 6.00k | 0 |
671 | | |
672 | | /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing |
673 | | STATE-NUM. */ |
674 | | static const yytype_int8 yypact[] = |
675 | | { |
676 | | -67, 4, -67, -67, 107, -49, 5, 6, 8, -67, |
677 | | -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, |
678 | | -67, -67, -67, 9, -67, -67, -67, -67, -67, -67, |
679 | | -67, -67, -67, 2, -67, -8, -67, 17, -67, 18, |
680 | | -67, -46, -43, 7, -29, -27, -67, -67, 25, 54, |
681 | | 3, 16, -67, -67, -67, -67, -67, -67, -67, -67, |
682 | | 19, -67, -67, 47, 20, 55, -67, 57, 68, 57, |
683 | | -67, 0, -67, -67, -67, -67, -67, -67, -67, -67, |
684 | | -67, -67, -67, -67, -67, -67, 21, -67, 22, 108, |
685 | | 24, 26, 57, 27, -67, -67, -67, -67, -67, -67, |
686 | | -67, -67, -67, 69, -67, 28, -67, 56, -67, 106, |
687 | | -67 |
688 | | }; |
689 | | |
690 | | /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM. |
691 | | Performed when YYTABLE does not specify something else to do. Zero |
692 | | means the default is an error. */ |
693 | | static const yytype_int8 yydefact[] = |
694 | | { |
695 | | 3, 0, 4, 1, 0, 0, 0, 0, 0, 50, |
696 | | 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, |
697 | | 61, 62, 67, 0, 68, 69, 70, 71, 72, 73, |
698 | | 74, 5, 10, 22, 13, 0, 8, 0, 9, 0, |
699 | | 11, 0, 0, 0, 0, 75, 14, 2, 0, 0, |
700 | | 0, 0, 6, 7, 16, 17, 18, 19, 20, 21, |
701 | | 0, 66, 76, 0, 0, 0, 43, 0, 0, 0, |
702 | | 41, 0, 32, 34, 35, 49, 65, 12, 24, 25, |
703 | | 26, 27, 28, 29, 30, 31, 0, 42, 0, 0, |
704 | | 63, 0, 0, 0, 33, 23, 37, 45, 46, 47, |
705 | | 48, 36, 44, 0, 38, 0, 40, 0, 39, 0, |
706 | | 64 |
707 | | }; |
708 | | |
709 | | /* YYPGOTO[NTERM-NUM]. */ |
710 | | static const yytype_int8 yypgoto[] = |
711 | | { |
712 | | -67, -67, -67, -67, -67, 111, -67, 77, -67, -67, |
713 | | -67, -67, -67, -13, -67, -67, 112, -67, -66, 113, |
714 | | -67, 73 |
715 | | }; |
716 | | |
717 | | /* YYDEFGOTO[NTERM-NUM]. */ |
718 | | static const yytype_int8 yydefgoto[] = |
719 | | { |
720 | | -1, 1, 2, 4, 31, 70, 33, 34, 60, 35, |
721 | | 49, 86, 71, 72, 89, 102, 73, 37, 91, 74, |
722 | | 39, 47 |
723 | | }; |
724 | | |
725 | | /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If |
726 | | positive, shift that token. If negative, reduce the rule whose |
727 | | number is the opposite. If YYTABLE_NINF, syntax error. */ |
728 | | static const yytype_int8 yytable[] = |
729 | | { |
730 | | -15, 64, -75, 93, 3, 40, 48, 8, 52, 41, |
731 | | 42, 53, 43, 44, -15, 54, 55, 56, 57, 58, |
732 | | 59, 50, 51, 65, 66, 61, 105, 45, 63, 67, |
733 | | 68, 69, 9, 10, 11, 12, 13, 14, 15, 16, |
734 | | 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, |
735 | | 27, 28, 29, 30, -15, 64, 45, 75, 94, 88, |
736 | | 90, 8, 78, 79, 80, 81, 82, 83, 84, 85, |
737 | | 76, 92, 107, 77, 87, 95, 96, 65, 66, 103, |
738 | | 104, 106, 108, 67, 68, 69, 9, 10, 11, 12, |
739 | | 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, |
740 | | 23, 24, 25, 26, 27, 28, 29, 30, 5, 110, |
741 | | 46, 109, 6, 7, 8, 32, 36, 38, 62, 0, |
742 | | 0, -22, 0, 0, 0, 0, 0, 0, 0, 0, |
743 | | 0, 0, 0, 97, 98, 99, 100, 0, 0, 9, |
744 | | 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, |
745 | | 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, |
746 | | 30, 0, 101 |
747 | | }; |
748 | | |
749 | | static const yytype_int8 yycheck[] = |
750 | | { |
751 | | 0, 1, 0, 69, 0, 54, 14, 7, 54, 4, |
752 | | 4, 54, 4, 4, 14, 8, 9, 10, 11, 12, |
753 | | 13, 4, 4, 23, 24, 54, 92, 54, 3, 29, |
754 | | 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, |
755 | | 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, |
756 | | 50, 51, 52, 53, 54, 1, 54, 54, 71, 4, |
757 | | 3, 7, 15, 16, 17, 18, 19, 20, 21, 22, |
758 | | 54, 3, 3, 54, 54, 54, 54, 23, 24, 55, |
759 | | 54, 54, 54, 29, 30, 31, 32, 33, 34, 35, |
760 | | 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, |
761 | | 46, 47, 48, 49, 50, 51, 52, 53, 1, 3, |
762 | | 33, 55, 5, 6, 7, 4, 4, 4, 45, -1, |
763 | | -1, 14, -1, -1, -1, -1, -1, -1, -1, -1, |
764 | | -1, -1, -1, 25, 26, 27, 28, -1, -1, 32, |
765 | | 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, |
766 | | 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, |
767 | | 53, -1, 54 |
768 | | }; |
769 | | |
770 | | /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing |
771 | | symbol of state STATE-NUM. */ |
772 | | static const yytype_int8 yystos[] = |
773 | | { |
774 | | 0, 57, 58, 0, 59, 1, 5, 6, 7, 32, |
775 | | 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, |
776 | | 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, |
777 | | 53, 60, 61, 62, 63, 65, 72, 73, 75, 76, |
778 | | 54, 4, 4, 4, 4, 54, 63, 77, 14, 66, |
779 | | 4, 4, 54, 54, 8, 9, 10, 11, 12, 13, |
780 | | 64, 54, 77, 3, 1, 23, 24, 29, 30, 31, |
781 | | 61, 68, 69, 72, 75, 54, 54, 54, 15, 16, |
782 | | 17, 18, 19, 20, 21, 22, 67, 54, 4, 70, |
783 | | 3, 74, 3, 74, 69, 54, 54, 25, 26, 27, |
784 | | 28, 54, 71, 55, 54, 74, 54, 3, 54, 55, |
785 | | 3 |
786 | | }; |
787 | | |
788 | | /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ |
789 | | static const yytype_int8 yyr1[] = |
790 | | { |
791 | | 0, 56, 57, 58, 59, 59, 60, 60, 60, 60, |
792 | | 60, 60, 61, 62, 62, 63, 64, 64, 64, 64, |
793 | | 64, 64, 65, 66, 67, 67, 67, 67, 67, 67, |
794 | | 67, 67, 68, 68, 69, 69, 69, 69, 69, 69, |
795 | | 69, 69, 69, 70, 70, 71, 71, 71, 71, 72, |
796 | | 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, |
797 | | 73, 73, 73, 74, 74, 75, 75, 76, 76, 76, |
798 | | 76, 76, 76, 76, 76, 77, 77 |
799 | | }; |
800 | | |
801 | | /* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN. */ |
802 | | static const yytype_int8 yyr2[] = |
803 | | { |
804 | | 0, 2, 4, 0, 0, 2, 3, 3, 1, 1, |
805 | | 1, 2, 4, 1, 2, 3, 1, 1, 1, 1, |
806 | | 1, 1, 0, 4, 1, 1, 1, 1, 1, 1, |
807 | | 1, 1, 1, 2, 1, 1, 3, 3, 3, 4, |
808 | | 3, 1, 2, 0, 2, 1, 1, 1, 1, 3, |
809 | | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
810 | | 1, 1, 1, 1, 5, 3, 3, 1, 1, 1, |
811 | | 1, 1, 1, 1, 1, 0, 2 |
812 | | }; |
813 | | |
814 | | |
815 | | #define yyerrok (yyerrstatus = 0) |
816 | | #define yyclearin (yychar = YYEMPTY) |
817 | 584k | #define YYEMPTY (-2) |
818 | 351k | #define YYEOF 0 |
819 | | |
820 | 863 | #define YYACCEPT goto yyacceptlab |
821 | 1.03k | #define YYABORT goto yyabortlab |
822 | 0 | #define YYERROR goto yyerrorlab |
823 | | |
824 | | |
825 | | #define YYRECOVERING() (!!yyerrstatus) |
826 | | |
827 | | #define YYBACKUP(Token, Value) \ |
828 | | do \ |
829 | | if (yychar == YYEMPTY) \ |
830 | | { \ |
831 | | yychar = (Token); \ |
832 | | yylval = (Value); \ |
833 | | YYPOPSTACK (yylen); \ |
834 | | yystate = *yyssp; \ |
835 | | goto yybackup; \ |
836 | | } \ |
837 | | else \ |
838 | | { \ |
839 | | yyerror (YY_("syntax error: cannot back up")); \ |
840 | | YYERROR; \ |
841 | | } \ |
842 | | while (0) |
843 | | |
844 | | /* Error token number */ |
845 | 343k | #define YYTERROR 1 |
846 | | #define YYERRCODE 256 |
847 | | |
848 | | |
849 | | |
850 | | /* Enable debugging if requested. */ |
851 | | #if YYDEBUG |
852 | | |
853 | | # ifndef YYFPRINTF |
854 | | # include <stdio.h> /* INFRINGES ON USER NAME SPACE */ |
855 | 0 | # define YYFPRINTF fprintf |
856 | | # endif |
857 | | |
858 | 567k | # define YYDPRINTF(Args) \ |
859 | 567k | do { \ |
860 | 567k | if (yydebug) \ |
861 | 567k | YYFPRINTF Args; \ |
862 | 567k | } while (0) |
863 | | |
864 | | /* This macro is provided for backward compatibility. */ |
865 | | #ifndef YY_LOCATION_PRINT |
866 | | # define YY_LOCATION_PRINT(File, Loc) ((void) 0) |
867 | | #endif |
868 | | |
869 | | |
870 | 821k | # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ |
871 | 821k | do { \ |
872 | 821k | if (yydebug) \ |
873 | 821k | { \ |
874 | 0 | YYFPRINTF (stderr, "%s ", Title); \ |
875 | 0 | yy_symbol_print (stderr, \ |
876 | 0 | Type, Value); \ |
877 | 0 | YYFPRINTF (stderr, "\n"); \ |
878 | 0 | } \ |
879 | 821k | } while (0) |
880 | | |
881 | | |
882 | | /*-----------------------------------. |
883 | | | Print this symbol's value on YYO. | |
884 | | `-----------------------------------*/ |
885 | | |
886 | | static void |
887 | | yy_symbol_value_print (FILE *yyo, int yytype, YYSTYPE const * const yyvaluep) |
888 | 0 | { |
889 | 0 | FILE *yyoutput = yyo; |
890 | 0 | YYUSE (yyoutput); |
891 | 0 | if (!yyvaluep) |
892 | 0 | return; |
893 | | # ifdef YYPRINT |
894 | | if (yytype < YYNTOKENS) |
895 | | YYPRINT (yyo, yytoknum[yytype], *yyvaluep); |
896 | | # endif |
897 | 0 | YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN |
898 | 0 | YYUSE (yytype); |
899 | 0 | YY_IGNORE_MAYBE_UNINITIALIZED_END |
900 | 0 | } |
901 | | |
902 | | |
903 | | /*---------------------------. |
904 | | | Print this symbol on YYO. | |
905 | | `---------------------------*/ |
906 | | |
907 | | static void |
908 | | yy_symbol_print (FILE *yyo, int yytype, YYSTYPE const * const yyvaluep) |
909 | 0 | { |
910 | 0 | YYFPRINTF (yyo, "%s %s (", |
911 | 0 | yytype < YYNTOKENS ? "token" : "nterm", yytname[yytype]); |
912 | |
|
913 | 0 | yy_symbol_value_print (yyo, yytype, yyvaluep); |
914 | 0 | YYFPRINTF (yyo, ")"); |
915 | 0 | } |
916 | | |
917 | | /*------------------------------------------------------------------. |
918 | | | yy_stack_print -- Print the state stack from its BOTTOM up to its | |
919 | | | TOP (included). | |
920 | | `------------------------------------------------------------------*/ |
921 | | |
922 | | static void |
923 | | yy_stack_print (yy_state_t *yybottom, yy_state_t *yytop) |
924 | 0 | { |
925 | 0 | YYFPRINTF (stderr, "Stack now"); |
926 | 0 | for (; yybottom <= yytop; yybottom++) |
927 | 0 | { |
928 | 0 | int yybot = *yybottom; |
929 | 0 | YYFPRINTF (stderr, " %d", yybot); |
930 | 0 | } |
931 | 0 | YYFPRINTF (stderr, "\n"); |
932 | 0 | } |
933 | | |
934 | 211k | # define YY_STACK_PRINT(Bottom, Top) \ |
935 | 211k | do { \ |
936 | 211k | if (yydebug) \ |
937 | 211k | yy_stack_print ((Bottom), (Top)); \ |
938 | 211k | } while (0) |
939 | | |
940 | | |
941 | | /*------------------------------------------------. |
942 | | | Report that the YYRULE is going to be reduced. | |
943 | | `------------------------------------------------*/ |
944 | | |
945 | | static void |
946 | | yy_reduce_print (yy_state_t *yyssp, YYSTYPE *yyvsp, int yyrule) |
947 | 0 | { |
948 | 0 | int yylno = yyrline[yyrule]; |
949 | 0 | int yynrhs = yyr2[yyrule]; |
950 | 0 | int yyi; |
951 | 0 | YYFPRINTF (stderr, "Reducing stack by rule %d (line %d):\n", |
952 | 0 | yyrule - 1, yylno); |
953 | | /* The symbols being reduced. */ |
954 | 0 | for (yyi = 0; yyi < yynrhs; yyi++) |
955 | 0 | { |
956 | 0 | YYFPRINTF (stderr, " $%d = ", yyi + 1); |
957 | 0 | yy_symbol_print (stderr, |
958 | 0 | yystos[+yyssp[yyi + 1 - yynrhs]], |
959 | 0 | &yyvsp[(yyi + 1) - (yynrhs)] |
960 | 0 | ); |
961 | 0 | YYFPRINTF (stderr, "\n"); |
962 | 0 | } |
963 | 0 | } |
964 | | |
965 | 103k | # define YY_REDUCE_PRINT(Rule) \ |
966 | 103k | do { \ |
967 | 103k | if (yydebug) \ |
968 | 103k | yy_reduce_print (yyssp, yyvsp, Rule); \ |
969 | 103k | } while (0) |
970 | | |
971 | | /* Nonzero means print parse trace. It is left uninitialized so that |
972 | | multiple parsers can coexist. */ |
973 | | int yydebug; |
974 | | #else /* !YYDEBUG */ |
975 | | # define YYDPRINTF(Args) |
976 | | # define YY_SYMBOL_PRINT(Title, Type, Value, Location) |
977 | | # define YY_STACK_PRINT(Bottom, Top) |
978 | | # define YY_REDUCE_PRINT(Rule) |
979 | | #endif /* !YYDEBUG */ |
980 | | |
981 | | |
982 | | /* YYINITDEPTH -- initial size of the parser's stacks. */ |
983 | | #ifndef YYINITDEPTH |
984 | 1.89k | # define YYINITDEPTH 200 |
985 | | #endif |
986 | | |
987 | | /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only |
988 | | if the built-in stack extension method is used). |
989 | | |
990 | | Do not make this value too large; the results are undefined if |
991 | | YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH) |
992 | | evaluated with infinite-precision integer arithmetic. */ |
993 | | |
994 | | #ifndef YYMAXDEPTH |
995 | 85 | # define YYMAXDEPTH 10000 |
996 | | #endif |
997 | | |
998 | | |
999 | | #if YYERROR_VERBOSE |
1000 | | |
1001 | | # ifndef yystrlen |
1002 | | # if defined __GLIBC__ && defined _STRING_H |
1003 | | # define yystrlen(S) (YY_CAST (YYPTRDIFF_T, strlen (S))) |
1004 | | # else |
1005 | | /* Return the length of YYSTR. */ |
1006 | | static YYPTRDIFF_T |
1007 | | yystrlen (const char *yystr) |
1008 | | { |
1009 | | YYPTRDIFF_T yylen; |
1010 | | for (yylen = 0; yystr[yylen]; yylen++) |
1011 | | continue; |
1012 | | return yylen; |
1013 | | } |
1014 | | # endif |
1015 | | # endif |
1016 | | |
1017 | | # ifndef yystpcpy |
1018 | | # if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE |
1019 | | # define yystpcpy stpcpy |
1020 | | # else |
1021 | | /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in |
1022 | | YYDEST. */ |
1023 | | static char * |
1024 | | yystpcpy (char *yydest, const char *yysrc) |
1025 | | { |
1026 | | char *yyd = yydest; |
1027 | | const char *yys = yysrc; |
1028 | | |
1029 | | while ((*yyd++ = *yys++) != '\0') |
1030 | | continue; |
1031 | | |
1032 | | return yyd - 1; |
1033 | | } |
1034 | | # endif |
1035 | | # endif |
1036 | | |
1037 | | # ifndef yytnamerr |
1038 | | /* Copy to YYRES the contents of YYSTR after stripping away unnecessary |
1039 | | quotes and backslashes, so that it's suitable for yyerror. The |
1040 | | heuristic is that double-quoting is unnecessary unless the string |
1041 | | contains an apostrophe, a comma, or backslash (other than |
1042 | | backslash-backslash). YYSTR is taken from yytname. If YYRES is |
1043 | | null, do not copy; instead, return the length of what the result |
1044 | | would have been. */ |
1045 | | static YYPTRDIFF_T |
1046 | | yytnamerr (char *yyres, const char *yystr) |
1047 | | { |
1048 | | if (*yystr == '"') |
1049 | | { |
1050 | | YYPTRDIFF_T yyn = 0; |
1051 | | char const *yyp = yystr; |
1052 | | |
1053 | | for (;;) |
1054 | | switch (*++yyp) |
1055 | | { |
1056 | | case '\'': |
1057 | | case ',': |
1058 | | goto do_not_strip_quotes; |
1059 | | |
1060 | | case '\\': |
1061 | | if (*++yyp != '\\') |
1062 | | goto do_not_strip_quotes; |
1063 | | else |
1064 | | goto append; |
1065 | | |
1066 | | append: |
1067 | | default: |
1068 | | if (yyres) |
1069 | | yyres[yyn] = *yyp; |
1070 | | yyn++; |
1071 | | break; |
1072 | | |
1073 | | case '"': |
1074 | | if (yyres) |
1075 | | yyres[yyn] = '\0'; |
1076 | | return yyn; |
1077 | | } |
1078 | | do_not_strip_quotes: ; |
1079 | | } |
1080 | | |
1081 | | if (yyres) |
1082 | | return yystpcpy (yyres, yystr) - yyres; |
1083 | | else |
1084 | | return yystrlen (yystr); |
1085 | | } |
1086 | | # endif |
1087 | | |
1088 | | /* Copy into *YYMSG, which is of size *YYMSG_ALLOC, an error message |
1089 | | about the unexpected token YYTOKEN for the state stack whose top is |
1090 | | YYSSP. |
1091 | | |
1092 | | Return 0 if *YYMSG was successfully written. Return 1 if *YYMSG is |
1093 | | not large enough to hold the message. In that case, also set |
1094 | | *YYMSG_ALLOC to the required number of bytes. Return 2 if the |
1095 | | required number of bytes is too large to store. */ |
1096 | | static int |
1097 | | yysyntax_error (YYPTRDIFF_T *yymsg_alloc, char **yymsg, |
1098 | | yy_state_t *yyssp, int yytoken) |
1099 | | { |
1100 | | enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; |
1101 | | /* Internationalized format string. */ |
1102 | | const char *yyformat = YY_NULLPTR; |
1103 | | /* Arguments of yyformat: reported tokens (one for the "unexpected", |
1104 | | one per "expected"). */ |
1105 | | char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; |
1106 | | /* Actual size of YYARG. */ |
1107 | | int yycount = 0; |
1108 | | /* Cumulated lengths of YYARG. */ |
1109 | | YYPTRDIFF_T yysize = 0; |
1110 | | |
1111 | | /* There are many possibilities here to consider: |
1112 | | - If this state is a consistent state with a default action, then |
1113 | | the only way this function was invoked is if the default action |
1114 | | is an error action. In that case, don't check for expected |
1115 | | tokens because there are none. |
1116 | | - The only way there can be no lookahead present (in yychar) is if |
1117 | | this state is a consistent state with a default action. Thus, |
1118 | | detecting the absence of a lookahead is sufficient to determine |
1119 | | that there is no unexpected or expected token to report. In that |
1120 | | case, just report a simple "syntax error". |
1121 | | - Don't assume there isn't a lookahead just because this state is a |
1122 | | consistent state with a default action. There might have been a |
1123 | | previous inconsistent state, consistent state with a non-default |
1124 | | action, or user semantic action that manipulated yychar. |
1125 | | - Of course, the expected token list depends on states to have |
1126 | | correct lookahead information, and it depends on the parser not |
1127 | | to perform extra reductions after fetching a lookahead from the |
1128 | | scanner and before detecting a syntax error. Thus, state merging |
1129 | | (from LALR or IELR) and default reductions corrupt the expected |
1130 | | token list. However, the list is correct for canonical LR with |
1131 | | one exception: it will still contain any token that will not be |
1132 | | accepted due to an error action in a later state. |
1133 | | */ |
1134 | | if (yytoken != YYEMPTY) |
1135 | | { |
1136 | | int yyn = yypact[+*yyssp]; |
1137 | | YYPTRDIFF_T yysize0 = yytnamerr (YY_NULLPTR, yytname[yytoken]); |
1138 | | yysize = yysize0; |
1139 | | yyarg[yycount++] = yytname[yytoken]; |
1140 | | if (!yypact_value_is_default (yyn)) |
1141 | | { |
1142 | | /* Start YYX at -YYN if negative to avoid negative indexes in |
1143 | | YYCHECK. In other words, skip the first -YYN actions for |
1144 | | this state because they are default actions. */ |
1145 | | int yyxbegin = yyn < 0 ? -yyn : 0; |
1146 | | /* Stay within bounds of both yycheck and yytname. */ |
1147 | | int yychecklim = YYLAST - yyn + 1; |
1148 | | int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; |
1149 | | int yyx; |
1150 | | |
1151 | | for (yyx = yyxbegin; yyx < yyxend; ++yyx) |
1152 | | if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR |
1153 | | && !yytable_value_is_error (yytable[yyx + yyn])) |
1154 | | { |
1155 | | if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM) |
1156 | | { |
1157 | | yycount = 1; |
1158 | | yysize = yysize0; |
1159 | | break; |
1160 | | } |
1161 | | yyarg[yycount++] = yytname[yyx]; |
1162 | | { |
1163 | | YYPTRDIFF_T yysize1 |
1164 | | = yysize + yytnamerr (YY_NULLPTR, yytname[yyx]); |
1165 | | if (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM) |
1166 | | yysize = yysize1; |
1167 | | else |
1168 | | return 2; |
1169 | | } |
1170 | | } |
1171 | | } |
1172 | | } |
1173 | | |
1174 | | switch (yycount) |
1175 | | { |
1176 | | # define YYCASE_(N, S) \ |
1177 | | case N: \ |
1178 | | yyformat = S; \ |
1179 | | break |
1180 | | default: /* Avoid compiler warnings. */ |
1181 | | YYCASE_(0, YY_("syntax error")); |
1182 | | YYCASE_(1, YY_("syntax error, unexpected %s")); |
1183 | | YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s")); |
1184 | | YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s")); |
1185 | | YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s")); |
1186 | | YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s")); |
1187 | | # undef YYCASE_ |
1188 | | } |
1189 | | |
1190 | | { |
1191 | | /* Don't count the "%s"s in the final size, but reserve room for |
1192 | | the terminator. */ |
1193 | | YYPTRDIFF_T yysize1 = yysize + (yystrlen (yyformat) - 2 * yycount) + 1; |
1194 | | if (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM) |
1195 | | yysize = yysize1; |
1196 | | else |
1197 | | return 2; |
1198 | | } |
1199 | | |
1200 | | if (*yymsg_alloc < yysize) |
1201 | | { |
1202 | | *yymsg_alloc = 2 * yysize; |
1203 | | if (! (yysize <= *yymsg_alloc |
1204 | | && *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM)) |
1205 | | *yymsg_alloc = YYSTACK_ALLOC_MAXIMUM; |
1206 | | return 1; |
1207 | | } |
1208 | | |
1209 | | /* Avoid sprintf, as that infringes on the user's name space. |
1210 | | Don't have undefined behavior even if the translation |
1211 | | produced a string with the wrong number of "%s"s. */ |
1212 | | { |
1213 | | char *yyp = *yymsg; |
1214 | | int yyi = 0; |
1215 | | while ((*yyp = *yyformat) != '\0') |
1216 | | if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount) |
1217 | | { |
1218 | | yyp += yytnamerr (yyp, yyarg[yyi++]); |
1219 | | yyformat += 2; |
1220 | | } |
1221 | | else |
1222 | | { |
1223 | | ++yyp; |
1224 | | ++yyformat; |
1225 | | } |
1226 | | } |
1227 | | return 0; |
1228 | | } |
1229 | | #endif /* YYERROR_VERBOSE */ |
1230 | | |
1231 | | /*-----------------------------------------------. |
1232 | | | Release the memory associated to this symbol. | |
1233 | | `-----------------------------------------------*/ |
1234 | | |
1235 | | static void |
1236 | | yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep) |
1237 | 239k | { |
1238 | 239k | YYUSE (yyvaluep); |
1239 | 239k | if (!yymsg) |
1240 | 0 | yymsg = "Deleting"; |
1241 | 239k | YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp); |
1242 | | |
1243 | 239k | YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN |
1244 | 239k | YYUSE (yytype); |
1245 | 239k | YY_IGNORE_MAYBE_UNINITIALIZED_END |
1246 | 239k | } |
1247 | | |
1248 | | |
1249 | | |
1250 | | |
1251 | | /* The lookahead symbol. */ |
1252 | | int yychar; |
1253 | | |
1254 | | /* The semantic value of the lookahead symbol. */ |
1255 | | YYSTYPE yylval; |
1256 | | /* Number of syntax errors so far. */ |
1257 | | int yynerrs; |
1258 | | |
1259 | | |
1260 | | /*----------. |
1261 | | | yyparse. | |
1262 | | `----------*/ |
1263 | | |
1264 | | int |
1265 | | yyparse (void) |
1266 | 1.89k | { |
1267 | 1.89k | yy_state_fast_t yystate; |
1268 | | /* Number of tokens to shift before error messages enabled. */ |
1269 | 1.89k | int yyerrstatus; |
1270 | | |
1271 | | /* The stacks and their tools: |
1272 | | 'yyss': related to states. |
1273 | | 'yyvs': related to semantic values. |
1274 | | |
1275 | | Refer to the stacks through separate pointers, to allow yyoverflow |
1276 | | to reallocate them elsewhere. */ |
1277 | | |
1278 | | /* The state stack. */ |
1279 | 1.89k | yy_state_t yyssa[YYINITDEPTH]; |
1280 | 1.89k | yy_state_t *yyss; |
1281 | 1.89k | yy_state_t *yyssp; |
1282 | | |
1283 | | /* The semantic value stack. */ |
1284 | 1.89k | YYSTYPE yyvsa[YYINITDEPTH]; |
1285 | 1.89k | YYSTYPE *yyvs; |
1286 | 1.89k | YYSTYPE *yyvsp; |
1287 | | |
1288 | 1.89k | YYPTRDIFF_T yystacksize; |
1289 | | |
1290 | 1.89k | int yyn; |
1291 | 1.89k | int yyresult; |
1292 | | /* Lookahead token as an internal (translated) token number. */ |
1293 | 1.89k | int yytoken = 0; |
1294 | | /* The variables used to return semantic value and location from the |
1295 | | action routines. */ |
1296 | 1.89k | YYSTYPE yyval; |
1297 | | |
1298 | | #if YYERROR_VERBOSE |
1299 | | /* Buffer for error messages, and its allocated size. */ |
1300 | | char yymsgbuf[128]; |
1301 | | char *yymsg = yymsgbuf; |
1302 | | YYPTRDIFF_T yymsg_alloc = sizeof yymsgbuf; |
1303 | | #endif |
1304 | | |
1305 | 246k | #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N)) |
1306 | | |
1307 | | /* The number of symbols on the RHS of the reduced rule. |
1308 | | Keep to zero when no symbol should be popped. */ |
1309 | 1.89k | int yylen = 0; |
1310 | | |
1311 | 1.89k | yyssp = yyss = yyssa; |
1312 | 1.89k | yyvsp = yyvs = yyvsa; |
1313 | 1.89k | yystacksize = YYINITDEPTH; |
1314 | | |
1315 | 1.89k | YYDPRINTF ((stderr, "Starting parse\n")); |
1316 | | |
1317 | 1.89k | yystate = 0; |
1318 | 1.89k | yyerrstatus = 0; |
1319 | 1.89k | yynerrs = 0; |
1320 | 1.89k | yychar = YYEMPTY; /* Cause a token to be read. */ |
1321 | 1.89k | goto yysetstate; |
1322 | | |
1323 | | |
1324 | | /*------------------------------------------------------------. |
1325 | | | yynewstate -- push a new state, which is found in yystate. | |
1326 | | `------------------------------------------------------------*/ |
1327 | 339k | yynewstate: |
1328 | | /* In all cases, when you get here, the value and location stacks |
1329 | | have just been pushed. So pushing a state here evens the stacks. */ |
1330 | 339k | yyssp++; |
1331 | | |
1332 | | |
1333 | | /*--------------------------------------------------------------------. |
1334 | | | yysetstate -- set current state (the top of the stack) to yystate. | |
1335 | | `--------------------------------------------------------------------*/ |
1336 | 341k | yysetstate: |
1337 | 341k | YYDPRINTF ((stderr, "Entering state %d\n", yystate)); |
1338 | 341k | YY_ASSERT (0 <= yystate && yystate < YYNSTATES); |
1339 | 341k | YY_IGNORE_USELESS_CAST_BEGIN |
1340 | 341k | *yyssp = YY_CAST (yy_state_t, yystate); |
1341 | 341k | YY_IGNORE_USELESS_CAST_END |
1342 | | |
1343 | 341k | if (yyss + yystacksize - 1 <= yyssp) |
1344 | | #if !defined yyoverflow && !defined YYSTACK_RELOCATE |
1345 | | goto yyexhaustedlab; |
1346 | | #else |
1347 | 42 | { |
1348 | | /* Get the current used size of the three stacks, in elements. */ |
1349 | 42 | YYPTRDIFF_T yysize = yyssp - yyss + 1; |
1350 | | |
1351 | | # if defined yyoverflow |
1352 | | { |
1353 | | /* Give user a chance to reallocate the stack. Use copies of |
1354 | | these so that the &'s don't force the real ones into |
1355 | | memory. */ |
1356 | | yy_state_t *yyss1 = yyss; |
1357 | | YYSTYPE *yyvs1 = yyvs; |
1358 | | |
1359 | | /* Each stack pointer address is followed by the size of the |
1360 | | data in use in that stack, in bytes. This used to be a |
1361 | | conditional around just the two extra args, but that might |
1362 | | be undefined if yyoverflow is a macro. */ |
1363 | | yyoverflow (YY_("memory exhausted"), |
1364 | | &yyss1, yysize * YYSIZEOF (*yyssp), |
1365 | | &yyvs1, yysize * YYSIZEOF (*yyvsp), |
1366 | | &yystacksize); |
1367 | | yyss = yyss1; |
1368 | | yyvs = yyvs1; |
1369 | | } |
1370 | | # else /* defined YYSTACK_RELOCATE */ |
1371 | | /* Extend the stack our own way. */ |
1372 | 42 | if (YYMAXDEPTH <= yystacksize) |
1373 | 3 | goto yyexhaustedlab; |
1374 | 39 | yystacksize *= 2; |
1375 | 39 | if (YYMAXDEPTH < yystacksize) |
1376 | 4 | yystacksize = YYMAXDEPTH; |
1377 | | |
1378 | 39 | { |
1379 | 39 | yy_state_t *yyss1 = yyss; |
1380 | 39 | union yyalloc *yyptr = |
1381 | 39 | YY_CAST (union yyalloc *, |
1382 | 39 | YYSTACK_ALLOC (YY_CAST (YYSIZE_T, YYSTACK_BYTES (yystacksize)))); |
1383 | 39 | if (! yyptr) |
1384 | 0 | goto yyexhaustedlab; |
1385 | 39 | YYSTACK_RELOCATE (yyss_alloc, yyss); |
1386 | 39 | YYSTACK_RELOCATE (yyvs_alloc, yyvs); |
1387 | 39 | # undef YYSTACK_RELOCATE |
1388 | 39 | if (yyss1 != yyssa) |
1389 | 30 | YYSTACK_FREE (yyss1); |
1390 | 39 | } |
1391 | 0 | # endif |
1392 | | |
1393 | 0 | yyssp = yyss + yysize - 1; |
1394 | 39 | yyvsp = yyvs + yysize - 1; |
1395 | | |
1396 | 39 | YY_IGNORE_USELESS_CAST_BEGIN |
1397 | 39 | YYDPRINTF ((stderr, "Stack size increased to %ld\n", |
1398 | 39 | YY_CAST (long, yystacksize))); |
1399 | 39 | YY_IGNORE_USELESS_CAST_END |
1400 | | |
1401 | 39 | if (yyss + yystacksize - 1 <= yyssp) |
1402 | 0 | YYABORT; |
1403 | 39 | } |
1404 | 341k | #endif /* !defined yyoverflow && !defined YYSTACK_RELOCATE */ |
1405 | | |
1406 | 341k | if (yystate == YYFINAL) |
1407 | 863 | YYACCEPT; |
1408 | | |
1409 | 340k | goto yybackup; |
1410 | | |
1411 | | |
1412 | | /*-----------. |
1413 | | | yybackup. | |
1414 | | `-----------*/ |
1415 | 340k | yybackup: |
1416 | | /* Do appropriate processing given the current state. Read a |
1417 | | lookahead token if we need one and don't already have one. */ |
1418 | | |
1419 | | /* First try to decide what to do without reference to lookahead token. */ |
1420 | 340k | yyn = yypact[yystate]; |
1421 | 340k | if (yypact_value_is_default (yyn)) |
1422 | 93.4k | goto yydefault; |
1423 | | |
1424 | | /* Not known => get a lookahead token if don't already have one. */ |
1425 | | |
1426 | | /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */ |
1427 | 246k | if (yychar == YYEMPTY) |
1428 | 220k | { |
1429 | 220k | YYDPRINTF ((stderr, "Reading a token: ")); |
1430 | 220k | yychar = yylex (); |
1431 | 220k | } |
1432 | | |
1433 | 246k | if (yychar <= YYEOF) |
1434 | 4.59k | { |
1435 | 4.59k | yychar = yytoken = YYEOF; |
1436 | 4.59k | YYDPRINTF ((stderr, "Now at end of input.\n")); |
1437 | 4.59k | } |
1438 | 242k | else |
1439 | 242k | { |
1440 | 242k | yytoken = YYTRANSLATE (yychar); |
1441 | 242k | YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc); |
1442 | 242k | } |
1443 | | |
1444 | | /* If the proper action on seeing token YYTOKEN is to reduce or to |
1445 | | detect an error, take that action. */ |
1446 | 246k | yyn += yytoken; |
1447 | 246k | if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken) |
1448 | 119k | goto yydefault; |
1449 | 127k | yyn = yytable[yyn]; |
1450 | 127k | if (yyn <= 0) |
1451 | 6.00k | { |
1452 | 6.00k | if (yytable_value_is_error (yyn)) |
1453 | 0 | goto yyerrlab; |
1454 | 6.00k | yyn = -yyn; |
1455 | 6.00k | goto yyreduce; |
1456 | 6.00k | } |
1457 | | |
1458 | | /* Count tokens shifted since error; after three, turn off error |
1459 | | status. */ |
1460 | 121k | if (yyerrstatus) |
1461 | 21.6k | yyerrstatus--; |
1462 | | |
1463 | | /* Shift the lookahead token. */ |
1464 | 121k | YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); |
1465 | 121k | yystate = yyn; |
1466 | 121k | YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN |
1467 | 121k | *++yyvsp = yylval; |
1468 | 121k | YY_IGNORE_MAYBE_UNINITIALIZED_END |
1469 | | |
1470 | | /* Discard the shifted token. */ |
1471 | 121k | yychar = YYEMPTY; |
1472 | 121k | goto yynewstate; |
1473 | | |
1474 | | |
1475 | | /*-----------------------------------------------------------. |
1476 | | | yydefault -- do the default action for the current state. | |
1477 | | `-----------------------------------------------------------*/ |
1478 | 213k | yydefault: |
1479 | 213k | yyn = yydefact[yystate]; |
1480 | 213k | if (yyn == 0) |
1481 | 115k | goto yyerrlab; |
1482 | 97.9k | goto yyreduce; |
1483 | | |
1484 | | |
1485 | | /*-----------------------------. |
1486 | | | yyreduce -- do a reduction. | |
1487 | | `-----------------------------*/ |
1488 | 103k | yyreduce: |
1489 | | /* yyn is the number of a rule to reduce with. */ |
1490 | 103k | yylen = yyr2[yyn]; |
1491 | | |
1492 | | /* If YYLEN is nonzero, implement the default value of the action: |
1493 | | '$$ = $1'. |
1494 | | |
1495 | | Otherwise, the following line sets YYVAL to garbage. |
1496 | | This behavior is undocumented and Bison |
1497 | | users should not rely upon it. Assigning to YYVAL |
1498 | | unconditionally makes the parser a bit smaller, and it avoids a |
1499 | | GCC warning that YYVAL may be used uninitialized. */ |
1500 | 103k | yyval = yyvsp[1-yylen]; |
1501 | | |
1502 | | |
1503 | 103k | YY_REDUCE_PRINT (yyn); |
1504 | 103k | switch (yyn) |
1505 | 103k | { |
1506 | 1.89k | case 3: |
1507 | 1.89k | #line 140 "cue_parser.y" |
1508 | 1.89k | { |
1509 | 1.89k | cd = cd_init(); |
1510 | 1.89k | cdtext = cd_get_cdtext(cd); |
1511 | 1.89k | rem = cd_get_rem(cd); |
1512 | 1.89k | } |
1513 | 1.89k | #line 1514 "/work/cue_parser.c" |
1514 | 1.89k | break; |
1515 | | |
1516 | 353 | case 6: |
1517 | 353 | #line 153 "cue_parser.y" |
1518 | 353 | { cd_set_catalog(cd, (yyvsp[-1].sval)); } |
1519 | 353 | #line 1520 "/work/cue_parser.c" |
1520 | 353 | break; |
1521 | | |
1522 | 287 | case 7: |
1523 | 287 | #line 154 "cue_parser.y" |
1524 | 287 | { cd_set_cdtextfile(cd, (yyvsp[-1].sval)); } |
1525 | 287 | #line 1526 "/work/cue_parser.c" |
1526 | 287 | break; |
1527 | | |
1528 | 1.34k | case 12: |
1529 | 1.34k | #line 162 "cue_parser.y" |
1530 | 1.34k | { |
1531 | 1.34k | if (NULL != new_filename) { |
1532 | 699 | yyerror("too many files specified\n"); |
1533 | 699 | } |
1534 | 1.34k | if (track && track_get_index(track, 1) == -1) { |
1535 | 306 | track_set_filename (track, (yyvsp[-2].sval)); |
1536 | 1.03k | } else { |
1537 | 1.03k | new_filename = strncpy(fnamebuf, (yyvsp[-2].sval), sizeof(fnamebuf)); |
1538 | 1.03k | new_filename[sizeof(fnamebuf) - 1] = '\0'; |
1539 | 1.03k | } |
1540 | 1.34k | } |
1541 | 1.34k | #line 1542 "/work/cue_parser.c" |
1542 | 1.34k | break; |
1543 | | |
1544 | 4.26k | case 22: |
1545 | 4.26k | #line 194 "cue_parser.y" |
1546 | 4.26k | { |
1547 | | /* save previous track, to later set length */ |
1548 | 4.26k | prev_track = track; |
1549 | | |
1550 | 4.26k | track = cd_add_track(cd); |
1551 | 4.26k | if (prev_track == track) |
1552 | 493 | prev_track = NULL; |
1553 | 4.26k | cdtext = track_get_cdtext(track); |
1554 | 4.26k | rem = track_get_rem(track); |
1555 | | |
1556 | 4.26k | cur_filename = new_filename; |
1557 | 4.26k | if (NULL != cur_filename) |
1558 | 230 | prev_filename = cur_filename; |
1559 | | |
1560 | 4.26k | if (NULL == prev_filename) |
1561 | 3.44k | yyerror("no file specified for track"); |
1562 | 826 | else |
1563 | 826 | track_set_filename(track, prev_filename); |
1564 | | |
1565 | 4.26k | new_filename = NULL; |
1566 | 4.26k | } |
1567 | 4.26k | #line 1568 "/work/cue_parser.c" |
1568 | 4.26k | break; |
1569 | | |
1570 | 1.49k | case 23: |
1571 | 1.49k | #line 218 "cue_parser.y" |
1572 | 1.49k | { |
1573 | 1.49k | track_set_mode(track, (yyvsp[-1].ival)); |
1574 | 1.49k | } |
1575 | 1.49k | #line 1576 "/work/cue_parser.c" |
1576 | 1.49k | break; |
1577 | | |
1578 | 194 | case 37: |
1579 | 194 | #line 243 "cue_parser.y" |
1580 | 194 | { track_set_isrc(track, (yyvsp[-1].sval)); } |
1581 | 194 | #line 1582 "/work/cue_parser.c" |
1582 | 194 | break; |
1583 | | |
1584 | 1.66k | case 38: |
1585 | 1.66k | #line 244 "cue_parser.y" |
1586 | 1.66k | { track_set_zero_pre(track, (yyvsp[-1].ival)); } |
1587 | 1.66k | #line 1588 "/work/cue_parser.c" |
1588 | 1.66k | break; |
1589 | | |
1590 | 3.52k | case 39: |
1591 | 3.52k | #line 245 "cue_parser.y" |
1592 | 3.52k | { |
1593 | 3.52k | long prev_length; |
1594 | | |
1595 | | /* Set previous track length if it has not been set */ |
1596 | 3.52k | if (NULL != prev_track && NULL == cur_filename |
1597 | 1.56k | && track_get_length (prev_track) == -1) { |
1598 | | /* track shares file with previous track */ |
1599 | 447 | prev_length = (yyvsp[-1].ival) - track_get_start(prev_track); |
1600 | 447 | track_set_length(prev_track, prev_length); |
1601 | 447 | } |
1602 | | |
1603 | 3.52k | if (1 == (yyvsp[-2].ival)) { |
1604 | | /* INDEX 01 */ |
1605 | 1.75k | track_set_start(track, (yyvsp[-1].ival)); |
1606 | | |
1607 | 1.75k | long idx00 = track_get_index (track, 0); |
1608 | | |
1609 | 1.75k | if (idx00 != -1 && (yyvsp[-1].ival) != 0) |
1610 | 554 | track_set_zero_pre (track, (yyvsp[-1].ival) - idx00); |
1611 | 1.75k | } |
1612 | | |
1613 | 3.52k | track_set_index (track, (yyvsp[-2].ival), (yyvsp[-1].ival)); |
1614 | 3.52k | } |
1615 | 3.52k | #line 1616 "/work/cue_parser.c" |
1616 | 3.52k | break; |
1617 | | |
1618 | 194 | case 40: |
1619 | 194 | #line 268 "cue_parser.y" |
1620 | 194 | { track_set_zero_post(track, (yyvsp[-1].ival)); } |
1621 | 194 | #line 1622 "/work/cue_parser.c" |
1622 | 194 | break; |
1623 | | |
1624 | 620 | case 44: |
1625 | 620 | #line 275 "cue_parser.y" |
1626 | 620 | { track_set_flag(track, (yyvsp[0].ival)); } |
1627 | 620 | #line 1628 "/work/cue_parser.c" |
1628 | 620 | break; |
1629 | | |
1630 | 3.62k | case 49: |
1631 | 3.62k | #line 286 "cue_parser.y" |
1632 | 3.62k | { cdtext_set ((yyvsp[-2].ival), (yyvsp[-1].sval), cdtext); } |
1633 | 3.62k | #line 1634 "/work/cue_parser.c" |
1634 | 3.62k | break; |
1635 | | |
1636 | 1.79k | case 64: |
1637 | 1.79k | #line 307 "cue_parser.y" |
1638 | 1.79k | { (yyval.ival) = time_msf_to_frame((yyvsp[-4].ival), (yyvsp[-2].ival), (yyvsp[0].ival)); } |
1639 | 1.79k | #line 1640 "/work/cue_parser.c" |
1640 | 1.79k | break; |
1641 | | |
1642 | 198 | case 65: |
1643 | 198 | #line 311 "cue_parser.y" |
1644 | 198 | { rem_set((yyvsp[-2].ival), (yyvsp[-1].sval), rem); } |
1645 | 198 | #line 1646 "/work/cue_parser.c" |
1646 | 198 | break; |
1647 | | |
1648 | 195 | case 66: |
1649 | 195 | #line 312 "cue_parser.y" |
1650 | 195 | { cdtext_set((yyvsp[-2].ival), (yyvsp[-1].sval), cdtext); } |
1651 | 195 | #line 1652 "/work/cue_parser.c" |
1652 | 195 | break; |
1653 | | |
1654 | | |
1655 | 0 | #line 1656 "/work/cue_parser.c" |
1656 | | |
1657 | 82.2k | default: break; |
1658 | 103k | } |
1659 | | /* User semantic actions sometimes alter yychar, and that requires |
1660 | | that yytoken be updated with the new translation. We take the |
1661 | | approach of translating immediately before every use of yytoken. |
1662 | | One alternative is translating here after every semantic action, |
1663 | | but that translation would be missed if the semantic action invokes |
1664 | | YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or |
1665 | | if it invokes YYBACKUP. In the case of YYABORT or YYACCEPT, an |
1666 | | incorrect destructor might then be invoked immediately. In the |
1667 | | case of YYERROR or YYBACKUP, subsequent parser actions might lead |
1668 | | to an incorrect destructor call or verbose syntax error message |
1669 | | before the lookahead is translated. */ |
1670 | 103k | YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); |
1671 | | |
1672 | 103k | YYPOPSTACK (yylen); |
1673 | 103k | yylen = 0; |
1674 | 103k | YY_STACK_PRINT (yyss, yyssp); |
1675 | | |
1676 | 103k | *++yyvsp = yyval; |
1677 | | |
1678 | | /* Now 'shift' the result of the reduction. Determine what state |
1679 | | that goes to, based on the state we popped back to and the rule |
1680 | | number reduced by. */ |
1681 | 103k | { |
1682 | 103k | const int yylhs = yyr1[yyn] - YYNTOKENS; |
1683 | 103k | const int yyi = yypgoto[yylhs] + *yyssp; |
1684 | 103k | yystate = (0 <= yyi && yyi <= YYLAST && yycheck[yyi] == *yyssp |
1685 | 103k | ? yytable[yyi] |
1686 | 103k | : yydefgoto[yylhs]); |
1687 | 103k | } |
1688 | | |
1689 | 103k | goto yynewstate; |
1690 | | |
1691 | | |
1692 | | /*--------------------------------------. |
1693 | | | yyerrlab -- here on detecting error. | |
1694 | | `--------------------------------------*/ |
1695 | 115k | yyerrlab: |
1696 | | /* Make sure we have latest lookahead translation. See comments at |
1697 | | user semantic actions for why this is necessary. */ |
1698 | 115k | yytoken = yychar == YYEMPTY ? YYEMPTY : YYTRANSLATE (yychar); |
1699 | | |
1700 | | /* If not already recovering from an error, report this error. */ |
1701 | 115k | if (!yyerrstatus) |
1702 | 2.87k | { |
1703 | 2.87k | ++yynerrs; |
1704 | 2.87k | #if ! YYERROR_VERBOSE |
1705 | 2.87k | yyerror (YY_("syntax error")); |
1706 | | #else |
1707 | | # define YYSYNTAX_ERROR yysyntax_error (&yymsg_alloc, &yymsg, \ |
1708 | | yyssp, yytoken) |
1709 | | { |
1710 | | char const *yymsgp = YY_("syntax error"); |
1711 | | int yysyntax_error_status; |
1712 | | yysyntax_error_status = YYSYNTAX_ERROR; |
1713 | | if (yysyntax_error_status == 0) |
1714 | | yymsgp = yymsg; |
1715 | | else if (yysyntax_error_status == 1) |
1716 | | { |
1717 | | if (yymsg != yymsgbuf) |
1718 | | YYSTACK_FREE (yymsg); |
1719 | | yymsg = YY_CAST (char *, YYSTACK_ALLOC (YY_CAST (YYSIZE_T, yymsg_alloc))); |
1720 | | if (!yymsg) |
1721 | | { |
1722 | | yymsg = yymsgbuf; |
1723 | | yymsg_alloc = sizeof yymsgbuf; |
1724 | | yysyntax_error_status = 2; |
1725 | | } |
1726 | | else |
1727 | | { |
1728 | | yysyntax_error_status = YYSYNTAX_ERROR; |
1729 | | yymsgp = yymsg; |
1730 | | } |
1731 | | } |
1732 | | yyerror (yymsgp); |
1733 | | if (yysyntax_error_status == 2) |
1734 | | goto yyexhaustedlab; |
1735 | | } |
1736 | | # undef YYSYNTAX_ERROR |
1737 | | #endif |
1738 | 2.87k | } |
1739 | | |
1740 | | |
1741 | | |
1742 | 115k | if (yyerrstatus == 3) |
1743 | 98.8k | { |
1744 | | /* If just tried and failed to reuse lookahead token after an |
1745 | | error, discard it. */ |
1746 | | |
1747 | 98.8k | if (yychar <= YYEOF) |
1748 | 1.01k | { |
1749 | | /* Return failure if at end of input. */ |
1750 | 1.01k | if (yychar == YYEOF) |
1751 | 1.01k | YYABORT; |
1752 | 1.01k | } |
1753 | 97.8k | else |
1754 | 97.8k | { |
1755 | 97.8k | yydestruct ("Error: discarding", |
1756 | 97.8k | yytoken, &yylval); |
1757 | 97.8k | yychar = YYEMPTY; |
1758 | 97.8k | } |
1759 | 98.8k | } |
1760 | | |
1761 | | /* Else will try to reuse lookahead token after shifting the error |
1762 | | token. */ |
1763 | 114k | goto yyerrlab1; |
1764 | | |
1765 | | |
1766 | | /*---------------------------------------------------. |
1767 | | | yyerrorlab -- error raised explicitly by YYERROR. | |
1768 | | `---------------------------------------------------*/ |
1769 | 114k | yyerrorlab: |
1770 | | /* Pacify compilers when the user code never invokes YYERROR and the |
1771 | | label yyerrorlab therefore never appears in user code. */ |
1772 | 0 | if (0) |
1773 | 0 | YYERROR; |
1774 | | |
1775 | | /* Do not reclaim the symbols of the rule whose action triggered |
1776 | | this YYERROR. */ |
1777 | 0 | YYPOPSTACK (yylen); |
1778 | 0 | yylen = 0; |
1779 | 0 | YY_STACK_PRINT (yyss, yyssp); |
1780 | 0 | yystate = *yyssp; |
1781 | 0 | goto yyerrlab1; |
1782 | | |
1783 | | |
1784 | | /*-------------------------------------------------------------. |
1785 | | | yyerrlab1 -- common code for both syntax error and YYERROR. | |
1786 | | `-------------------------------------------------------------*/ |
1787 | 114k | yyerrlab1: |
1788 | 114k | yyerrstatus = 3; /* Each real token shifted decrements this. */ |
1789 | | |
1790 | 114k | for (;;) |
1791 | 220k | { |
1792 | 220k | yyn = yypact[yystate]; |
1793 | 220k | if (!yypact_value_is_default (yyn)) |
1794 | 220k | { |
1795 | 220k | yyn += YYTERROR; |
1796 | 220k | if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) |
1797 | 114k | { |
1798 | 114k | yyn = yytable[yyn]; |
1799 | 114k | if (0 < yyn) |
1800 | 114k | break; |
1801 | 114k | } |
1802 | 220k | } |
1803 | | |
1804 | | /* Pop the current state because it cannot handle the error token. */ |
1805 | 106k | if (yyssp == yyss) |
1806 | 18 | YYABORT; |
1807 | | |
1808 | | |
1809 | 105k | yydestruct ("Error: popping", |
1810 | 105k | yystos[yystate], yyvsp); |
1811 | 105k | YYPOPSTACK (1); |
1812 | 105k | yystate = *yyssp; |
1813 | 105k | YY_STACK_PRINT (yyss, yyssp); |
1814 | 105k | } |
1815 | | |
1816 | 114k | YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN |
1817 | 114k | *++yyvsp = yylval; |
1818 | 114k | YY_IGNORE_MAYBE_UNINITIALIZED_END |
1819 | | |
1820 | | |
1821 | | /* Shift the error token. */ |
1822 | 114k | YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp); |
1823 | | |
1824 | 114k | yystate = yyn; |
1825 | 114k | goto yynewstate; |
1826 | | |
1827 | | |
1828 | | /*-------------------------------------. |
1829 | | | yyacceptlab -- YYACCEPT comes here. | |
1830 | | `-------------------------------------*/ |
1831 | 863 | yyacceptlab: |
1832 | 863 | yyresult = 0; |
1833 | 863 | goto yyreturn; |
1834 | | |
1835 | | |
1836 | | /*-----------------------------------. |
1837 | | | yyabortlab -- YYABORT comes here. | |
1838 | | `-----------------------------------*/ |
1839 | 1.03k | yyabortlab: |
1840 | 1.03k | yyresult = 1; |
1841 | 1.03k | goto yyreturn; |
1842 | | |
1843 | | |
1844 | 0 | #if !defined yyoverflow || YYERROR_VERBOSE |
1845 | | /*-------------------------------------------------. |
1846 | | | yyexhaustedlab -- memory exhaustion comes here. | |
1847 | | `-------------------------------------------------*/ |
1848 | 3 | yyexhaustedlab: |
1849 | 3 | yyerror (YY_("memory exhausted")); |
1850 | 3 | yyresult = 2; |
1851 | | /* Fall through. */ |
1852 | 3 | #endif |
1853 | | |
1854 | | |
1855 | | /*-----------------------------------------------------. |
1856 | | | yyreturn -- parsing is finished, return the result. | |
1857 | | `-----------------------------------------------------*/ |
1858 | 1.89k | yyreturn: |
1859 | 1.89k | if (yychar != YYEMPTY) |
1860 | 1.03k | { |
1861 | | /* Make sure we have latest lookahead translation. See comments at |
1862 | | user semantic actions for why this is necessary. */ |
1863 | 1.03k | yytoken = YYTRANSLATE (yychar); |
1864 | 1.03k | yydestruct ("Cleanup: discarding lookahead", |
1865 | 1.03k | yytoken, &yylval); |
1866 | 1.03k | } |
1867 | | /* Do not reclaim the symbols of the rule whose action triggered |
1868 | | this YYABORT or YYACCEPT. */ |
1869 | 1.89k | YYPOPSTACK (yylen); |
1870 | 1.89k | YY_STACK_PRINT (yyss, yyssp); |
1871 | 36.6k | while (yyssp != yyss) |
1872 | 34.7k | { |
1873 | 34.7k | yydestruct ("Cleanup: popping", |
1874 | 34.7k | yystos[+*yyssp], yyvsp); |
1875 | 34.7k | YYPOPSTACK (1); |
1876 | 34.7k | } |
1877 | 1.89k | #ifndef yyoverflow |
1878 | 1.89k | if (yyss != yyssa) |
1879 | 9 | YYSTACK_FREE (yyss); |
1880 | 1.89k | #endif |
1881 | | #if YYERROR_VERBOSE |
1882 | | if (yymsg != yymsgbuf) |
1883 | | YYSTACK_FREE (yymsg); |
1884 | | #endif |
1885 | 1.89k | return yyresult; |
1886 | 3 | } |
1887 | | #line 330 "cue_parser.y" |
1888 | | |
1889 | | |
1890 | | /* lexer interface */ |
1891 | | |
1892 | | void yyerror (const char *s) |
1893 | 7.02k | { |
1894 | 7.02k | fprintf(stderr, "%d: %s\n", yylineno, s); |
1895 | 7.02k | } |
1896 | | |
1897 | | static void reset_static_vars() |
1898 | 1.89k | { |
1899 | 1.89k | cd = NULL; |
1900 | 1.89k | track = NULL; |
1901 | 1.89k | prev_track = NULL; |
1902 | 1.89k | cdtext = NULL; |
1903 | 1.89k | rem = NULL; |
1904 | 1.89k | prev_filename = NULL; |
1905 | 1.89k | cur_filename = NULL; |
1906 | 1.89k | new_filename = NULL; |
1907 | 1.89k | } |
1908 | | |
1909 | | Cd *cue_parse_file(FILE *fp) |
1910 | 0 | { |
1911 | 0 | YY_BUFFER_STATE buffer = NULL; |
1912 | |
|
1913 | 0 | yyin = fp; |
1914 | |
|
1915 | 0 | buffer = yy_create_buffer(yyin, YY_BUF_SIZE); |
1916 | |
|
1917 | 0 | yy_switch_to_buffer(buffer); |
1918 | |
|
1919 | 0 | Cd *ret_cd = NULL; |
1920 | |
|
1921 | 0 | yylineno = 1; |
1922 | 0 | if (0 == yyparse()) ret_cd = cd; |
1923 | 0 | else |
1924 | 0 | { |
1925 | 0 | ret_cd = NULL; |
1926 | 0 | cd_delete(cd); |
1927 | 0 | } |
1928 | |
|
1929 | 0 | yy_delete_buffer(buffer); |
1930 | 0 | reset_static_vars(); |
1931 | |
|
1932 | 0 | return ret_cd; |
1933 | 0 | } |
1934 | | |
1935 | | Cd *cue_parse_string(const char* string) |
1936 | 1.89k | { |
1937 | 1.89k | YY_BUFFER_STATE buffer = NULL; |
1938 | | |
1939 | 1.89k | buffer = yy_scan_string(string); |
1940 | | |
1941 | 1.89k | Cd *ret_cd = NULL; |
1942 | | |
1943 | 1.89k | yylineno = 1; |
1944 | 1.89k | if (0 == yyparse()) ret_cd = cd; |
1945 | 1.03k | else |
1946 | 1.03k | { |
1947 | 1.03k | ret_cd = NULL; |
1948 | 1.03k | cd_delete(cd); |
1949 | 1.03k | } |
1950 | | |
1951 | 1.89k | yy_delete_buffer(buffer); |
1952 | 1.89k | reset_static_vars(); |
1953 | | |
1954 | 1.89k | return ret_cd; |
1955 | 1.89k | } |