Line | Count | Source |
1 | | /* A Bison parser, made by GNU Bison 3.8.2. */ |
2 | | |
3 | | /* Bison implementation for Yacc-like parsers in C |
4 | | |
5 | | Copyright (C) 1984, 1989-1990, 2000-2015, 2018-2021 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 <https://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 | | /* DO NOT RELY ON FEATURES THAT ARE NOT DOCUMENTED in the manual, |
38 | | especially those whose name start with YY_ or yy_. They are |
39 | | private implementation details that can be changed or removed. */ |
40 | | |
41 | | /* All symbols defined below should begin with yy or YY, to avoid |
42 | | infringing on user name space. This should be done even for local |
43 | | variables, as they might otherwise be expanded by user macros. |
44 | | There are some unavoidable exceptions within include files to |
45 | | define necessary library symbols; they are noted "INFRINGES ON |
46 | | USER NAME SPACE" below. */ |
47 | | |
48 | | /* Identify Bison output, and Bison version. */ |
49 | | #define YYBISON 30802 |
50 | | |
51 | | /* Bison version string. */ |
52 | | #define YYBISON_VERSION "3.8.2" |
53 | | |
54 | | /* Skeleton name. */ |
55 | | #define YYSKELETON_NAME "yacc.c" |
56 | | |
57 | | /* Pure parsers. */ |
58 | | #define YYPURE 1 |
59 | | |
60 | | /* Push parsers. */ |
61 | | #define YYPUSH 0 |
62 | | |
63 | | /* Pull parsers. */ |
64 | | #define YYPULL 1 |
65 | | |
66 | | |
67 | | |
68 | | |
69 | | /* First part of user prologue. */ |
70 | | #line 1 "cue_parser.y" |
71 | | |
72 | | /* |
73 | | * Copyright (c) 2004, 2005, 2006, 2007, Svend Sorensen |
74 | | * Copyright (c) 2009, 2010 Jochen Keil |
75 | | * For license terms, see the file COPYING in this distribution. |
76 | | */ |
77 | | |
78 | | #include <limits.h> |
79 | | #include <stdlib.h> |
80 | | #include <stdio.h> |
81 | | #include <string.h> |
82 | | |
83 | | #include "cd.h" |
84 | | #include "cue_time.h" |
85 | | #include "cue_parser_state.h" |
86 | | |
87 | | /* keep the generated symbols out of the global yy* namespace */ |
88 | | #define yyparse cue_yyparse |
89 | 677k | #define yylex cue_yylex |
90 | | |
91 | | static void yyerror(void *scanner, struct cue_parser_state *st, const char *s); |
92 | | static long msf_to_frame(long m, long s, long f); |
93 | | static void copy_filename(char *dst, const char *src); |
94 | | static void use_new_file_for_track(struct cue_parser_state *st); |
95 | | |
96 | | #line 97 "/work/cue_parser.c" |
97 | | |
98 | | # ifndef YY_CAST |
99 | | # ifdef __cplusplus |
100 | | # define YY_CAST(Type, Val) static_cast<Type> (Val) |
101 | | # define YY_REINTERPRET_CAST(Type, Val) reinterpret_cast<Type> (Val) |
102 | | # else |
103 | 3.96M | # define YY_CAST(Type, Val) ((Type) (Val)) |
104 | | # define YY_REINTERPRET_CAST(Type, Val) ((Type) (Val)) |
105 | | # endif |
106 | | # endif |
107 | | # ifndef YY_NULLPTR |
108 | | # if defined __cplusplus |
109 | | # if 201103L <= __cplusplus |
110 | | # define YY_NULLPTR nullptr |
111 | | # else |
112 | | # define YY_NULLPTR 0 |
113 | | # endif |
114 | | # else |
115 | | # define YY_NULLPTR ((void*)0) |
116 | | # endif |
117 | | # endif |
118 | | |
119 | | #include "cue_parser.h" |
120 | | /* Symbol kind. */ |
121 | | enum yysymbol_kind_t |
122 | | { |
123 | | YYSYMBOL_YYEMPTY = -2, |
124 | | YYSYMBOL_YYEOF = 0, /* "end of file" */ |
125 | | YYSYMBOL_YYerror = 1, /* error */ |
126 | | YYSYMBOL_YYUNDEF = 2, /* "invalid token" */ |
127 | | YYSYMBOL_NUMBER = 3, /* NUMBER */ |
128 | | YYSYMBOL_STRING = 4, /* STRING */ |
129 | | YYSYMBOL_CATALOG = 5, /* CATALOG */ |
130 | | YYSYMBOL_CDTEXTFILE = 6, /* CDTEXTFILE */ |
131 | | YYSYMBOL_FFILE = 7, /* FFILE */ |
132 | | YYSYMBOL_BINARY = 8, /* BINARY */ |
133 | | YYSYMBOL_MOTOROLA = 9, /* MOTOROLA */ |
134 | | YYSYMBOL_AIFF = 10, /* AIFF */ |
135 | | YYSYMBOL_WAVE = 11, /* WAVE */ |
136 | | YYSYMBOL_MP3 = 12, /* MP3 */ |
137 | | YYSYMBOL_FLAC = 13, /* FLAC */ |
138 | | YYSYMBOL_TRACK = 14, /* TRACK */ |
139 | | YYSYMBOL_AUDIO = 15, /* AUDIO */ |
140 | | YYSYMBOL_MODE1_2048 = 16, /* MODE1_2048 */ |
141 | | YYSYMBOL_MODE1_2352 = 17, /* MODE1_2352 */ |
142 | | YYSYMBOL_MODE2_2336 = 18, /* MODE2_2336 */ |
143 | | YYSYMBOL_MODE2_2048 = 19, /* MODE2_2048 */ |
144 | | YYSYMBOL_MODE2_2342 = 20, /* MODE2_2342 */ |
145 | | YYSYMBOL_MODE2_2332 = 21, /* MODE2_2332 */ |
146 | | YYSYMBOL_MODE2_2352 = 22, /* MODE2_2352 */ |
147 | | YYSYMBOL_TRACK_ISRC = 23, /* TRACK_ISRC */ |
148 | | YYSYMBOL_FLAGS = 24, /* FLAGS */ |
149 | | YYSYMBOL_PRE = 25, /* PRE */ |
150 | | YYSYMBOL_DCP = 26, /* DCP */ |
151 | | YYSYMBOL_FOUR_CH = 27, /* FOUR_CH */ |
152 | | YYSYMBOL_SCMS = 28, /* SCMS */ |
153 | | YYSYMBOL_PREGAP = 29, /* PREGAP */ |
154 | | YYSYMBOL_INDEX = 30, /* INDEX */ |
155 | | YYSYMBOL_POSTGAP = 31, /* POSTGAP */ |
156 | | YYSYMBOL_TITLE = 32, /* TITLE */ |
157 | | YYSYMBOL_PERFORMER = 33, /* PERFORMER */ |
158 | | YYSYMBOL_SONGWRITER = 34, /* SONGWRITER */ |
159 | | YYSYMBOL_COMPOSER = 35, /* COMPOSER */ |
160 | | YYSYMBOL_ARRANGER = 36, /* ARRANGER */ |
161 | | YYSYMBOL_MESSAGE = 37, /* MESSAGE */ |
162 | | YYSYMBOL_DISC_ID = 38, /* DISC_ID */ |
163 | | YYSYMBOL_GENRE = 39, /* GENRE */ |
164 | | YYSYMBOL_TOC_INFO1 = 40, /* TOC_INFO1 */ |
165 | | YYSYMBOL_TOC_INFO2 = 41, /* TOC_INFO2 */ |
166 | | YYSYMBOL_UPC_EAN = 42, /* UPC_EAN */ |
167 | | YYSYMBOL_ISRC = 43, /* ISRC */ |
168 | | YYSYMBOL_SIZE_INFO = 44, /* SIZE_INFO */ |
169 | | YYSYMBOL_DATE = 45, /* DATE */ |
170 | | YYSYMBOL_XXX_GENRE = 46, /* XXX_GENRE */ |
171 | | YYSYMBOL_XXX_DISCID = 47, /* XXX_DISCID */ |
172 | | YYSYMBOL_XXX_COMPOSER = 48, /* XXX_COMPOSER */ |
173 | | YYSYMBOL_REPLAYGAIN_ALBUM_GAIN = 49, /* REPLAYGAIN_ALBUM_GAIN */ |
174 | | YYSYMBOL_REPLAYGAIN_ALBUM_PEAK = 50, /* REPLAYGAIN_ALBUM_PEAK */ |
175 | | YYSYMBOL_REPLAYGAIN_TRACK_GAIN = 51, /* REPLAYGAIN_TRACK_GAIN */ |
176 | | YYSYMBOL_REPLAYGAIN_TRACK_PEAK = 52, /* REPLAYGAIN_TRACK_PEAK */ |
177 | | YYSYMBOL_COMMENT = 53, /* COMMENT */ |
178 | | YYSYMBOL_DISCNUMBER = 54, /* DISCNUMBER */ |
179 | | YYSYMBOL_TOTALDISCS = 55, /* TOTALDISCS */ |
180 | | YYSYMBOL_56_n_ = 56, /* '\n' */ |
181 | | YYSYMBOL_57_ = 57, /* ':' */ |
182 | | YYSYMBOL_YYACCEPT = 58, /* $accept */ |
183 | | YYSYMBOL_cuefile = 59, /* cuefile */ |
184 | | YYSYMBOL_new_cd = 60, /* new_cd */ |
185 | | YYSYMBOL_global_statements = 61, /* global_statements */ |
186 | | YYSYMBOL_global_statement = 62, /* global_statement */ |
187 | | YYSYMBOL_track_data = 63, /* track_data */ |
188 | | YYSYMBOL_track_list = 64, /* track_list */ |
189 | | YYSYMBOL_track = 65, /* track */ |
190 | | YYSYMBOL_file_format = 66, /* file_format */ |
191 | | YYSYMBOL_new_track = 67, /* new_track */ |
192 | | YYSYMBOL_track_def = 68, /* track_def */ |
193 | | YYSYMBOL_track_mode = 69, /* track_mode */ |
194 | | YYSYMBOL_track_statements = 70, /* track_statements */ |
195 | | YYSYMBOL_track_statement = 71, /* track_statement */ |
196 | | YYSYMBOL_track_flags = 72, /* track_flags */ |
197 | | YYSYMBOL_track_flag = 73, /* track_flag */ |
198 | | YYSYMBOL_cdtext = 74, /* cdtext */ |
199 | | YYSYMBOL_cdtext_item = 75, /* cdtext_item */ |
200 | | YYSYMBOL_time = 76, /* time */ |
201 | | YYSYMBOL_rem = 77, /* rem */ |
202 | | YYSYMBOL_rem_item = 78 /* rem_item */ |
203 | | }; |
204 | | typedef enum yysymbol_kind_t yysymbol_kind_t; |
205 | | |
206 | | |
207 | | /* Second part of user prologue. */ |
208 | | #line 39 "cue_parser.y" |
209 | | |
210 | | int cue_yylex(YYSTYPE *yylval_param, void *yyscanner); |
211 | | |
212 | | #line 213 "/work/cue_parser.c" |
213 | | |
214 | | |
215 | | #ifdef short |
216 | | # undef short |
217 | | #endif |
218 | | |
219 | | /* On compilers that do not define __PTRDIFF_MAX__ etc., make sure |
220 | | <limits.h> and (if available) <stdint.h> are included |
221 | | so that the code can choose integer types of a good width. */ |
222 | | |
223 | | #ifndef __PTRDIFF_MAX__ |
224 | | # include <limits.h> /* INFRINGES ON USER NAME SPACE */ |
225 | | # if defined __STDC_VERSION__ && 199901 <= __STDC_VERSION__ |
226 | | # include <stdint.h> /* INFRINGES ON USER NAME SPACE */ |
227 | | # define YY_STDINT_H |
228 | | # endif |
229 | | #endif |
230 | | |
231 | | /* Narrow types that promote to a signed type and that can represent a |
232 | | signed or unsigned integer of at least N bits. In tables they can |
233 | | save space and decrease cache pressure. Promoting to a signed type |
234 | | helps avoid bugs in integer arithmetic. */ |
235 | | |
236 | | #ifdef __INT_LEAST8_MAX__ |
237 | | typedef __INT_LEAST8_TYPE__ yytype_int8; |
238 | | #elif defined YY_STDINT_H |
239 | | typedef int_least8_t yytype_int8; |
240 | | #else |
241 | | typedef signed char yytype_int8; |
242 | | #endif |
243 | | |
244 | | #ifdef __INT_LEAST16_MAX__ |
245 | | typedef __INT_LEAST16_TYPE__ yytype_int16; |
246 | | #elif defined YY_STDINT_H |
247 | | typedef int_least16_t yytype_int16; |
248 | | #else |
249 | | typedef short yytype_int16; |
250 | | #endif |
251 | | |
252 | | /* Work around bug in HP-UX 11.23, which defines these macros |
253 | | incorrectly for preprocessor constants. This workaround can likely |
254 | | be removed in 2023, as HPE has promised support for HP-UX 11.23 |
255 | | (aka HP-UX 11i v2) only through the end of 2022; see Table 2 of |
256 | | <https://h20195.www2.hpe.com/V2/getpdf.aspx/4AA4-7673ENW.pdf>. */ |
257 | | #ifdef __hpux |
258 | | # undef UINT_LEAST8_MAX |
259 | | # undef UINT_LEAST16_MAX |
260 | | # define UINT_LEAST8_MAX 255 |
261 | | # define UINT_LEAST16_MAX 65535 |
262 | | #endif |
263 | | |
264 | | #if defined __UINT_LEAST8_MAX__ && __UINT_LEAST8_MAX__ <= __INT_MAX__ |
265 | | typedef __UINT_LEAST8_TYPE__ yytype_uint8; |
266 | | #elif (!defined __UINT_LEAST8_MAX__ && defined YY_STDINT_H \ |
267 | | && UINT_LEAST8_MAX <= INT_MAX) |
268 | | typedef uint_least8_t yytype_uint8; |
269 | | #elif !defined __UINT_LEAST8_MAX__ && UCHAR_MAX <= INT_MAX |
270 | | typedef unsigned char yytype_uint8; |
271 | | #else |
272 | | typedef short yytype_uint8; |
273 | | #endif |
274 | | |
275 | | #if defined __UINT_LEAST16_MAX__ && __UINT_LEAST16_MAX__ <= __INT_MAX__ |
276 | | typedef __UINT_LEAST16_TYPE__ yytype_uint16; |
277 | | #elif (!defined __UINT_LEAST16_MAX__ && defined YY_STDINT_H \ |
278 | | && UINT_LEAST16_MAX <= INT_MAX) |
279 | | typedef uint_least16_t yytype_uint16; |
280 | | #elif !defined __UINT_LEAST16_MAX__ && USHRT_MAX <= INT_MAX |
281 | | typedef unsigned short yytype_uint16; |
282 | | #else |
283 | | typedef int yytype_uint16; |
284 | | #endif |
285 | | |
286 | | #ifndef YYPTRDIFF_T |
287 | | # if defined __PTRDIFF_TYPE__ && defined __PTRDIFF_MAX__ |
288 | 2.38k | # define YYPTRDIFF_T __PTRDIFF_TYPE__ |
289 | | # define YYPTRDIFF_MAXIMUM __PTRDIFF_MAX__ |
290 | | # elif defined PTRDIFF_MAX |
291 | | # ifndef ptrdiff_t |
292 | | # include <stddef.h> /* INFRINGES ON USER NAME SPACE */ |
293 | | # endif |
294 | | # define YYPTRDIFF_T ptrdiff_t |
295 | | # define YYPTRDIFF_MAXIMUM PTRDIFF_MAX |
296 | | # else |
297 | | # define YYPTRDIFF_T long |
298 | | # define YYPTRDIFF_MAXIMUM LONG_MAX |
299 | | # endif |
300 | | #endif |
301 | | |
302 | | #ifndef YYSIZE_T |
303 | | # ifdef __SIZE_TYPE__ |
304 | | # define YYSIZE_T __SIZE_TYPE__ |
305 | | # elif defined size_t |
306 | | # define YYSIZE_T size_t |
307 | | # elif defined __STDC_VERSION__ && 199901 <= __STDC_VERSION__ |
308 | | # include <stddef.h> /* INFRINGES ON USER NAME SPACE */ |
309 | | # define YYSIZE_T size_t |
310 | | # else |
311 | | # define YYSIZE_T unsigned |
312 | | # endif |
313 | | #endif |
314 | | |
315 | | #define YYSIZE_MAXIMUM \ |
316 | | YY_CAST (YYPTRDIFF_T, \ |
317 | | (YYPTRDIFF_MAXIMUM < YY_CAST (YYSIZE_T, -1) \ |
318 | | ? YYPTRDIFF_MAXIMUM \ |
319 | | : YY_CAST (YYSIZE_T, -1))) |
320 | | |
321 | 0 | #define YYSIZEOF(X) YY_CAST (YYPTRDIFF_T, sizeof (X)) |
322 | | |
323 | | |
324 | | /* Stored state numbers (used for stacks). */ |
325 | | typedef yytype_int8 yy_state_t; |
326 | | |
327 | | /* State numbers in computations. */ |
328 | | typedef int yy_state_fast_t; |
329 | | |
330 | | #ifndef YY_ |
331 | | # if defined YYENABLE_NLS && YYENABLE_NLS |
332 | | # if ENABLE_NLS |
333 | | # include <libintl.h> /* INFRINGES ON USER NAME SPACE */ |
334 | | # define YY_(Msgid) dgettext ("bison-runtime", Msgid) |
335 | | # endif |
336 | | # endif |
337 | | # ifndef YY_ |
338 | 3.16k | # define YY_(Msgid) Msgid |
339 | | # endif |
340 | | #endif |
341 | | |
342 | | |
343 | | #ifndef YY_ATTRIBUTE_PURE |
344 | | # if defined __GNUC__ && 2 < __GNUC__ + (96 <= __GNUC_MINOR__) |
345 | | # define YY_ATTRIBUTE_PURE __attribute__ ((__pure__)) |
346 | | # else |
347 | | # define YY_ATTRIBUTE_PURE |
348 | | # endif |
349 | | #endif |
350 | | |
351 | | #ifndef YY_ATTRIBUTE_UNUSED |
352 | | # if defined __GNUC__ && 2 < __GNUC__ + (7 <= __GNUC_MINOR__) |
353 | | # define YY_ATTRIBUTE_UNUSED __attribute__ ((__unused__)) |
354 | | # else |
355 | | # define YY_ATTRIBUTE_UNUSED |
356 | | # endif |
357 | | #endif |
358 | | |
359 | | /* Suppress unused-variable warnings by "using" E. */ |
360 | | #if ! defined lint || defined __GNUC__ |
361 | 2.84M | # define YY_USE(E) ((void) (E)) |
362 | | #else |
363 | | # define YY_USE(E) /* empty */ |
364 | | #endif |
365 | | |
366 | | /* Suppress an incorrect diagnostic about yylval being uninitialized. */ |
367 | | #if defined __GNUC__ && ! defined __ICC && 406 <= __GNUC__ * 100 + __GNUC_MINOR__ |
368 | | # if __GNUC__ * 100 + __GNUC_MINOR__ < 407 |
369 | | # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \ |
370 | | _Pragma ("GCC diagnostic push") \ |
371 | | _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"") |
372 | | # else |
373 | | # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \ |
374 | | _Pragma ("GCC diagnostic push") \ |
375 | | _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"") \ |
376 | | _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"") |
377 | | # endif |
378 | | # define YY_IGNORE_MAYBE_UNINITIALIZED_END \ |
379 | | _Pragma ("GCC diagnostic pop") |
380 | | #else |
381 | 4.77k | # define YY_INITIAL_VALUE(Value) Value |
382 | | #endif |
383 | | #ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN |
384 | | # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN |
385 | | # define YY_IGNORE_MAYBE_UNINITIALIZED_END |
386 | | #endif |
387 | | #ifndef YY_INITIAL_VALUE |
388 | | # define YY_INITIAL_VALUE(Value) /* Nothing. */ |
389 | | #endif |
390 | | |
391 | | #if defined __cplusplus && defined __GNUC__ && ! defined __ICC && 6 <= __GNUC__ |
392 | | # define YY_IGNORE_USELESS_CAST_BEGIN \ |
393 | | _Pragma ("GCC diagnostic push") \ |
394 | | _Pragma ("GCC diagnostic ignored \"-Wuseless-cast\"") |
395 | | # define YY_IGNORE_USELESS_CAST_END \ |
396 | | _Pragma ("GCC diagnostic pop") |
397 | | #endif |
398 | | #ifndef YY_IGNORE_USELESS_CAST_BEGIN |
399 | | # define YY_IGNORE_USELESS_CAST_BEGIN |
400 | | # define YY_IGNORE_USELESS_CAST_END |
401 | | #endif |
402 | | |
403 | | |
404 | 1.78M | #define YY_ASSERT(E) ((void) (0 && (E))) |
405 | | |
406 | | #if !defined yyoverflow |
407 | | |
408 | | /* The parser invokes alloca or malloc; define the necessary symbols. */ |
409 | | |
410 | | # ifdef YYSTACK_USE_ALLOCA |
411 | | # if YYSTACK_USE_ALLOCA |
412 | | # ifdef __GNUC__ |
413 | | # define YYSTACK_ALLOC __builtin_alloca |
414 | | # elif defined __BUILTIN_VA_ARG_INCR |
415 | | # include <alloca.h> /* INFRINGES ON USER NAME SPACE */ |
416 | | # elif defined _AIX |
417 | | # define YYSTACK_ALLOC __alloca |
418 | | # elif defined _MSC_VER |
419 | | # include <malloc.h> /* INFRINGES ON USER NAME SPACE */ |
420 | | # define alloca _alloca |
421 | | # else |
422 | | # define YYSTACK_ALLOC alloca |
423 | | # if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS |
424 | | # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ |
425 | | /* Use EXIT_SUCCESS as a witness for stdlib.h. */ |
426 | | # ifndef EXIT_SUCCESS |
427 | | # define EXIT_SUCCESS 0 |
428 | | # endif |
429 | | # endif |
430 | | # endif |
431 | | # endif |
432 | | # endif |
433 | | |
434 | | # ifdef YYSTACK_ALLOC |
435 | | /* Pacify GCC's 'empty if-body' warning. */ |
436 | | # define YYSTACK_FREE(Ptr) do { /* empty */; } while (0) |
437 | | # ifndef YYSTACK_ALLOC_MAXIMUM |
438 | | /* The OS might guarantee only one guard page at the bottom of the stack, |
439 | | and a page size can be as small as 4096 bytes. So we cannot safely |
440 | | invoke alloca (N) if N exceeds 4096. Use a slightly smaller number |
441 | | to allow for a few compiler-allocated temporary stack slots. */ |
442 | | # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */ |
443 | | # endif |
444 | | # else |
445 | | # define YYSTACK_ALLOC YYMALLOC |
446 | 0 | # define YYSTACK_FREE YYFREE |
447 | | # ifndef YYSTACK_ALLOC_MAXIMUM |
448 | | # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM |
449 | | # endif |
450 | | # if (defined __cplusplus && ! defined EXIT_SUCCESS \ |
451 | | && ! ((defined YYMALLOC || defined malloc) \ |
452 | | && (defined YYFREE || defined free))) |
453 | | # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ |
454 | | # ifndef EXIT_SUCCESS |
455 | | # define EXIT_SUCCESS 0 |
456 | | # endif |
457 | | # endif |
458 | | # ifndef YYMALLOC |
459 | | # define YYMALLOC malloc |
460 | | # if ! defined malloc && ! defined EXIT_SUCCESS |
461 | | void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */ |
462 | | # endif |
463 | | # endif |
464 | | # ifndef YYFREE |
465 | 0 | # define YYFREE free |
466 | | # if ! defined free && ! defined EXIT_SUCCESS |
467 | | void free (void *); /* INFRINGES ON USER NAME SPACE */ |
468 | | # endif |
469 | | # endif |
470 | | # endif |
471 | | #endif /* !defined yyoverflow */ |
472 | | |
473 | | #if (! defined yyoverflow \ |
474 | | && (! defined __cplusplus \ |
475 | | || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL))) |
476 | | |
477 | | /* A type that is properly aligned for any stack member. */ |
478 | | union yyalloc |
479 | | { |
480 | | yy_state_t yyss_alloc; |
481 | | YYSTYPE yyvs_alloc; |
482 | | }; |
483 | | |
484 | | /* The size of the maximum gap between one aligned stack and the next. */ |
485 | 0 | # define YYSTACK_GAP_MAXIMUM (YYSIZEOF (union yyalloc) - 1) |
486 | | |
487 | | /* The size of an array large to enough to hold all stacks, each with |
488 | | N elements. */ |
489 | | # define YYSTACK_BYTES(N) \ |
490 | | ((N) * (YYSIZEOF (yy_state_t) + YYSIZEOF (YYSTYPE)) \ |
491 | | + YYSTACK_GAP_MAXIMUM) |
492 | | |
493 | | # define YYCOPY_NEEDED 1 |
494 | | |
495 | | /* Relocate STACK from its old location to the new one. The |
496 | | local variables YYSIZE and YYSTACKSIZE give the old and new number of |
497 | | elements in the stack, and YYPTR gives the new location of the |
498 | | stack. Advance YYPTR to a properly aligned location for the next |
499 | | stack. */ |
500 | | # define YYSTACK_RELOCATE(Stack_alloc, Stack) \ |
501 | 0 | do \ |
502 | 0 | { \ |
503 | 0 | YYPTRDIFF_T yynewbytes; \ |
504 | 0 | YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \ |
505 | 0 | Stack = &yyptr->Stack_alloc; \ |
506 | 0 | yynewbytes = yystacksize * YYSIZEOF (*Stack) + YYSTACK_GAP_MAXIMUM; \ |
507 | 0 | yyptr += yynewbytes / YYSIZEOF (*yyptr); \ |
508 | 0 | } \ |
509 | 0 | while (0) |
510 | | |
511 | | #endif |
512 | | |
513 | | #if defined YYCOPY_NEEDED && YYCOPY_NEEDED |
514 | | /* Copy COUNT objects from SRC to DST. The source and destination do |
515 | | not overlap. */ |
516 | | # ifndef YYCOPY |
517 | | # if defined __GNUC__ && 1 < __GNUC__ |
518 | | # define YYCOPY(Dst, Src, Count) \ |
519 | 0 | __builtin_memcpy (Dst, Src, YY_CAST (YYSIZE_T, (Count)) * sizeof (*(Src))) |
520 | | # else |
521 | | # define YYCOPY(Dst, Src, Count) \ |
522 | | do \ |
523 | | { \ |
524 | | YYPTRDIFF_T yyi; \ |
525 | | for (yyi = 0; yyi < (Count); yyi++) \ |
526 | | (Dst)[yyi] = (Src)[yyi]; \ |
527 | | } \ |
528 | | while (0) |
529 | | # endif |
530 | | # endif |
531 | | #endif /* !YYCOPY_NEEDED */ |
532 | | |
533 | | /* YYFINAL -- State number of the termination state. */ |
534 | 1.78M | #define YYFINAL 3 |
535 | | /* YYLAST -- Last index in YYTABLE. */ |
536 | 3.82M | #define YYLAST 169 |
537 | | |
538 | | /* YYNTOKENS -- Number of terminals. */ |
539 | 844k | #define YYNTOKENS 58 |
540 | | /* YYNNTS -- Number of nonterminals. */ |
541 | | #define YYNNTS 21 |
542 | | /* YYNRULES -- Number of rules. */ |
543 | | #define YYNRULES 78 |
544 | | /* YYNSTATES -- Number of states. */ |
545 | | #define YYNSTATES 116 |
546 | | |
547 | | /* YYMAXUTOK -- Last valid token kind. */ |
548 | 1.56M | #define YYMAXUTOK 310 |
549 | | |
550 | | |
551 | | /* YYTRANSLATE(TOKEN-NUM) -- Symbol number corresponding to TOKEN-NUM |
552 | | as returned by yylex, with out-of-bounds checking. */ |
553 | | #define YYTRANSLATE(YYX) \ |
554 | 1.92M | (0 <= (YYX) && (YYX) <= YYMAXUTOK \ |
555 | 1.92M | ? YY_CAST (yysymbol_kind_t, yytranslate[YYX]) \ |
556 | 1.92M | : YYSYMBOL_YYUNDEF) |
557 | | |
558 | | /* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM |
559 | | as returned by yylex. */ |
560 | | static const yytype_int8 yytranslate[] = |
561 | | { |
562 | | 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
563 | | 56, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
564 | | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
565 | | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
566 | | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
567 | | 2, 2, 2, 2, 2, 2, 2, 2, 57, 2, |
568 | | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
569 | | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
570 | | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
571 | | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
572 | | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
573 | | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
574 | | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
575 | | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
576 | | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
577 | | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
578 | | 2, 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, 2, 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, 1, 2, 3, 4, |
588 | | 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, |
589 | | 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, |
590 | | 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, |
591 | | 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, |
592 | | 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, |
593 | | 55 |
594 | | }; |
595 | | |
596 | | #if YYDEBUG |
597 | | /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */ |
598 | | static const yytype_int16 yyrline[] = |
599 | | { |
600 | | 0, 119, 119, 128, 138, 139, 143, 144, 145, 146, |
601 | | 147, 148, 149, 153, 171, 172, 176, 180, 181, 182, |
602 | | 183, 184, 185, 189, 230, 236, 237, 238, 239, 240, |
603 | | 241, 242, 243, 247, 248, 252, 253, 254, 255, 256, |
604 | | 257, 294, 295, 296, 297, 301, 302, 306, 307, 308, |
605 | | 309, 313, 317, 318, 319, 320, 321, 322, 323, 324, |
606 | | 325, 326, 327, 328, 329, 333, 334, 338, 339, 340, |
607 | | 341, 345, 346, 347, 348, 349, 350, 351, 352 |
608 | | }; |
609 | | #endif |
610 | | |
611 | | /** Accessing symbol of state STATE. */ |
612 | 617k | #define YY_ACCESSING_SYMBOL(State) YY_CAST (yysymbol_kind_t, yystos[State]) |
613 | | |
614 | | #if YYDEBUG || 0 |
615 | | /* The user-facing name of the symbol whose (internal) number is |
616 | | YYSYMBOL. No bounds checking. */ |
617 | | static const char *yysymbol_name (yysymbol_kind_t yysymbol) YY_ATTRIBUTE_UNUSED; |
618 | | |
619 | | /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. |
620 | | First, the terminals, then, starting at YYNTOKENS, nonterminals. */ |
621 | | static const char *const yytname[] = |
622 | | { |
623 | | "\"end of file\"", "error", "\"invalid token\"", "NUMBER", "STRING", |
624 | | "CATALOG", "CDTEXTFILE", "FFILE", "BINARY", "MOTOROLA", "AIFF", "WAVE", |
625 | | "MP3", "FLAC", "TRACK", "AUDIO", "MODE1_2048", "MODE1_2352", |
626 | | "MODE2_2336", "MODE2_2048", "MODE2_2342", "MODE2_2332", "MODE2_2352", |
627 | | "TRACK_ISRC", "FLAGS", "PRE", "DCP", "FOUR_CH", "SCMS", "PREGAP", |
628 | | "INDEX", "POSTGAP", "TITLE", "PERFORMER", "SONGWRITER", "COMPOSER", |
629 | | "ARRANGER", "MESSAGE", "DISC_ID", "GENRE", "TOC_INFO1", "TOC_INFO2", |
630 | | "UPC_EAN", "ISRC", "SIZE_INFO", "DATE", "XXX_GENRE", "XXX_DISCID", |
631 | | "XXX_COMPOSER", "REPLAYGAIN_ALBUM_GAIN", "REPLAYGAIN_ALBUM_PEAK", |
632 | | "REPLAYGAIN_TRACK_GAIN", "REPLAYGAIN_TRACK_PEAK", "COMMENT", |
633 | | "DISCNUMBER", "TOTALDISCS", "'\\n'", "':'", "$accept", "cuefile", |
634 | | "new_cd", "global_statements", "global_statement", "track_data", |
635 | | "track_list", "track", "file_format", "new_track", "track_def", |
636 | | "track_mode", "track_statements", "track_statement", "track_flags", |
637 | | "track_flag", "cdtext", "cdtext_item", "time", "rem", "rem_item", YY_NULLPTR |
638 | | }; |
639 | | |
640 | | static const char * |
641 | | yysymbol_name (yysymbol_kind_t yysymbol) |
642 | | { |
643 | | return yytname[yysymbol]; |
644 | | } |
645 | | #endif |
646 | | |
647 | 2.75M | #define YYPACT_NINF (-72) |
648 | | |
649 | | #define yypact_value_is_default(Yyn) \ |
650 | 2.75M | ((Yyn) == YYPACT_NINF) |
651 | | |
652 | | #define YYTABLE_NINF (-24) |
653 | | |
654 | | #define yytable_value_is_error(Yyn) \ |
655 | 259k | 0 |
656 | | |
657 | | /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing |
658 | | STATE-NUM. */ |
659 | | static const yytype_int8 yypact[] = |
660 | | { |
661 | | -72, 3, -72, -72, 112, -52, 1, 2, 4, -72, |
662 | | -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, |
663 | | -72, -72, -72, 5, 6, 8, -72, -72, -72, -72, |
664 | | -72, -72, -72, -72, -72, -72, -3, -72, -1, -72, |
665 | | 17, -72, 18, -72, -31, -29, 7, -28, 16, 19, |
666 | | -72, 55, 56, 20, 21, -72, -72, -72, -72, -72, |
667 | | -72, -72, -72, 22, -72, -72, -72, 49, 25, 57, |
668 | | -72, 59, 70, 59, -72, -72, 0, -72, -72, -72, |
669 | | -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, |
670 | | -72, 26, -72, 27, 113, 58, 28, 59, 60, -72, |
671 | | -72, -72, -72, -72, -72, -72, -72, -72, 71, -72, |
672 | | 64, -72, 65, -72, 111, -72 |
673 | | }; |
674 | | |
675 | | /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM. |
676 | | Performed when YYTABLE does not specify something else to do. Zero |
677 | | means the default is an error. */ |
678 | | static const yytype_int8 yydefact[] = |
679 | | { |
680 | | 3, 0, 4, 1, 0, 0, 0, 0, 0, 52, |
681 | | 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, |
682 | | 63, 64, 71, 0, 0, 0, 72, 73, 74, 75, |
683 | | 76, 77, 78, 11, 5, 10, 2, 14, 0, 8, |
684 | | 0, 9, 0, 12, 0, 0, 0, 0, 0, 0, |
685 | | 15, 0, 0, 0, 0, 6, 7, 17, 18, 19, |
686 | | 20, 21, 22, 0, 68, 69, 70, 0, 0, 0, |
687 | | 45, 0, 0, 0, 43, 42, 0, 33, 35, 36, |
688 | | 51, 67, 13, 25, 26, 27, 28, 29, 30, 31, |
689 | | 32, 0, 44, 0, 0, 65, 0, 0, 0, 34, |
690 | | 24, 38, 47, 48, 49, 50, 37, 46, 0, 39, |
691 | | 0, 41, 0, 40, 0, 66 |
692 | | }; |
693 | | |
694 | | /* YYPGOTO[NTERM-NUM]. */ |
695 | | static const yytype_int8 yypgoto[] = |
696 | | { |
697 | | -72, -72, -72, -72, -72, 117, -72, 23, -72, -72, |
698 | | -72, -72, -72, -16, -72, -72, 119, -72, -71, 120, |
699 | | -72 |
700 | | }; |
701 | | |
702 | | /* YYDEFGOTO[NTERM-NUM]. */ |
703 | | static const yytype_int8 yydefgoto[] = |
704 | | { |
705 | | 0, 1, 2, 4, 34, 75, 36, 37, 63, 38, |
706 | | 52, 91, 76, 77, 94, 107, 78, 40, 96, 79, |
707 | | 42 |
708 | | }; |
709 | | |
710 | | /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If |
711 | | positive, shift that token. If negative, reduce the rule whose |
712 | | number is the opposite. If YYTABLE_NINF, syntax error. */ |
713 | | static const yytype_int8 yytable[] = |
714 | | { |
715 | | -16, 68, 98, 3, 43, 44, 45, 8, 46, 47, |
716 | | 48, -23, 49, 51, -16, 57, 58, 59, 60, 61, |
717 | | 62, 53, 54, 69, 70, 55, 110, 56, 64, 71, |
718 | | 72, 73, 9, 10, 11, 12, 13, 14, 15, 16, |
719 | | 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, |
720 | | 27, 28, 29, 30, 31, 32, 74, 68, 67, 50, |
721 | | 99, 93, 95, 8, 83, 84, 85, 86, 87, 88, |
722 | | 89, 90, 65, 97, 112, 66, 80, 81, 82, 69, |
723 | | 70, 92, 100, 101, 109, 71, 72, 73, 9, 10, |
724 | | 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, |
725 | | 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, |
726 | | 31, 32, 74, 5, 115, 108, 111, 6, 7, 8, |
727 | | 113, 35, 114, 39, 41, 0, -23, 0, 0, 0, |
728 | | 0, 0, 0, 0, 0, 0, 0, 0, 102, 103, |
729 | | 104, 105, 0, 0, 9, 10, 11, 12, 13, 14, |
730 | | 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, |
731 | | 25, 26, 27, 28, 29, 30, 31, 32, 33, 106 |
732 | | }; |
733 | | |
734 | | static const yytype_int8 yycheck[] = |
735 | | { |
736 | | 0, 1, 73, 0, 56, 4, 4, 7, 4, 4, |
737 | | 4, 14, 4, 14, 14, 8, 9, 10, 11, 12, |
738 | | 13, 4, 4, 23, 24, 56, 97, 56, 56, 29, |
739 | | 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, |
740 | | 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, |
741 | | 50, 51, 52, 53, 54, 55, 56, 1, 3, 36, |
742 | | 76, 4, 3, 7, 15, 16, 17, 18, 19, 20, |
743 | | 21, 22, 56, 3, 3, 56, 56, 56, 56, 23, |
744 | | 24, 56, 56, 56, 56, 29, 30, 31, 32, 33, |
745 | | 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, |
746 | | 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, |
747 | | 54, 55, 56, 1, 3, 57, 56, 5, 6, 7, |
748 | | 56, 4, 57, 4, 4, -1, 14, -1, -1, -1, |
749 | | -1, -1, -1, -1, -1, -1, -1, -1, 25, 26, |
750 | | 27, 28, -1, -1, 32, 33, 34, 35, 36, 37, |
751 | | 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, |
752 | | 48, 49, 50, 51, 52, 53, 54, 55, 56, 56 |
753 | | }; |
754 | | |
755 | | /* YYSTOS[STATE-NUM] -- The symbol kind of the accessing symbol of |
756 | | state STATE-NUM. */ |
757 | | static const yytype_int8 yystos[] = |
758 | | { |
759 | | 0, 59, 60, 0, 61, 1, 5, 6, 7, 32, |
760 | | 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, |
761 | | 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, |
762 | | 53, 54, 55, 56, 62, 63, 64, 65, 67, 74, |
763 | | 75, 77, 78, 56, 4, 4, 4, 4, 4, 4, |
764 | | 65, 14, 68, 4, 4, 56, 56, 8, 9, 10, |
765 | | 11, 12, 13, 66, 56, 56, 56, 3, 1, 23, |
766 | | 24, 29, 30, 31, 56, 63, 70, 71, 74, 77, |
767 | | 56, 56, 56, 15, 16, 17, 18, 19, 20, 21, |
768 | | 22, 69, 56, 4, 72, 3, 76, 3, 76, 71, |
769 | | 56, 56, 25, 26, 27, 28, 56, 73, 57, 56, |
770 | | 76, 56, 3, 56, 57, 3 |
771 | | }; |
772 | | |
773 | | /* YYR1[RULE-NUM] -- Symbol kind of the left-hand side of rule RULE-NUM. */ |
774 | | static const yytype_int8 yyr1[] = |
775 | | { |
776 | | 0, 58, 59, 60, 61, 61, 62, 62, 62, 62, |
777 | | 62, 62, 62, 63, 64, 64, 65, 66, 66, 66, |
778 | | 66, 66, 66, 67, 68, 69, 69, 69, 69, 69, |
779 | | 69, 69, 69, 70, 70, 71, 71, 71, 71, 71, |
780 | | 71, 71, 71, 71, 71, 72, 72, 73, 73, 73, |
781 | | 73, 74, 75, 75, 75, 75, 75, 75, 75, 75, |
782 | | 75, 75, 75, 75, 75, 76, 76, 77, 77, 77, |
783 | | 77, 78, 78, 78, 78, 78, 78, 78, 78 |
784 | | }; |
785 | | |
786 | | /* YYR2[RULE-NUM] -- Number of symbols on the right-hand side of rule RULE-NUM. */ |
787 | | static const yytype_int8 yyr2[] = |
788 | | { |
789 | | 0, 2, 3, 0, 0, 2, 3, 3, 1, 1, |
790 | | 1, 1, 2, 4, 1, 2, 3, 1, 1, 1, |
791 | | 1, 1, 1, 0, 4, 1, 1, 1, 1, 1, |
792 | | 1, 1, 1, 1, 2, 1, 1, 3, 3, 3, |
793 | | 4, 3, 1, 1, 2, 0, 2, 1, 1, 1, |
794 | | 1, 3, 1, 1, 1, 1, 1, 1, 1, 1, |
795 | | 1, 1, 1, 1, 1, 1, 5, 3, 3, 3, |
796 | | 3, 1, 1, 1, 1, 1, 1, 1, 1 |
797 | | }; |
798 | | |
799 | | |
800 | | enum { YYENOMEM = -2 }; |
801 | | |
802 | | #define yyerrok (yyerrstatus = 0) |
803 | | #define yyclearin (yychar = YYEMPTY) |
804 | | |
805 | 864 | #define YYACCEPT goto yyacceptlab |
806 | 1.52k | #define YYABORT goto yyabortlab |
807 | 0 | #define YYERROR goto yyerrorlab |
808 | 0 | #define YYNOMEM goto yyexhaustedlab |
809 | | |
810 | | |
811 | | #define YYRECOVERING() (!!yyerrstatus) |
812 | | |
813 | | #define YYBACKUP(Token, Value) \ |
814 | | do \ |
815 | | if (yychar == YYEMPTY) \ |
816 | | { \ |
817 | | yychar = (Token); \ |
818 | | yylval = (Value); \ |
819 | | YYPOPSTACK (yylen); \ |
820 | | yystate = *yyssp; \ |
821 | | goto yybackup; \ |
822 | | } \ |
823 | | else \ |
824 | | { \ |
825 | | yyerror (scanner, st, YY_("syntax error: cannot back up")); \ |
826 | | YYERROR; \ |
827 | | } \ |
828 | | while (0) |
829 | | |
830 | | /* Backward compatibility with an undocumented macro. |
831 | | Use YYerror or YYUNDEF. */ |
832 | | #define YYERRCODE YYUNDEF |
833 | | |
834 | | |
835 | | /* Enable debugging if requested. */ |
836 | | #if YYDEBUG |
837 | | |
838 | | # ifndef YYFPRINTF |
839 | | # include <stdio.h> /* INFRINGES ON USER NAME SPACE */ |
840 | | # define YYFPRINTF fprintf |
841 | | # endif |
842 | | |
843 | | # define YYDPRINTF(Args) \ |
844 | | do { \ |
845 | | if (yydebug) \ |
846 | | YYFPRINTF Args; \ |
847 | | } while (0) |
848 | | |
849 | | |
850 | | |
851 | | |
852 | | # define YY_SYMBOL_PRINT(Title, Kind, Value, Location) \ |
853 | | do { \ |
854 | | if (yydebug) \ |
855 | | { \ |
856 | | YYFPRINTF (stderr, "%s ", Title); \ |
857 | | yy_symbol_print (stderr, \ |
858 | | Kind, Value, scanner, st); \ |
859 | | YYFPRINTF (stderr, "\n"); \ |
860 | | } \ |
861 | | } while (0) |
862 | | |
863 | | |
864 | | /*-----------------------------------. |
865 | | | Print this symbol's value on YYO. | |
866 | | `-----------------------------------*/ |
867 | | |
868 | | static void |
869 | | yy_symbol_value_print (FILE *yyo, |
870 | | yysymbol_kind_t yykind, YYSTYPE const * const yyvaluep, void *scanner, struct cue_parser_state *st) |
871 | | { |
872 | | FILE *yyoutput = yyo; |
873 | | YY_USE (yyoutput); |
874 | | YY_USE (scanner); |
875 | | YY_USE (st); |
876 | | if (!yyvaluep) |
877 | | return; |
878 | | YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN |
879 | | YY_USE (yykind); |
880 | | YY_IGNORE_MAYBE_UNINITIALIZED_END |
881 | | } |
882 | | |
883 | | |
884 | | /*---------------------------. |
885 | | | Print this symbol on YYO. | |
886 | | `---------------------------*/ |
887 | | |
888 | | static void |
889 | | yy_symbol_print (FILE *yyo, |
890 | | yysymbol_kind_t yykind, YYSTYPE const * const yyvaluep, void *scanner, struct cue_parser_state *st) |
891 | | { |
892 | | YYFPRINTF (yyo, "%s %s (", |
893 | | yykind < YYNTOKENS ? "token" : "nterm", yysymbol_name (yykind)); |
894 | | |
895 | | yy_symbol_value_print (yyo, yykind, yyvaluep, scanner, st); |
896 | | YYFPRINTF (yyo, ")"); |
897 | | } |
898 | | |
899 | | /*------------------------------------------------------------------. |
900 | | | yy_stack_print -- Print the state stack from its BOTTOM up to its | |
901 | | | TOP (included). | |
902 | | `------------------------------------------------------------------*/ |
903 | | |
904 | | static void |
905 | | yy_stack_print (yy_state_t *yybottom, yy_state_t *yytop) |
906 | | { |
907 | | YYFPRINTF (stderr, "Stack now"); |
908 | | for (; yybottom <= yytop; yybottom++) |
909 | | { |
910 | | int yybot = *yybottom; |
911 | | YYFPRINTF (stderr, " %d", yybot); |
912 | | } |
913 | | YYFPRINTF (stderr, "\n"); |
914 | | } |
915 | | |
916 | | # define YY_STACK_PRINT(Bottom, Top) \ |
917 | | do { \ |
918 | | if (yydebug) \ |
919 | | yy_stack_print ((Bottom), (Top)); \ |
920 | | } while (0) |
921 | | |
922 | | |
923 | | /*------------------------------------------------. |
924 | | | Report that the YYRULE is going to be reduced. | |
925 | | `------------------------------------------------*/ |
926 | | |
927 | | static void |
928 | | yy_reduce_print (yy_state_t *yyssp, YYSTYPE *yyvsp, |
929 | | int yyrule, void *scanner, struct cue_parser_state *st) |
930 | | { |
931 | | int yylno = yyrline[yyrule]; |
932 | | int yynrhs = yyr2[yyrule]; |
933 | | int yyi; |
934 | | YYFPRINTF (stderr, "Reducing stack by rule %d (line %d):\n", |
935 | | yyrule - 1, yylno); |
936 | | /* The symbols being reduced. */ |
937 | | for (yyi = 0; yyi < yynrhs; yyi++) |
938 | | { |
939 | | YYFPRINTF (stderr, " $%d = ", yyi + 1); |
940 | | yy_symbol_print (stderr, |
941 | | YY_ACCESSING_SYMBOL (+yyssp[yyi + 1 - yynrhs]), |
942 | | &yyvsp[(yyi + 1) - (yynrhs)], scanner, st); |
943 | | YYFPRINTF (stderr, "\n"); |
944 | | } |
945 | | } |
946 | | |
947 | | # define YY_REDUCE_PRINT(Rule) \ |
948 | | do { \ |
949 | | if (yydebug) \ |
950 | | yy_reduce_print (yyssp, yyvsp, Rule, scanner, st); \ |
951 | | } while (0) |
952 | | |
953 | | /* Nonzero means print parse trace. It is left uninitialized so that |
954 | | multiple parsers can coexist. */ |
955 | | int yydebug; |
956 | | #else /* !YYDEBUG */ |
957 | 2.47M | # define YYDPRINTF(Args) ((void) 0) |
958 | | # define YY_SYMBOL_PRINT(Title, Kind, Value, Location) |
959 | | # define YY_STACK_PRINT(Bottom, Top) |
960 | | # define YY_REDUCE_PRINT(Rule) |
961 | | #endif /* !YYDEBUG */ |
962 | | |
963 | | |
964 | | /* YYINITDEPTH -- initial size of the parser's stacks. */ |
965 | | #ifndef YYINITDEPTH |
966 | 2.38k | # define YYINITDEPTH 200 |
967 | | #endif |
968 | | |
969 | | /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only |
970 | | if the built-in stack extension method is used). |
971 | | |
972 | | Do not make this value too large; the results are undefined if |
973 | | YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH) |
974 | | evaluated with infinite-precision integer arithmetic. */ |
975 | | |
976 | | #ifndef YYMAXDEPTH |
977 | 0 | # define YYMAXDEPTH 10000 |
978 | | #endif |
979 | | |
980 | | |
981 | | |
982 | | |
983 | | |
984 | | |
985 | | /*-----------------------------------------------. |
986 | | | Release the memory associated to this symbol. | |
987 | | `-----------------------------------------------*/ |
988 | | |
989 | | static void |
990 | | yydestruct (const char *yymsg, |
991 | | yysymbol_kind_t yykind, YYSTYPE *yyvaluep, void *scanner, struct cue_parser_state *st) |
992 | 712k | { |
993 | 712k | YY_USE (yyvaluep); |
994 | 712k | YY_USE (scanner); |
995 | 712k | YY_USE (st); |
996 | 712k | if (!yymsg) |
997 | 0 | yymsg = "Deleting"; |
998 | 712k | YY_SYMBOL_PRINT (yymsg, yykind, yyvaluep, yylocationp); |
999 | | |
1000 | 712k | YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN |
1001 | 712k | YY_USE (yykind); |
1002 | 712k | YY_IGNORE_MAYBE_UNINITIALIZED_END |
1003 | 712k | } |
1004 | | |
1005 | | |
1006 | | |
1007 | | |
1008 | | |
1009 | | |
1010 | | /*----------. |
1011 | | | yyparse. | |
1012 | | `----------*/ |
1013 | | |
1014 | | int |
1015 | | yyparse (void *scanner, struct cue_parser_state *st) |
1016 | 2.38k | { |
1017 | | /* Lookahead token kind. */ |
1018 | 2.38k | int yychar; |
1019 | | |
1020 | | |
1021 | | /* The semantic value of the lookahead symbol. */ |
1022 | | /* Default value used for initialization, for pacifying older GCCs |
1023 | | or non-GCC compilers. */ |
1024 | 2.38k | YY_INITIAL_VALUE (static YYSTYPE yyval_default;) |
1025 | 2.38k | YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); |
1026 | | |
1027 | | /* Number of syntax errors so far. */ |
1028 | 2.38k | int yynerrs = 0; |
1029 | | |
1030 | 2.38k | yy_state_fast_t yystate = 0; |
1031 | | /* Number of tokens to shift before error messages enabled. */ |
1032 | 2.38k | int yyerrstatus = 0; |
1033 | | |
1034 | | /* Refer to the stacks through separate pointers, to allow yyoverflow |
1035 | | to reallocate them elsewhere. */ |
1036 | | |
1037 | | /* Their size. */ |
1038 | 2.38k | YYPTRDIFF_T yystacksize = YYINITDEPTH; |
1039 | | |
1040 | | /* The state stack: array, bottom, top. */ |
1041 | 2.38k | yy_state_t yyssa[YYINITDEPTH]; |
1042 | 2.38k | yy_state_t *yyss = yyssa; |
1043 | 2.38k | yy_state_t *yyssp = yyss; |
1044 | | |
1045 | | /* The semantic value stack: array, bottom, top. */ |
1046 | 2.38k | YYSTYPE yyvsa[YYINITDEPTH]; |
1047 | 2.38k | YYSTYPE *yyvs = yyvsa; |
1048 | 2.38k | YYSTYPE *yyvsp = yyvs; |
1049 | | |
1050 | 2.38k | int yyn; |
1051 | | /* The return value of yyparse. */ |
1052 | 2.38k | int yyresult; |
1053 | | /* Lookahead symbol kind. */ |
1054 | 2.38k | yysymbol_kind_t yytoken = YYSYMBOL_YYEMPTY; |
1055 | | /* The variables used to return semantic value and location from the |
1056 | | action routines. */ |
1057 | 2.38k | YYSTYPE yyval; |
1058 | | |
1059 | | |
1060 | | |
1061 | 1.46M | #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N)) |
1062 | | |
1063 | | /* The number of symbols on the RHS of the reduced rule. |
1064 | | Keep to zero when no symbol should be popped. */ |
1065 | 2.38k | int yylen = 0; |
1066 | | |
1067 | 2.38k | YYDPRINTF ((stderr, "Starting parse\n")); |
1068 | | |
1069 | 2.38k | yychar = YYEMPTY; /* Cause a token to be read. */ |
1070 | | |
1071 | 2.38k | goto yysetstate; |
1072 | | |
1073 | | |
1074 | | /*------------------------------------------------------------. |
1075 | | | yynewstate -- push a new state, which is found in yystate. | |
1076 | | `------------------------------------------------------------*/ |
1077 | 1.78M | yynewstate: |
1078 | | /* In all cases, when you get here, the value and location stacks |
1079 | | have just been pushed. So pushing a state here evens the stacks. */ |
1080 | 1.78M | yyssp++; |
1081 | | |
1082 | | |
1083 | | /*--------------------------------------------------------------------. |
1084 | | | yysetstate -- set current state (the top of the stack) to yystate. | |
1085 | | `--------------------------------------------------------------------*/ |
1086 | 1.78M | yysetstate: |
1087 | 1.78M | YYDPRINTF ((stderr, "Entering state %d\n", yystate)); |
1088 | 1.78M | YY_ASSERT (0 <= yystate && yystate < YYNSTATES); |
1089 | 1.78M | YY_IGNORE_USELESS_CAST_BEGIN |
1090 | 1.78M | *yyssp = YY_CAST (yy_state_t, yystate); |
1091 | 1.78M | YY_IGNORE_USELESS_CAST_END |
1092 | 1.78M | YY_STACK_PRINT (yyss, yyssp); |
1093 | | |
1094 | 1.78M | if (yyss + yystacksize - 1 <= yyssp) |
1095 | | #if !defined yyoverflow && !defined YYSTACK_RELOCATE |
1096 | | YYNOMEM; |
1097 | | #else |
1098 | 0 | { |
1099 | | /* Get the current used size of the three stacks, in elements. */ |
1100 | 0 | YYPTRDIFF_T yysize = yyssp - yyss + 1; |
1101 | |
|
1102 | | # if defined yyoverflow |
1103 | | { |
1104 | | /* Give user a chance to reallocate the stack. Use copies of |
1105 | | these so that the &'s don't force the real ones into |
1106 | | memory. */ |
1107 | | yy_state_t *yyss1 = yyss; |
1108 | | YYSTYPE *yyvs1 = yyvs; |
1109 | | |
1110 | | /* Each stack pointer address is followed by the size of the |
1111 | | data in use in that stack, in bytes. This used to be a |
1112 | | conditional around just the two extra args, but that might |
1113 | | be undefined if yyoverflow is a macro. */ |
1114 | | yyoverflow (YY_("memory exhausted"), |
1115 | | &yyss1, yysize * YYSIZEOF (*yyssp), |
1116 | | &yyvs1, yysize * YYSIZEOF (*yyvsp), |
1117 | | &yystacksize); |
1118 | | yyss = yyss1; |
1119 | | yyvs = yyvs1; |
1120 | | } |
1121 | | # else /* defined YYSTACK_RELOCATE */ |
1122 | | /* Extend the stack our own way. */ |
1123 | 0 | if (YYMAXDEPTH <= yystacksize) |
1124 | 0 | YYNOMEM; |
1125 | 0 | yystacksize *= 2; |
1126 | 0 | if (YYMAXDEPTH < yystacksize) |
1127 | 0 | yystacksize = YYMAXDEPTH; |
1128 | |
|
1129 | 0 | { |
1130 | 0 | yy_state_t *yyss1 = yyss; |
1131 | 0 | union yyalloc *yyptr = |
1132 | 0 | YY_CAST (union yyalloc *, |
1133 | 0 | YYSTACK_ALLOC (YY_CAST (YYSIZE_T, YYSTACK_BYTES (yystacksize)))); |
1134 | 0 | if (! yyptr) |
1135 | 0 | YYNOMEM; |
1136 | 0 | YYSTACK_RELOCATE (yyss_alloc, yyss); |
1137 | 0 | YYSTACK_RELOCATE (yyvs_alloc, yyvs); |
1138 | 0 | # undef YYSTACK_RELOCATE |
1139 | 0 | if (yyss1 != yyssa) |
1140 | 0 | YYSTACK_FREE (yyss1); |
1141 | 0 | } |
1142 | 0 | # endif |
1143 | | |
1144 | 0 | yyssp = yyss + yysize - 1; |
1145 | 0 | yyvsp = yyvs + yysize - 1; |
1146 | |
|
1147 | 0 | YY_IGNORE_USELESS_CAST_BEGIN |
1148 | 0 | YYDPRINTF ((stderr, "Stack size increased to %ld\n", |
1149 | 0 | YY_CAST (long, yystacksize))); |
1150 | 0 | YY_IGNORE_USELESS_CAST_END |
1151 | |
|
1152 | 0 | if (yyss + yystacksize - 1 <= yyssp) |
1153 | 0 | YYABORT; |
1154 | 0 | } |
1155 | 1.78M | #endif /* !defined yyoverflow && !defined YYSTACK_RELOCATE */ |
1156 | | |
1157 | | |
1158 | 1.78M | if (yystate == YYFINAL) |
1159 | 864 | YYACCEPT; |
1160 | | |
1161 | 1.78M | goto yybackup; |
1162 | | |
1163 | | |
1164 | | /*-----------. |
1165 | | | yybackup. | |
1166 | | `-----------*/ |
1167 | 1.78M | yybackup: |
1168 | | /* Do appropriate processing given the current state. Read a |
1169 | | lookahead token if we need one and don't already have one. */ |
1170 | | |
1171 | | /* First try to decide what to do without reference to lookahead token. */ |
1172 | 1.78M | yyn = yypact[yystate]; |
1173 | 1.78M | if (yypact_value_is_default (yyn)) |
1174 | 580k | goto yydefault; |
1175 | | |
1176 | | /* Not known => get a lookahead token if don't already have one. */ |
1177 | | |
1178 | | /* YYCHAR is either empty, or end-of-input, or a valid lookahead. */ |
1179 | 1.20M | if (yychar == YYEMPTY) |
1180 | 677k | { |
1181 | 677k | YYDPRINTF ((stderr, "Reading a token\n")); |
1182 | 677k | yychar = yylex (&yylval, scanner); |
1183 | 677k | } |
1184 | | |
1185 | 1.20M | if (yychar <= YYEOF) |
1186 | 5.63k | { |
1187 | 5.63k | yychar = YYEOF; |
1188 | 5.63k | yytoken = YYSYMBOL_YYEOF; |
1189 | 5.63k | YYDPRINTF ((stderr, "Now at end of input.\n")); |
1190 | 5.63k | } |
1191 | 1.20M | else if (yychar == YYerror) |
1192 | 0 | { |
1193 | | /* The scanner already issued an error message, process directly |
1194 | | to error recovery. But do not keep the error token as |
1195 | | lookahead, it is too special and may lead us to an endless |
1196 | | loop in error recovery. */ |
1197 | 0 | yychar = YYUNDEF; |
1198 | 0 | yytoken = YYSYMBOL_YYerror; |
1199 | 0 | goto yyerrlab1; |
1200 | 0 | } |
1201 | 1.20M | else |
1202 | 1.20M | { |
1203 | 1.20M | yytoken = YYTRANSLATE (yychar); |
1204 | 1.20M | YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc); |
1205 | 1.20M | } |
1206 | | |
1207 | | /* If the proper action on seeing token YYTOKEN is to reduce or to |
1208 | | detect an error, take that action. */ |
1209 | 1.20M | yyn += yytoken; |
1210 | 1.20M | if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken) |
1211 | 365k | goto yydefault; |
1212 | 841k | yyn = yytable[yyn]; |
1213 | 841k | if (yyn <= 0) |
1214 | 259k | { |
1215 | 259k | if (yytable_value_is_error (yyn)) |
1216 | 0 | goto yyerrlab; |
1217 | 259k | yyn = -yyn; |
1218 | 259k | goto yyreduce; |
1219 | 259k | } |
1220 | | |
1221 | | /* Count tokens shifted since error; after three, turn off error |
1222 | | status. */ |
1223 | 582k | if (yyerrstatus) |
1224 | 525k | yyerrstatus--; |
1225 | | |
1226 | | /* Shift the lookahead token. */ |
1227 | 582k | YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); |
1228 | 582k | yystate = yyn; |
1229 | 582k | YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN |
1230 | 582k | *++yyvsp = yylval; |
1231 | 582k | YY_IGNORE_MAYBE_UNINITIALIZED_END |
1232 | | |
1233 | | /* Discard the shifted token. */ |
1234 | 582k | yychar = YYEMPTY; |
1235 | 582k | goto yynewstate; |
1236 | | |
1237 | | |
1238 | | /*-----------------------------------------------------------. |
1239 | | | yydefault -- do the default action for the current state. | |
1240 | | `-----------------------------------------------------------*/ |
1241 | 945k | yydefault: |
1242 | 945k | yyn = yydefact[yystate]; |
1243 | 945k | if (yyn == 0) |
1244 | 360k | goto yyerrlab; |
1245 | 585k | goto yyreduce; |
1246 | | |
1247 | | |
1248 | | /*-----------------------------. |
1249 | | | yyreduce -- do a reduction. | |
1250 | | `-----------------------------*/ |
1251 | 844k | yyreduce: |
1252 | | /* yyn is the number of a rule to reduce with. */ |
1253 | 844k | yylen = yyr2[yyn]; |
1254 | | |
1255 | | /* If YYLEN is nonzero, implement the default value of the action: |
1256 | | '$$ = $1'. |
1257 | | |
1258 | | Otherwise, the following line sets YYVAL to garbage. |
1259 | | This behavior is undocumented and Bison |
1260 | | users should not rely upon it. Assigning to YYVAL |
1261 | | unconditionally makes the parser a bit smaller, and it avoids a |
1262 | | GCC warning that YYVAL may be used uninitialized. */ |
1263 | 844k | yyval = yyvsp[1-yylen]; |
1264 | | |
1265 | | |
1266 | 844k | YY_REDUCE_PRINT (yyn); |
1267 | 844k | switch (yyn) |
1268 | 844k | { |
1269 | 864 | case 2: /* cuefile: new_cd global_statements track_list */ |
1270 | 864 | #line 119 "cue_parser.y" |
1271 | 864 | { |
1272 | | /* FILE inside the last track, never followed by an INDEX */ |
1273 | 864 | if (st->file_in_track && NULL != st->new_filename |
1274 | 8 | && st->track != st->overflow) |
1275 | 7 | use_new_file_for_track(st); |
1276 | 864 | } |
1277 | 864 | #line 1278 "/work/cue_parser.c" |
1278 | 864 | break; |
1279 | | |
1280 | 2.38k | case 3: /* new_cd: %empty */ |
1281 | 2.38k | #line 128 "cue_parser.y" |
1282 | 2.38k | { |
1283 | 2.38k | st->cd = cd_init(); |
1284 | 2.38k | if (NULL == st->cd) |
1285 | 0 | YYABORT; |
1286 | 2.38k | st->cdtext = cd_get_cdtext(st->cd); |
1287 | 2.38k | st->rem = cd_get_rem(st->cd); |
1288 | 2.38k | } |
1289 | 0 | #line 1290 "/work/cue_parser.c" |
1290 | 0 | break; |
1291 | | |
1292 | 194 | case 6: /* global_statement: CATALOG STRING '\n' */ |
1293 | 194 | #line 143 "cue_parser.y" |
1294 | 194 | { cd_set_catalog(st->cd, (yyvsp[-1].sval)); } |
1295 | 194 | #line 1296 "/work/cue_parser.c" |
1296 | 194 | break; |
1297 | | |
1298 | 203 | case 7: /* global_statement: CDTEXTFILE STRING '\n' */ |
1299 | 203 | #line 144 "cue_parser.y" |
1300 | 203 | { cd_set_cdtextfile(st->cd, (yyvsp[-1].sval)); } |
1301 | 203 | #line 1302 "/work/cue_parser.c" |
1302 | 203 | break; |
1303 | | |
1304 | 1.33k | case 13: /* track_data: FFILE STRING file_format '\n' */ |
1305 | 1.33k | #line 153 "cue_parser.y" |
1306 | 1.33k | { |
1307 | 1.33k | if (NULL != st->new_filename) { |
1308 | 568 | yyerror(scanner, st, "too many files specified"); |
1309 | 568 | } |
1310 | 1.33k | copy_filename(st->new_fname, (yyvsp[-2].sval)); |
1311 | 1.33k | st->new_filename = st->new_fname; |
1312 | | /* |
1313 | | * A FILE inside a track that has no INDEX 01 yet is ambiguous: |
1314 | | * if an INDEX follows, the track continues in the new file |
1315 | | * (e.g. INDEX 00 in the old file, INDEX 01 in the new one); |
1316 | | * if TRACK follows, the file is for the next track. |
1317 | | */ |
1318 | 1.33k | st->file_in_track = (NULL != st->track |
1319 | 913 | && track_get_index(st->track, 1) == -1); |
1320 | 1.33k | } |
1321 | 1.33k | #line 1322 "/work/cue_parser.c" |
1322 | 1.33k | break; |
1323 | | |
1324 | 257k | case 23: /* new_track: %empty */ |
1325 | 257k | #line 189 "cue_parser.y" |
1326 | 257k | { |
1327 | | /* save previous track, to later set length */ |
1328 | 257k | st->prev_track = st->track; |
1329 | | |
1330 | 257k | if (cd_get_ntrack(st->cd) >= MAXTRACK) { |
1331 | | /* |
1332 | | * Parse surplus tracks into a scratch track that is |
1333 | | * thrown away, so they cannot clobber the last real one. |
1334 | | */ |
1335 | 204 | yyerror(scanner, st, "too many tracks"); |
1336 | 204 | if (NULL != st->overflow) { |
1337 | 194 | st->prev_track = NULL; |
1338 | 194 | track_delete(st->overflow); |
1339 | 194 | } |
1340 | 204 | st->track = st->overflow = track_init(); |
1341 | 257k | } else { |
1342 | 257k | st->track = cd_add_track(st->cd); |
1343 | 257k | } |
1344 | 257k | if (NULL == st->track) |
1345 | 0 | YYABORT; |
1346 | | |
1347 | 257k | st->cdtext = track_get_cdtext(st->track); |
1348 | 257k | st->rem = track_get_rem(st->track); |
1349 | | |
1350 | 257k | st->cur_filename = NULL; |
1351 | 257k | st->file_in_track = 0; |
1352 | 257k | if (NULL != st->new_filename) { |
1353 | 448 | copy_filename(st->cur_fname, st->new_filename); |
1354 | 448 | st->cur_filename = st->prev_filename = st->cur_fname; |
1355 | 448 | } |
1356 | | |
1357 | 257k | if (NULL == st->prev_filename) |
1358 | 252k | yyerror(scanner, st, "no file specified for track"); |
1359 | 5.02k | else |
1360 | 5.02k | track_set_filename(st->track, st->prev_filename); |
1361 | | |
1362 | 257k | st->new_filename = NULL; |
1363 | 257k | } |
1364 | 0 | #line 1365 "/work/cue_parser.c" |
1365 | 0 | break; |
1366 | | |
1367 | 1.54k | case 24: /* track_def: TRACK NUMBER track_mode '\n' */ |
1368 | 1.54k | #line 230 "cue_parser.y" |
1369 | 1.54k | { |
1370 | 1.54k | track_set_mode(st->track, (yyvsp[-1].ival)); |
1371 | 1.54k | } |
1372 | 1.54k | #line 1373 "/work/cue_parser.c" |
1373 | 1.54k | break; |
1374 | | |
1375 | 196 | case 38: /* track_statement: TRACK_ISRC STRING '\n' */ |
1376 | 196 | #line 255 "cue_parser.y" |
1377 | 196 | { track_set_isrc(st->track, (yyvsp[-1].sval)); } |
1378 | 196 | #line 1379 "/work/cue_parser.c" |
1379 | 196 | break; |
1380 | | |
1381 | 1.86k | case 39: /* track_statement: PREGAP time '\n' */ |
1382 | 1.86k | #line 256 "cue_parser.y" |
1383 | 1.86k | { track_set_zero_pre(st->track, (yyvsp[-1].ival)); } |
1384 | 1.86k | #line 1385 "/work/cue_parser.c" |
1385 | 1.86k | break; |
1386 | | |
1387 | 3.76k | case 40: /* track_statement: INDEX NUMBER time '\n' */ |
1388 | 3.76k | #line 257 "cue_parser.y" |
1389 | 3.76k | { |
1390 | 3.76k | if ((yyvsp[-2].ival) < 0 || (yyvsp[-2].ival) > MAXINDEX) { |
1391 | 440 | yyerror(scanner, st, "invalid index number"); |
1392 | 3.32k | } else if ((yyvsp[-1].ival) < 0) { |
1393 | 195 | yyerror(scanner, st, "invalid index time"); |
1394 | 3.12k | } else { |
1395 | 3.12k | if (st->file_in_track && NULL != st->new_filename) |
1396 | 253 | use_new_file_for_track(st); |
1397 | | |
1398 | | /* |
1399 | | * Set previous track length if it has not been set. |
1400 | | * INDEX times that run backwards would make the |
1401 | | * length negative; leave it unset instead. |
1402 | | */ |
1403 | 3.12k | if (NULL != st->prev_track && NULL == st->cur_filename |
1404 | 1.09k | && track_get_length(st->prev_track) == -1 |
1405 | 868 | && track_get_start(st->prev_track) != -1 |
1406 | 660 | && (yyvsp[-1].ival) >= track_get_start(st->prev_track)) { |
1407 | | /* track shares file with previous track */ |
1408 | 362 | track_set_length(st->prev_track, |
1409 | 362 | (yyvsp[-1].ival) - track_get_start(st->prev_track)); |
1410 | 362 | } |
1411 | | |
1412 | 3.12k | if (1 == (yyvsp[-2].ival)) { |
1413 | | /* INDEX 01 */ |
1414 | 2.08k | track_set_start(st->track, (yyvsp[-1].ival)); |
1415 | | |
1416 | 2.08k | long idx00 = track_get_index(st->track, 0); |
1417 | | |
1418 | | /* INDEX 00 past INDEX 01 is not a pre-gap */ |
1419 | 2.08k | if (idx00 != -1 && (yyvsp[-1].ival) != 0 && (yyvsp[-1].ival) >= idx00) |
1420 | 354 | track_set_zero_pre(st->track, (yyvsp[-1].ival) - idx00); |
1421 | 2.08k | } |
1422 | | |
1423 | 3.12k | track_set_index(st->track, (int)(yyvsp[-2].ival), (yyvsp[-1].ival)); |
1424 | 3.12k | } |
1425 | 3.76k | } |
1426 | 3.76k | #line 1427 "/work/cue_parser.c" |
1427 | 3.76k | break; |
1428 | | |
1429 | 194 | case 41: /* track_statement: POSTGAP time '\n' */ |
1430 | 194 | #line 294 "cue_parser.y" |
1431 | 194 | { track_set_zero_post(st->track, (yyvsp[-1].ival)); } |
1432 | 194 | #line 1433 "/work/cue_parser.c" |
1433 | 194 | break; |
1434 | | |
1435 | 625 | case 46: /* track_flags: track_flags track_flag */ |
1436 | 625 | #line 302 "cue_parser.y" |
1437 | 625 | { track_set_flag(st->track, (yyvsp[0].ival)); } |
1438 | 625 | #line 1439 "/work/cue_parser.c" |
1439 | 625 | break; |
1440 | | |
1441 | 2.68k | case 51: /* cdtext: cdtext_item STRING '\n' */ |
1442 | 2.68k | #line 313 "cue_parser.y" |
1443 | 2.68k | { cdtext_set((yyvsp[-2].ival), (yyvsp[-1].sval), st->cdtext); } |
1444 | 2.68k | #line 1445 "/work/cue_parser.c" |
1445 | 2.68k | break; |
1446 | | |
1447 | 3.91k | case 65: /* time: NUMBER */ |
1448 | 3.91k | #line 333 "cue_parser.y" |
1449 | 3.91k | { (yyval.ival) = ((yyvsp[0].ival) > INT_MAX) ? -1 : (yyvsp[0].ival); } |
1450 | 3.91k | #line 1451 "/work/cue_parser.c" |
1451 | 3.91k | break; |
1452 | | |
1453 | 1.91k | case 66: /* time: NUMBER ':' NUMBER ':' NUMBER */ |
1454 | 1.91k | #line 334 "cue_parser.y" |
1455 | 1.91k | { (yyval.ival) = msf_to_frame((yyvsp[-4].ival), (yyvsp[-2].ival), (yyvsp[0].ival)); } |
1456 | 1.91k | #line 1457 "/work/cue_parser.c" |
1457 | 1.91k | break; |
1458 | | |
1459 | 688 | case 67: /* rem: rem_item STRING '\n' */ |
1460 | 688 | #line 338 "cue_parser.y" |
1461 | 688 | { rem_set((yyvsp[-2].ival), (yyvsp[-1].sval), st->rem); } |
1462 | 688 | #line 1463 "/work/cue_parser.c" |
1463 | 688 | break; |
1464 | | |
1465 | 194 | case 68: /* rem: XXX_GENRE STRING '\n' */ |
1466 | 194 | #line 339 "cue_parser.y" |
1467 | 194 | { cdtext_set((yyvsp[-2].ival), (yyvsp[-1].sval), st->cdtext); } |
1468 | 194 | #line 1469 "/work/cue_parser.c" |
1469 | 194 | break; |
1470 | | |
1471 | 203 | case 69: /* rem: XXX_DISCID STRING '\n' */ |
1472 | 203 | #line 340 "cue_parser.y" |
1473 | 203 | { cdtext_set((yyvsp[-2].ival), (yyvsp[-1].sval), st->cdtext); } |
1474 | 203 | #line 1475 "/work/cue_parser.c" |
1475 | 203 | break; |
1476 | | |
1477 | 194 | case 70: /* rem: XXX_COMPOSER STRING '\n' */ |
1478 | 194 | #line 341 "cue_parser.y" |
1479 | 194 | { cdtext_set((yyvsp[-2].ival), (yyvsp[-1].sval), st->cdtext); } |
1480 | 194 | #line 1481 "/work/cue_parser.c" |
1481 | 194 | break; |
1482 | | |
1483 | | |
1484 | 0 | #line 1485 "/work/cue_parser.c" |
1485 | | |
1486 | 563k | default: break; |
1487 | 844k | } |
1488 | | /* User semantic actions sometimes alter yychar, and that requires |
1489 | | that yytoken be updated with the new translation. We take the |
1490 | | approach of translating immediately before every use of yytoken. |
1491 | | One alternative is translating here after every semantic action, |
1492 | | but that translation would be missed if the semantic action invokes |
1493 | | YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or |
1494 | | if it invokes YYBACKUP. In the case of YYABORT or YYACCEPT, an |
1495 | | incorrect destructor might then be invoked immediately. In the |
1496 | | case of YYERROR or YYBACKUP, subsequent parser actions might lead |
1497 | | to an incorrect destructor call or verbose syntax error message |
1498 | | before the lookahead is translated. */ |
1499 | 844k | YY_SYMBOL_PRINT ("-> $$ =", YY_CAST (yysymbol_kind_t, yyr1[yyn]), &yyval, &yyloc); |
1500 | | |
1501 | 844k | YYPOPSTACK (yylen); |
1502 | 844k | yylen = 0; |
1503 | | |
1504 | 844k | *++yyvsp = yyval; |
1505 | | |
1506 | | /* Now 'shift' the result of the reduction. Determine what state |
1507 | | that goes to, based on the state we popped back to and the rule |
1508 | | number reduced by. */ |
1509 | 844k | { |
1510 | 844k | const int yylhs = yyr1[yyn] - YYNTOKENS; |
1511 | 844k | const int yyi = yypgoto[yylhs] + *yyssp; |
1512 | 844k | yystate = (0 <= yyi && yyi <= YYLAST && yycheck[yyi] == *yyssp |
1513 | 844k | ? yytable[yyi] |
1514 | 844k | : yydefgoto[yylhs]); |
1515 | 844k | } |
1516 | | |
1517 | 844k | goto yynewstate; |
1518 | | |
1519 | | |
1520 | | /*--------------------------------------. |
1521 | | | yyerrlab -- here on detecting error. | |
1522 | | `--------------------------------------*/ |
1523 | 360k | yyerrlab: |
1524 | | /* Make sure we have latest lookahead translation. See comments at |
1525 | | user semantic actions for why this is necessary. */ |
1526 | 360k | yytoken = yychar == YYEMPTY ? YYSYMBOL_YYEMPTY : YYTRANSLATE (yychar); |
1527 | | /* If not already recovering from an error, report this error. */ |
1528 | 360k | if (!yyerrstatus) |
1529 | 3.16k | { |
1530 | 3.16k | ++yynerrs; |
1531 | 3.16k | yyerror (scanner, st, YY_("syntax error")); |
1532 | 3.16k | } |
1533 | | |
1534 | 360k | if (yyerrstatus == 3) |
1535 | 95.1k | { |
1536 | | /* If just tried and failed to reuse lookahead token after an |
1537 | | error, discard it. */ |
1538 | | |
1539 | 95.1k | if (yychar <= YYEOF) |
1540 | 1.52k | { |
1541 | | /* Return failure if at end of input. */ |
1542 | 1.52k | if (yychar == YYEOF) |
1543 | 1.52k | YYABORT; |
1544 | 1.52k | } |
1545 | 93.6k | else |
1546 | 93.6k | { |
1547 | 93.6k | yydestruct ("Error: discarding", |
1548 | 93.6k | yytoken, &yylval, scanner, st); |
1549 | 93.6k | yychar = YYEMPTY; |
1550 | 93.6k | } |
1551 | 95.1k | } |
1552 | | |
1553 | | /* Else will try to reuse lookahead token after shifting the error |
1554 | | token. */ |
1555 | 358k | goto yyerrlab1; |
1556 | | |
1557 | | |
1558 | | /*---------------------------------------------------. |
1559 | | | yyerrorlab -- error raised explicitly by YYERROR. | |
1560 | | `---------------------------------------------------*/ |
1561 | 358k | yyerrorlab: |
1562 | | /* Pacify compilers when the user code never invokes YYERROR and the |
1563 | | label yyerrorlab therefore never appears in user code. */ |
1564 | 0 | if (0) |
1565 | 0 | YYERROR; |
1566 | 0 | ++yynerrs; |
1567 | | |
1568 | | /* Do not reclaim the symbols of the rule whose action triggered |
1569 | | this YYERROR. */ |
1570 | 0 | YYPOPSTACK (yylen); |
1571 | 0 | yylen = 0; |
1572 | 0 | YY_STACK_PRINT (yyss, yyssp); |
1573 | 0 | yystate = *yyssp; |
1574 | 0 | goto yyerrlab1; |
1575 | | |
1576 | | |
1577 | | /*-------------------------------------------------------------. |
1578 | | | yyerrlab1 -- common code for both syntax error and YYERROR. | |
1579 | | `-------------------------------------------------------------*/ |
1580 | 358k | yyerrlab1: |
1581 | 358k | yyerrstatus = 3; /* Each real token shifted decrements this. */ |
1582 | | |
1583 | | /* Pop stack until we find a state that shifts the error token. */ |
1584 | 358k | for (;;) |
1585 | 969k | { |
1586 | 969k | yyn = yypact[yystate]; |
1587 | 969k | if (!yypact_value_is_default (yyn)) |
1588 | 969k | { |
1589 | 969k | yyn += YYSYMBOL_YYerror; |
1590 | 969k | if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYSYMBOL_YYerror) |
1591 | 358k | { |
1592 | 358k | yyn = yytable[yyn]; |
1593 | 358k | if (0 < yyn) |
1594 | 358k | break; |
1595 | 358k | } |
1596 | 969k | } |
1597 | | |
1598 | | /* Pop the current state because it cannot handle the error token. */ |
1599 | 610k | if (yyssp == yyss) |
1600 | 0 | YYABORT; |
1601 | | |
1602 | | |
1603 | 610k | yydestruct ("Error: popping", |
1604 | 610k | YY_ACCESSING_SYMBOL (yystate), yyvsp, scanner, st); |
1605 | 610k | YYPOPSTACK (1); |
1606 | 610k | yystate = *yyssp; |
1607 | 610k | YY_STACK_PRINT (yyss, yyssp); |
1608 | 610k | } |
1609 | | |
1610 | 358k | YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN |
1611 | 358k | *++yyvsp = yylval; |
1612 | 358k | YY_IGNORE_MAYBE_UNINITIALIZED_END |
1613 | | |
1614 | | |
1615 | | /* Shift the error token. */ |
1616 | 358k | YY_SYMBOL_PRINT ("Shifting", YY_ACCESSING_SYMBOL (yyn), yyvsp, yylsp); |
1617 | | |
1618 | 358k | yystate = yyn; |
1619 | 358k | goto yynewstate; |
1620 | | |
1621 | | |
1622 | | /*-------------------------------------. |
1623 | | | yyacceptlab -- YYACCEPT comes here. | |
1624 | | `-------------------------------------*/ |
1625 | 864 | yyacceptlab: |
1626 | 864 | yyresult = 0; |
1627 | 864 | goto yyreturnlab; |
1628 | | |
1629 | | |
1630 | | /*-----------------------------------. |
1631 | | | yyabortlab -- YYABORT comes here. | |
1632 | | `-----------------------------------*/ |
1633 | 1.52k | yyabortlab: |
1634 | 1.52k | yyresult = 1; |
1635 | 1.52k | goto yyreturnlab; |
1636 | | |
1637 | | |
1638 | | /*-----------------------------------------------------------. |
1639 | | | yyexhaustedlab -- YYNOMEM (memory exhaustion) comes here. | |
1640 | | `-----------------------------------------------------------*/ |
1641 | 0 | yyexhaustedlab: |
1642 | 0 | yyerror (scanner, st, YY_("memory exhausted")); |
1643 | 0 | yyresult = 2; |
1644 | 0 | goto yyreturnlab; |
1645 | | |
1646 | | |
1647 | | /*----------------------------------------------------------. |
1648 | | | yyreturnlab -- parsing is finished, clean up and return. | |
1649 | | `----------------------------------------------------------*/ |
1650 | 2.38k | yyreturnlab: |
1651 | 2.38k | if (yychar != YYEMPTY) |
1652 | 1.52k | { |
1653 | | /* Make sure we have latest lookahead translation. See comments at |
1654 | | user semantic actions for why this is necessary. */ |
1655 | 1.52k | yytoken = YYTRANSLATE (yychar); |
1656 | 1.52k | yydestruct ("Cleanup: discarding lookahead", |
1657 | 1.52k | yytoken, &yylval, scanner, st); |
1658 | 1.52k | } |
1659 | | /* Do not reclaim the symbols of the rule whose action triggered |
1660 | | this YYABORT or YYACCEPT. */ |
1661 | 2.38k | YYPOPSTACK (yylen); |
1662 | 2.38k | YY_STACK_PRINT (yyss, yyssp); |
1663 | 8.69k | while (yyssp != yyss) |
1664 | 6.31k | { |
1665 | 6.31k | yydestruct ("Cleanup: popping", |
1666 | 6.31k | YY_ACCESSING_SYMBOL (+*yyssp), yyvsp, scanner, st); |
1667 | 6.31k | YYPOPSTACK (1); |
1668 | 6.31k | } |
1669 | 2.38k | #ifndef yyoverflow |
1670 | 2.38k | if (yyss != yyssa) |
1671 | 0 | YYSTACK_FREE (yyss); |
1672 | 2.38k | #endif |
1673 | | |
1674 | 2.38k | return yyresult; |
1675 | 358k | } |
1676 | | |
1677 | | #line 354 "cue_parser.y" |
1678 | | |
1679 | | |
1680 | | /* lexer interface */ |
1681 | | int cue_yylex_init_extra(struct cue_parser_state *extra, void **scanner); |
1682 | | int cue_yylex_destroy(void *scanner); |
1683 | | struct yy_buffer_state *cue_yy_create_buffer(FILE *file, int size, void *scanner); |
1684 | | void cue_yy_switch_to_buffer(struct yy_buffer_state *buffer, void *scanner); |
1685 | | void cue_yyset_lineno(int line, void *scanner); |
1686 | | int cue_yyget_lineno(void *scanner); |
1687 | | struct yy_buffer_state *cue_yy_scan_string(const char *str, void *scanner); |
1688 | | |
1689 | | static void yyerror(void *scanner, struct cue_parser_state *st, const char *s) |
1690 | 257k | { |
1691 | 257k | (void)st; |
1692 | 257k | fprintf(stderr, "%d: %s\n", cue_yyget_lineno(scanner), s); |
1693 | 257k | } |
1694 | | |
1695 | | /* MSF to frames; -1 for anything that is not a valid MSF time */ |
1696 | | static long msf_to_frame(long m, long s, long f) |
1697 | 1.91k | { |
1698 | 1.91k | if (m < 0 || m > INT_MAX || s < 0 || s > INT_MAX || f < 0 || f > INT_MAX) |
1699 | 583 | return -1; |
1700 | 1.33k | return time_msf_to_frame((int)m, (int)s, (int)f); |
1701 | 1.91k | } |
1702 | | |
1703 | | static void copy_filename(char *dst, const char *src) |
1704 | 2.04k | { |
1705 | 2.04k | strncpy(dst, src, PARSER_BUFFER - 1); |
1706 | 2.04k | dst[PARSER_BUFFER - 1] = '\0'; |
1707 | 2.04k | } |
1708 | | |
1709 | | /* the pending FILE belongs to the current track, and the tracks after it */ |
1710 | | static void use_new_file_for_track(struct cue_parser_state *st) |
1711 | 260 | { |
1712 | 260 | track_set_filename(st->track, st->new_filename); |
1713 | 260 | copy_filename(st->cur_fname, st->new_filename); |
1714 | 260 | st->cur_filename = st->prev_filename = st->cur_fname; |
1715 | 260 | st->new_filename = NULL; |
1716 | 260 | st->file_in_track = 0; |
1717 | 260 | } |
1718 | | |
1719 | | /* parse either fp or string, using fresh state for every call */ |
1720 | | static Cd *cue_parse(FILE *fp, const char *string) |
1721 | 2.38k | { |
1722 | 2.38k | struct cue_parser_state *st; |
1723 | 2.38k | void *scanner = NULL; |
1724 | 2.38k | Cd *ret_cd = NULL; |
1725 | | |
1726 | 2.38k | st = calloc(1, sizeof(*st)); |
1727 | 2.38k | if (NULL == st) |
1728 | 0 | return NULL; |
1729 | | |
1730 | 2.38k | if (0 != cue_yylex_init_extra(st, &scanner)) { |
1731 | 0 | free(st); |
1732 | 0 | return NULL; |
1733 | 0 | } |
1734 | | |
1735 | | /* the buffer is owned and freed by the scanner (cue_yylex_destroy) */ |
1736 | 2.38k | if (NULL != fp) |
1737 | 0 | cue_yy_switch_to_buffer(cue_yy_create_buffer(fp, 16384, scanner), scanner); |
1738 | 2.38k | else |
1739 | 2.38k | cue_yy_scan_string(string, scanner); |
1740 | | |
1741 | | /* not initialized by flex for string buffers */ |
1742 | 2.38k | cue_yyset_lineno(1, scanner); |
1743 | | |
1744 | 2.38k | if (0 == cue_yyparse(scanner, st)) |
1745 | 864 | ret_cd = st->cd; |
1746 | 1.52k | else |
1747 | 1.52k | cd_delete(st->cd); |
1748 | | |
1749 | 2.38k | cue_yylex_destroy(scanner); |
1750 | 2.38k | track_delete(st->overflow); |
1751 | 2.38k | free(st); |
1752 | | |
1753 | 2.38k | return ret_cd; |
1754 | 2.38k | } |
1755 | | |
1756 | | Cd *cue_parse_file(FILE *fp) |
1757 | 0 | { |
1758 | 0 | if (NULL == fp) |
1759 | 0 | return NULL; |
1760 | | |
1761 | 0 | return cue_parse(fp, NULL); |
1762 | 0 | } |
1763 | | |
1764 | | Cd *cue_parse_string(const char* string) |
1765 | 2.38k | { |
1766 | 2.38k | if (NULL == string) |
1767 | 0 | return NULL; |
1768 | | |
1769 | 2.38k | return cue_parse(NULL, string); |
1770 | 2.38k | } |