1 /* A Bison parser, made by GNU Bison 3.7.4. */
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 /* 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 30704
50
51 /* Bison version string. */
52 #define YYBISON_VERSION "3.7.4"
53
54 /* Skeleton name. */
55 #define YYSKELETON_NAME "yacc.c"
56
57 /* Pure parsers. */
58 #define YYPURE 0
59
60 /* Push parsers. */
61 #define YYPUSH 0
62
63 /* Pull parsers. */
64 #define YYPULL 1
65
66
67 /* Substitute the variable and function names. */
68 #define yyparse cue_scanner_parse
69 #define yylex cue_scanner_lex
70 #define yyerror cue_scanner_error
71 #define yydebug cue_scanner_debug
72 #define yynerrs cue_scanner_nerrs
73 #define yylval cue_scanner_lval
74 #define yychar cue_scanner_char
75
76 /* First part of user prologue. */
77
78 /*
79 * CUE parser functions
80 *
81 * Copyright (C) 2010-2020, Joachim Metz <joachim.metz@gmail.com>
82 *
83 * Refer to AUTHORS for acknowledgements.
84 *
85 * This program is free software: you can redistribute it and/or modify
86 * it under the terms of the GNU Lesser General Public License as published by
87 * the Free Software Foundation, either version 3 of the License, or
88 * (at your option) any later version.
89 *
90 * This program is distributed in the hope that it will be useful,
91 * but WITHOUT ANY WARRANTY; without even the implied warranty of
92 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
93 * GNU General Public License for more details.
94 *
95 * You should have received a copy of the GNU Lesser General Public License
96 * along with this program. If not, see <https://www.gnu.org/licenses/>.
97 */
98
99 #include <common.h>
100 #include <narrow_string.h>
101 #include <types.h>
102
103 #if defined( HAVE_STDLIB_H ) || defined( WINAPI )
104 #include <stdlib.h>
105 #endif
106
107 #include "libodraw_definitions.h"
108 #include "libodraw_handle.h"
109 #include "libodraw_libcerror.h"
110 #include "libodraw_libcnotify.h"
111 #include "libodraw_types.h"
112
113 #define YYMALLOC cue_scanner_alloc
114 #define YYREALLOC cue_scanner_realloc
115 #define YYFREE cue_scanner_free
116
117 #define YYLEX_PARAM NULL
118 #define YYPARSE_PARAM parser_state
119
120 #if defined( HAVE_DEBUG_OUTPUT )
121 #define cue_parser_rule_print( string ) \
122 if( libcnotify_verbose != 0 ) libcnotify_printf( "cue_parser: rule: %s\n", string )
123 #else
124 #define cue_parser_rule_print( string )
125 #endif
126
127 #if !defined( CD_SECS )
128 /* seconds per minute */
129 #define CD_SECS 60
130 #endif
131
132 #if !defined( CD_FRAMES )
133 /* frames per second */
134 #define CD_FRAMES 75
135 #endif
136
137 /* Note that the MSF are relative, so there is no need for the MSF offset correction
138 */
139 #define cue_parser_copy_relative_msf_to_lba( msf_string, lba ) \
140 lba = ( ( msf_string[ 0 ] - '0' ) * 10 ) + ( msf_string[ 1 ] - '0' ); \
141 lba *= CD_SECS; \
142 lba += ( ( msf_string[ 3 ] - '0' ) * 10 ) + ( msf_string[ 4 ] - '0' ); \
143 lba *= CD_FRAMES; \
144 lba += ( ( msf_string[ 6 ] - '0' ) * 10 ) + ( msf_string[ 7 ] - '0' );
145
146
147 # ifndef YY_CAST
148 # ifdef __cplusplus
149 # define YY_CAST(Type, Val) static_cast<Type> (Val)
150 # define YY_REINTERPRET_CAST(Type, Val) reinterpret_cast<Type> (Val)
151 # else
152 # define YY_CAST(Type, Val) ((Type) (Val))
153 # define YY_REINTERPRET_CAST(Type, Val) ((Type) (Val))
154 # endif
155 # endif
156 # ifndef YY_NULLPTR
157 # if defined __cplusplus
158 # if 201103L <= __cplusplus
159 # define YY_NULLPTR nullptr
160 # else
161 # define YY_NULLPTR 0
162 # endif
163 # else
164 # define YY_NULLPTR ((void*)0)
165 # endif
166 # endif
167
168 /* Use api.header.include to #include this header
169 instead of duplicating it here. */
170 #ifndef YY_CUE_SCANNER_LIBODRAW_CUE_PARSER_H_INCLUDED
171 # define YY_CUE_SCANNER_LIBODRAW_CUE_PARSER_H_INCLUDED
172 /* Debug traces. */
173 #ifndef YYDEBUG
174 # define YYDEBUG 0
175 #endif
176 #if YYDEBUG
177 extern int cue_scanner_debug;
178 #endif
179
180 /* Token kinds. */
181 #ifndef YYTOKENTYPE
182 # define YYTOKENTYPE
183 enum yytokentype
184 {
185 YYEMPTY = -2,
186 YYEOF = 0, /* "end of file" */
187 YYerror = 256, /* error */
188 YYUNDEF = 257, /* "invalid token" */
189 CUE_END_OF_LINE = 258, /* CUE_END_OF_LINE */
190 CUE_SEMI_COLON = 259, /* CUE_SEMI_COLON */
191 CUE_2DIGIT = 260, /* CUE_2DIGIT */
192 CUE_CATALOG_NUMBER = 261, /* CUE_CATALOG_NUMBER */
193 CUE_ISRC_CODE = 262, /* CUE_ISRC_CODE */
194 CUE_KEYWORD_STRING = 263, /* CUE_KEYWORD_STRING */
195 CUE_MSF = 264, /* CUE_MSF */
196 CUE_STRING = 265, /* CUE_STRING */
197 CUE_CATALOG = 266, /* CUE_CATALOG */
198 CUE_CDTEXTFILE = 267, /* CUE_CDTEXTFILE */
199 CUE_FLAGS = 268, /* CUE_FLAGS */
200 CUE_FILE = 269, /* CUE_FILE */
201 CUE_INDEX = 270, /* CUE_INDEX */
202 CUE_ISRC = 271, /* CUE_ISRC */
203 CUE_POSTGAP = 272, /* CUE_POSTGAP */
204 CUE_PREGAP = 273, /* CUE_PREGAP */
205 CUE_REMARK = 274, /* CUE_REMARK */
206 CUE_TRACK = 275, /* CUE_TRACK */
207 CUE_CDTEXT_ARRANGER = 276, /* CUE_CDTEXT_ARRANGER */
208 CUE_CDTEXT_COMPOSER = 277, /* CUE_CDTEXT_COMPOSER */
209 CUE_CDTEXT_DISC_ID = 278, /* CUE_CDTEXT_DISC_ID */
210 CUE_CDTEXT_GENRE = 279, /* CUE_CDTEXT_GENRE */
211 CUE_CDTEXT_MESSAGE = 280, /* CUE_CDTEXT_MESSAGE */
212 CUE_CDTEXT_PERFORMER = 281, /* CUE_CDTEXT_PERFORMER */
213 CUE_CDTEXT_SIZE_INFO = 282, /* CUE_CDTEXT_SIZE_INFO */
214 CUE_CDTEXT_SONGWRITER = 283, /* CUE_CDTEXT_SONGWRITER */
215 CUE_CDTEXT_TITLE = 284, /* CUE_CDTEXT_TITLE */
216 CUE_CDTEXT_TOC_INFO1 = 285, /* CUE_CDTEXT_TOC_INFO1 */
217 CUE_CDTEXT_TOC_INFO2 = 286, /* CUE_CDTEXT_TOC_INFO2 */
218 CUE_CDTEXT_UPC_EAN = 287, /* CUE_CDTEXT_UPC_EAN */
219 CUE_REMARK_LEAD_OUT = 288, /* CUE_REMARK_LEAD_OUT */
220 CUE_REMARK_ORIGINAL_MEDIA_TYPE = 289, /* CUE_REMARK_ORIGINAL_MEDIA_TYPE */
221 CUE_REMARK_RUN_OUT = 290, /* CUE_REMARK_RUN_OUT */
222 CUE_REMARK_SESSION = 291 /* CUE_REMARK_SESSION */
223 };
224 typedef enum yytokentype yytoken_kind_t;
225 #endif
226 /* Token kinds. */
227 #define YYEMPTY -2
228 #define YYEOF 0
229 #define YYerror 256
230 #define YYUNDEF 257
231 #define CUE_END_OF_LINE 258
232 #define CUE_SEMI_COLON 259
233 #define CUE_2DIGIT 260
234 #define CUE_CATALOG_NUMBER 261
235 #define CUE_ISRC_CODE 262
236 #define CUE_KEYWORD_STRING 263
237 #define CUE_MSF 264
238 #define CUE_STRING 265
239 #define CUE_CATALOG 266
240 #define CUE_CDTEXTFILE 267
241 #define CUE_FLAGS 268
242 #define CUE_FILE 269
243 #define CUE_INDEX 270
244 #define CUE_ISRC 271
245 #define CUE_POSTGAP 272
246 #define CUE_PREGAP 273
247 #define CUE_REMARK 274
248 #define CUE_TRACK 275
249 #define CUE_CDTEXT_ARRANGER 276
250 #define CUE_CDTEXT_COMPOSER 277
251 #define CUE_CDTEXT_DISC_ID 278
252 #define CUE_CDTEXT_GENRE 279
253 #define CUE_CDTEXT_MESSAGE 280
254 #define CUE_CDTEXT_PERFORMER 281
255 #define CUE_CDTEXT_SIZE_INFO 282
256 #define CUE_CDTEXT_SONGWRITER 283
257 #define CUE_CDTEXT_TITLE 284
258 #define CUE_CDTEXT_TOC_INFO1 285
259 #define CUE_CDTEXT_TOC_INFO2 286
260 #define CUE_CDTEXT_UPC_EAN 287
261 #define CUE_REMARK_LEAD_OUT 288
262 #define CUE_REMARK_ORIGINAL_MEDIA_TYPE 289
263 #define CUE_REMARK_RUN_OUT 290
264 #define CUE_REMARK_SESSION 291
265
266 /* Value type. */
267 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
268 union YYSTYPE
269 {
270
271 /* The numeric value
272 */
273 uint32_t numeric_value;
274
275 /* The string value
276 */
277 struct cue_string_value
278 {
279 /* The string data
280 */
281 const char *data;
282
283 /* The string length
284 */
285 size_t length;
286
287 } string_value;
288
289
290 };
291 typedef union YYSTYPE YYSTYPE;
292 # define YYSTYPE_IS_TRIVIAL 1
293 # define YYSTYPE_IS_DECLARED 1
294 #endif
295
296
297 extern YYSTYPE cue_scanner_lval;
298
299 int cue_scanner_parse (void *parser_state);
300
301 #endif /* !YY_CUE_SCANNER_LIBODRAW_CUE_PARSER_H_INCLUDED */
302 /* Symbol kind. */
303 enum yysymbol_kind_t
304 {
305 YYSYMBOL_YYEMPTY = -2,
306 YYSYMBOL_YYEOF = 0, /* "end of file" */
307 YYSYMBOL_YYerror = 1, /* error */
308 YYSYMBOL_YYUNDEF = 2, /* "invalid token" */
309 YYSYMBOL_CUE_END_OF_LINE = 3, /* CUE_END_OF_LINE */
310 YYSYMBOL_CUE_SEMI_COLON = 4, /* CUE_SEMI_COLON */
311 YYSYMBOL_CUE_2DIGIT = 5, /* CUE_2DIGIT */
312 YYSYMBOL_CUE_CATALOG_NUMBER = 6, /* CUE_CATALOG_NUMBER */
313 YYSYMBOL_CUE_ISRC_CODE = 7, /* CUE_ISRC_CODE */
314 YYSYMBOL_CUE_KEYWORD_STRING = 8, /* CUE_KEYWORD_STRING */
315 YYSYMBOL_CUE_MSF = 9, /* CUE_MSF */
316 YYSYMBOL_CUE_STRING = 10, /* CUE_STRING */
317 YYSYMBOL_CUE_CATALOG = 11, /* CUE_CATALOG */
318 YYSYMBOL_CUE_CDTEXTFILE = 12, /* CUE_CDTEXTFILE */
319 YYSYMBOL_CUE_FLAGS = 13, /* CUE_FLAGS */
320 YYSYMBOL_CUE_FILE = 14, /* CUE_FILE */
321 YYSYMBOL_CUE_INDEX = 15, /* CUE_INDEX */
322 YYSYMBOL_CUE_ISRC = 16, /* CUE_ISRC */
323 YYSYMBOL_CUE_POSTGAP = 17, /* CUE_POSTGAP */
324 YYSYMBOL_CUE_PREGAP = 18, /* CUE_PREGAP */
325 YYSYMBOL_CUE_REMARK = 19, /* CUE_REMARK */
326 YYSYMBOL_CUE_TRACK = 20, /* CUE_TRACK */
327 YYSYMBOL_CUE_CDTEXT_ARRANGER = 21, /* CUE_CDTEXT_ARRANGER */
328 YYSYMBOL_CUE_CDTEXT_COMPOSER = 22, /* CUE_CDTEXT_COMPOSER */
329 YYSYMBOL_CUE_CDTEXT_DISC_ID = 23, /* CUE_CDTEXT_DISC_ID */
330 YYSYMBOL_CUE_CDTEXT_GENRE = 24, /* CUE_CDTEXT_GENRE */
331 YYSYMBOL_CUE_CDTEXT_MESSAGE = 25, /* CUE_CDTEXT_MESSAGE */
332 YYSYMBOL_CUE_CDTEXT_PERFORMER = 26, /* CUE_CDTEXT_PERFORMER */
333 YYSYMBOL_CUE_CDTEXT_SIZE_INFO = 27, /* CUE_CDTEXT_SIZE_INFO */
334 YYSYMBOL_CUE_CDTEXT_SONGWRITER = 28, /* CUE_CDTEXT_SONGWRITER */
335 YYSYMBOL_CUE_CDTEXT_TITLE = 29, /* CUE_CDTEXT_TITLE */
336 YYSYMBOL_CUE_CDTEXT_TOC_INFO1 = 30, /* CUE_CDTEXT_TOC_INFO1 */
337 YYSYMBOL_CUE_CDTEXT_TOC_INFO2 = 31, /* CUE_CDTEXT_TOC_INFO2 */
338 YYSYMBOL_CUE_CDTEXT_UPC_EAN = 32, /* CUE_CDTEXT_UPC_EAN */
339 YYSYMBOL_CUE_REMARK_LEAD_OUT = 33, /* CUE_REMARK_LEAD_OUT */
340 YYSYMBOL_CUE_REMARK_ORIGINAL_MEDIA_TYPE = 34, /* CUE_REMARK_ORIGINAL_MEDIA_TYPE */
341 YYSYMBOL_CUE_REMARK_RUN_OUT = 35, /* CUE_REMARK_RUN_OUT */
342 YYSYMBOL_CUE_REMARK_SESSION = 36, /* CUE_REMARK_SESSION */
343 YYSYMBOL_YYACCEPT = 37, /* $accept */
344 YYSYMBOL_cue_main = 38, /* cue_main */
345 YYSYMBOL_cue_main_items = 39, /* cue_main_items */
346 YYSYMBOL_cue_main_item = 40, /* cue_main_item */
347 YYSYMBOL_cue_main_tracks = 41, /* cue_main_tracks */
348 YYSYMBOL_cue_main_track = 42, /* cue_main_track */
349 YYSYMBOL_cue_main_track_preceding_items = 43, /* cue_main_track_preceding_items */
350 YYSYMBOL_cue_main_track_preceding_item = 44, /* cue_main_track_preceding_item */
351 YYSYMBOL_cue_main_track_leading_items = 45, /* cue_main_track_leading_items */
352 YYSYMBOL_cue_main_track_leading_item = 46, /* cue_main_track_leading_item */
353 YYSYMBOL_cue_main_track_index_items = 47, /* cue_main_track_index_items */
354 YYSYMBOL_cue_main_track_index_item = 48, /* cue_main_track_index_item */
355 YYSYMBOL_cue_main_track_trailing_items = 49, /* cue_main_track_trailing_items */
356 YYSYMBOL_cue_main_track_trailing_item = 50, /* cue_main_track_trailing_item */
357 YYSYMBOL_cue_catalog = 51, /* cue_catalog */
358 YYSYMBOL_cue_cdtext = 52, /* cue_cdtext */
359 YYSYMBOL_cue_cdtext_type = 53, /* cue_cdtext_type */
360 YYSYMBOL_cue_cdtextfile = 54, /* cue_cdtextfile */
361 YYSYMBOL_cue_file = 55, /* cue_file */
362 YYSYMBOL_cue_flags = 56, /* cue_flags */
363 YYSYMBOL_cue_flags_types = 57, /* cue_flags_types */
364 YYSYMBOL_cue_index = 58, /* cue_index */
365 YYSYMBOL_cue_isrc = 59, /* cue_isrc */
366 YYSYMBOL_cue_postgap = 60, /* cue_postgap */
367 YYSYMBOL_cue_pregap = 61, /* cue_pregap */
368 YYSYMBOL_cue_remark_item = 62, /* cue_remark_item */
369 YYSYMBOL_cue_lead_out = 63, /* cue_lead_out */
370 YYSYMBOL_cue_original_media_type = 64, /* cue_original_media_type */
371 YYSYMBOL_cue_remark = 65, /* cue_remark */
372 YYSYMBOL_cue_remark_start = 66, /* cue_remark_start */
373 YYSYMBOL_cue_run_out = 67, /* cue_run_out */
374 YYSYMBOL_cue_session = 68, /* cue_session */
375 YYSYMBOL_cue_track = 69, /* cue_track */
376 YYSYMBOL_cue_empty_line = 70 /* cue_empty_line */
377 };
378 typedef enum yysymbol_kind_t yysymbol_kind_t;
379
380
381 /* Second part of user prologue. */
382
383
384 typedef struct cue_parser_state cue_parser_state_t;
385
386 struct cue_parser_state
387 {
388 /* The file
389 */
390 libodraw_handle_t *handle;
391
392 /* The error
393 */
394 libcerror_error_t **error;
395
396 /* The previous file index
397 */
398 int previous_file_index;
399
400 /* The current file index
401 */
402 int current_file_index;
403
404 /* The file type
405 */
406 uint8_t file_type;
407
408 /* Value to indicate a new file command was issued
409 */
410 uint8_t new_file;
411
412 /* The previous file sector
413 */
414 uint64_t previous_file_sector;
415
416 /* The file sector
417 */
418 uint64_t file_sector;
419
420 /* The previous session start sector
421 */
422 uint64_t previous_session_start_sector;
423
424 /* The previous lead-out start sector
425 */
426 uint64_t previous_lead_out_start_sector;
427
428 /* The previous track start sector
429 */
430 uint64_t previous_track_start_sector;
431
432 /* The current start sector
433 */
434 uint64_t current_start_sector;
435
436 /* The session number of sectors
437 */
438 uint64_t session_number_of_sectors;
439
440 /* The lead-out number of sectors
441 */
442 uint64_t lead_out_number_of_sectors;
443
444 /* The track number of sectors
445 */
446 uint64_t track_number_of_sectors;
447
448 /* The previous track type
449 */
450 uint8_t previous_track_type;
451
452 /* The current track type
453 */
454 uint8_t current_track_type;
455
456 /* The previous session
457 */
458 int previous_session;
459
460 /* The current session
461 */
462 int current_session;
463
464 /* The previous lead-out
465 */
466 int previous_lead_out;
467
468 /* The current lead-out
469 */
470 int current_lead_out;
471
472 /* The previous track
473 */
474 int previous_track;
475
476 /* The current track
477 */
478 int current_track;
479
480 /* The previous index
481 */
482 int previous_index;
483
484 /* The current index
485 */
486 int current_index;
487 };
488
489 typedef size_t yy_size_t;
490 typedef struct yy_buffer_state* YY_BUFFER_STATE;
491
492 extern \
493 int cue_scanner_suppress_error;
494
495 extern \
496 int cue_scanner_lex_destroy(
497 void );
498
499 extern \
500 void *cue_scanner_alloc(
501 yy_size_t size );
502
503 extern \
504 void *cue_scanner_realloc(
505 void *buffer,
506 yy_size_t size );
507
508 extern \
509 void cue_scanner_free(
510 void *buffer );
511
512 extern \
513 int cue_scanner_lex(
514 void *user_data );
515
516 extern \
517 void cue_scanner_error(
518 void *parser_state,
519 const char *error_string );
520
521 extern \
522 YY_BUFFER_STATE cue_scanner__scan_buffer(
523 char *buffer,
524 yy_size_t buffer_size );
525
526 extern \
527 void cue_scanner__delete_buffer(
528 YY_BUFFER_STATE buffer_state );
529
530 extern \
531 size_t cue_scanner_buffer_offset;
532
533 static char *cue_parser_function = "cue_parser";
534
535 int cue_parser_parse_buffer(
536 libodraw_handle_t *handle,
537 const uint8_t *buffer,
538 size_t buffer_size,
539 libcerror_error_t **error );
540
541
542
543
544 #ifdef short
545 # undef short
546 #endif
547
548 /* On compilers that do not define __PTRDIFF_MAX__ etc., make sure
549 <limits.h> and (if available) <stdint.h> are included
550 so that the code can choose integer types of a good width. */
551
552 #ifndef __PTRDIFF_MAX__
553 # include <limits.h> /* INFRINGES ON USER NAME SPACE */
554 # if defined __STDC_VERSION__ && 199901 <= __STDC_VERSION__
555 # include <stdint.h> /* INFRINGES ON USER NAME SPACE */
556 # define YY_STDINT_H
557 # endif
558 #endif
559
560 /* Narrow types that promote to a signed type and that can represent a
561 signed or unsigned integer of at least N bits. In tables they can
562 save space and decrease cache pressure. Promoting to a signed type
563 helps avoid bugs in integer arithmetic. */
564
565 #ifdef __INT_LEAST8_MAX__
566 typedef __INT_LEAST8_TYPE__ yytype_int8;
567 #elif defined YY_STDINT_H
568 typedef int_least8_t yytype_int8;
569 #else
570 typedef signed char yytype_int8;
571 #endif
572
573 #ifdef __INT_LEAST16_MAX__
574 typedef __INT_LEAST16_TYPE__ yytype_int16;
575 #elif defined YY_STDINT_H
576 typedef int_least16_t yytype_int16;
577 #else
578 typedef short yytype_int16;
579 #endif
580
581 #if defined __UINT_LEAST8_MAX__ && __UINT_LEAST8_MAX__ <= __INT_MAX__
582 typedef __UINT_LEAST8_TYPE__ yytype_uint8;
583 #elif (!defined __UINT_LEAST8_MAX__ && defined YY_STDINT_H \
584 && UINT_LEAST8_MAX <= INT_MAX)
585 typedef uint_least8_t yytype_uint8;
586 #elif !defined __UINT_LEAST8_MAX__ && UCHAR_MAX <= INT_MAX
587 typedef unsigned char yytype_uint8;
588 #else
589 typedef short yytype_uint8;
590 #endif
591
592 #if defined __UINT_LEAST16_MAX__ && __UINT_LEAST16_MAX__ <= __INT_MAX__
593 typedef __UINT_LEAST16_TYPE__ yytype_uint16;
594 #elif (!defined __UINT_LEAST16_MAX__ && defined YY_STDINT_H \
595 && UINT_LEAST16_MAX <= INT_MAX)
596 typedef uint_least16_t yytype_uint16;
597 #elif !defined __UINT_LEAST16_MAX__ && USHRT_MAX <= INT_MAX
598 typedef unsigned short yytype_uint16;
599 #else
600 typedef int yytype_uint16;
601 #endif
602
603 #ifndef YYPTRDIFF_T
604 # if defined __PTRDIFF_TYPE__ && defined __PTRDIFF_MAX__
605 # define YYPTRDIFF_T __PTRDIFF_TYPE__
606 # define YYPTRDIFF_MAXIMUM __PTRDIFF_MAX__
607 # elif defined PTRDIFF_MAX
608 # ifndef ptrdiff_t
609 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
610 # endif
611 # define YYPTRDIFF_T ptrdiff_t
612 # define YYPTRDIFF_MAXIMUM PTRDIFF_MAX
613 # else
614 # define YYPTRDIFF_T long
615 # define YYPTRDIFF_MAXIMUM LONG_MAX
616 # endif
617 #endif
618
619 #ifndef YYSIZE_T
620 # ifdef __SIZE_TYPE__
621 # define YYSIZE_T __SIZE_TYPE__
622 # elif defined size_t
623 # define YYSIZE_T size_t
624 # elif defined __STDC_VERSION__ && 199901 <= __STDC_VERSION__
625 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
626 # define YYSIZE_T size_t
627 # else
628 # define YYSIZE_T unsigned
629 # endif
630 #endif
631
632 #define YYSIZE_MAXIMUM \
633 YY_CAST (YYPTRDIFF_T, \
634 (YYPTRDIFF_MAXIMUM < YY_CAST (YYSIZE_T, -1) \
635 ? YYPTRDIFF_MAXIMUM \
636 : YY_CAST (YYSIZE_T, -1)))
637
638 #define YYSIZEOF(X) YY_CAST (YYPTRDIFF_T, sizeof (X))
639
640
641 /* Stored state numbers (used for stacks). */
642 typedef yytype_int8 yy_state_t;
643
644 /* State numbers in computations. */
645 typedef int yy_state_fast_t;
646
647 #ifndef YY_
648 # if defined YYENABLE_NLS && YYENABLE_NLS
649 # if ENABLE_NLS
650 # include <libintl.h> /* INFRINGES ON USER NAME SPACE */
651 # define YY_(Msgid) dgettext ("bison-runtime", Msgid)
652 # endif
653 # endif
654 # ifndef YY_
655 # define YY_(Msgid) Msgid
656 # endif
657 #endif
658
659
660 #ifndef YY_ATTRIBUTE_PURE
661 # if defined __GNUC__ && 2 < __GNUC__ + (96 <= __GNUC_MINOR__)
662 # define YY_ATTRIBUTE_PURE __attribute__ ((__pure__))
663 # else
664 # define YY_ATTRIBUTE_PURE
665 # endif
666 #endif
667
668 #ifndef YY_ATTRIBUTE_UNUSED
669 # if defined __GNUC__ && 2 < __GNUC__ + (7 <= __GNUC_MINOR__)
670 # define YY_ATTRIBUTE_UNUSED __attribute__ ((__unused__))
671 # else
672 # define YY_ATTRIBUTE_UNUSED
673 # endif
674 #endif
675
676 /* Suppress unused-variable warnings by "using" E. */
677 #if ! defined lint || defined __GNUC__
678 # define YYUSE(E) ((void) (E))
679 #else
680 # define YYUSE(E) /* empty */
681 #endif
682
683 #if defined __GNUC__ && ! defined __ICC && 407 <= __GNUC__ * 100 + __GNUC_MINOR__
684 /* Suppress an incorrect diagnostic about yylval being uninitialized. */
685 # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \
686 _Pragma ("GCC diagnostic push") \
687 _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"") \
688 _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"")
689 # define YY_IGNORE_MAYBE_UNINITIALIZED_END \
690 _Pragma ("GCC diagnostic pop")
691 #else
692 # define YY_INITIAL_VALUE(Value) Value
693 #endif
694 #ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
695 # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
696 # define YY_IGNORE_MAYBE_UNINITIALIZED_END
697 #endif
698 #ifndef YY_INITIAL_VALUE
699 # define YY_INITIAL_VALUE(Value) /* Nothing. */
700 #endif
701
702 #if defined __cplusplus && defined __GNUC__ && ! defined __ICC && 6 <= __GNUC__
703 # define YY_IGNORE_USELESS_CAST_BEGIN \
704 _Pragma ("GCC diagnostic push") \
705 _Pragma ("GCC diagnostic ignored \"-Wuseless-cast\"")
706 # define YY_IGNORE_USELESS_CAST_END \
707 _Pragma ("GCC diagnostic pop")
708 #endif
709 #ifndef YY_IGNORE_USELESS_CAST_BEGIN
710 # define YY_IGNORE_USELESS_CAST_BEGIN
711 # define YY_IGNORE_USELESS_CAST_END
712 #endif
713
714
715 #define YY_ASSERT(E) ((void) (0 && (E)))
716
717 #if !defined yyoverflow
718
719 /* The parser invokes alloca or malloc; define the necessary symbols. */
720
721 # ifdef YYSTACK_USE_ALLOCA
722 # if YYSTACK_USE_ALLOCA
723 # ifdef __GNUC__
724 # define YYSTACK_ALLOC __builtin_alloca
725 # elif defined __BUILTIN_VA_ARG_INCR
726 # include <alloca.h> /* INFRINGES ON USER NAME SPACE */
727 # elif defined _AIX
728 # define YYSTACK_ALLOC __alloca
729 # elif defined _MSC_VER
730 # include <malloc.h> /* INFRINGES ON USER NAME SPACE */
731 # define alloca _alloca
732 # else
733 # define YYSTACK_ALLOC alloca
734 # if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS
735 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
736 /* Use EXIT_SUCCESS as a witness for stdlib.h. */
737 # ifndef EXIT_SUCCESS
738 # define EXIT_SUCCESS 0
739 # endif
740 # endif
741 # endif
742 # endif
743 # endif
744
745 # ifdef YYSTACK_ALLOC
746 /* Pacify GCC's 'empty if-body' warning. */
747 # define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
748 # ifndef YYSTACK_ALLOC_MAXIMUM
749 /* The OS might guarantee only one guard page at the bottom of the stack,
750 and a page size can be as small as 4096 bytes. So we cannot safely
751 invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
752 to allow for a few compiler-allocated temporary stack slots. */
753 # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
754 # endif
755 # else
756 # define YYSTACK_ALLOC YYMALLOC
757 # define YYSTACK_FREE YYFREE
758 # ifndef YYSTACK_ALLOC_MAXIMUM
759 # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
760 # endif
761 # if (defined __cplusplus && ! defined EXIT_SUCCESS \
762 && ! ((defined YYMALLOC || defined malloc) \
763 && (defined YYFREE || defined free)))
764 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
765 # ifndef EXIT_SUCCESS
766 # define EXIT_SUCCESS 0
767 # endif
768 # endif
769 # ifndef YYMALLOC
770 # define YYMALLOC malloc
771 # if ! defined malloc && ! defined EXIT_SUCCESS
772 void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
773 # endif
774 # endif
775 # ifndef YYFREE
776 # define YYFREE free
777 # if ! defined free && ! defined EXIT_SUCCESS
778 void free (void *); /* INFRINGES ON USER NAME SPACE */
779 # endif
780 # endif
781 # endif
782 #endif /* !defined yyoverflow */
783
784 #if (! defined yyoverflow \
785 && (! defined __cplusplus \
786 || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
787
788 /* A type that is properly aligned for any stack member. */
789 union yyalloc
790 {
791 yy_state_t yyss_alloc;
792 YYSTYPE yyvs_alloc;
793 };
794
795 /* The size of the maximum gap between one aligned stack and the next. */
796 # define YYSTACK_GAP_MAXIMUM (YYSIZEOF (union yyalloc) - 1)
797
798 /* The size of an array large to enough to hold all stacks, each with
799 N elements. */
800 # define YYSTACK_BYTES(N) \
801 ((N) * (YYSIZEOF (yy_state_t) + YYSIZEOF (YYSTYPE)) \
802 + YYSTACK_GAP_MAXIMUM)
803
804 # define YYCOPY_NEEDED 1
805
806 /* Relocate STACK from its old location to the new one. The
807 local variables YYSIZE and YYSTACKSIZE give the old and new number of
808 elements in the stack, and YYPTR gives the new location of the
809 stack. Advance YYPTR to a properly aligned location for the next
810 stack. */
811 # define YYSTACK_RELOCATE(Stack_alloc, Stack) \
812 do \
813 { \
814 YYPTRDIFF_T yynewbytes; \
815 YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \
816 Stack = &yyptr->Stack_alloc; \
817 yynewbytes = yystacksize * YYSIZEOF (*Stack) + YYSTACK_GAP_MAXIMUM; \
818 yyptr += yynewbytes / YYSIZEOF (*yyptr); \
819 } \
820 while (0)
821
822 #endif
823
824 #if defined YYCOPY_NEEDED && YYCOPY_NEEDED
825 /* Copy COUNT objects from SRC to DST. The source and destination do
826 not overlap. */
827 # ifndef YYCOPY
828 # if defined __GNUC__ && 1 < __GNUC__
829 # define YYCOPY(Dst, Src, Count) \
830 __builtin_memcpy (Dst, Src, YY_CAST (YYSIZE_T, (Count)) * sizeof (*(Src)))
831 # else
832 # define YYCOPY(Dst, Src, Count) \
833 do \
834 { \
835 YYPTRDIFF_T yyi; \
836 for (yyi = 0; yyi < (Count); yyi++) \
837 (Dst)[yyi] = (Src)[yyi]; \
838 } \
839 while (0)
840 # endif
841 # endif
842 #endif /* !YYCOPY_NEEDED */
843
844 /* YYFINAL -- State number of the termination state. */
845 #define YYFINAL 42
846 /* YYLAST -- Last index in YYTABLE. */
847 #define YYLAST 178
848
849 /* YYNTOKENS -- Number of terminals. */
850 #define YYNTOKENS 37
851 /* YYNNTS -- Number of nonterminals. */
852 #define YYNNTS 34
853 /* YYNRULES -- Number of rules. */
854 #define YYNRULES 72
855 /* YYNSTATES -- Number of states. */
856 #define YYNSTATES 114
857
858 /* YYMAXUTOK -- Last valid token kind. */
859 #define YYMAXUTOK 291
860
861
862 /* YYTRANSLATE(TOKEN-NUM) -- Symbol number corresponding to TOKEN-NUM
863 as returned by yylex, with out-of-bounds checking. */
864 #define YYTRANSLATE(YYX) \
865 (0 <= (YYX) && (YYX) <= YYMAXUTOK \
866 ? YY_CAST (yysymbol_kind_t, yytranslate[YYX]) \
867 : YYSYMBOL_YYUNDEF)
868
869 /* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM
870 as returned by yylex. */
871 static const yytype_int8 yytranslate[] =
872 {
873 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
874 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
875 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
876 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
877 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
878 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
879 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
880 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
881 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
882 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
883 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
884 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
885 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
886 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
887 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
888 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
889 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
890 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
891 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
892 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
893 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
894 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
895 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
896 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
897 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
898 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
899 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
900 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
901 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
902 35, 36
903 };
904
905 #if YYDEBUG
906 /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */
907 static const yytype_int16 yyrline[] =
908 {
909 0, 318, 318, 322, 323, 327, 328, 329, 330, 331,
910 335, 336, 340, 344, 345, 349, 350, 351, 355, 356,
911 360, 361, 362, 363, 364, 365, 369, 370, 374, 375,
912 376, 380, 381, 385, 386, 387, 388, 392, 400, 408,
913 409, 410, 411, 412, 413, 414, 415, 416, 417, 418,
914 419, 424, 432, 530, 538, 539, 543, 792, 800, 808,
915 816, 817, 818, 819, 820, 824, 890, 898, 908, 918,
916 983, 1049, 1238
917 };
918 #endif
919
920 /** Accessing symbol of state STATE. */
921 #define YY_ACCESSING_SYMBOL(State) YY_CAST (yysymbol_kind_t, yystos[State])
922
923 #if YYDEBUG || 0
924 /* The user-facing name of the symbol whose (internal) number is
925 YYSYMBOL. No bounds checking. */
926 static const char *yysymbol_name (yysymbol_kind_t yysymbol) YY_ATTRIBUTE_UNUSED;
927
928 /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
929 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
930 static const char *const yytname[] =
931 {
932 "\"end of file\"", "error", "\"invalid token\"", "CUE_END_OF_LINE",
933 "CUE_SEMI_COLON", "CUE_2DIGIT", "CUE_CATALOG_NUMBER", "CUE_ISRC_CODE",
934 "CUE_KEYWORD_STRING", "CUE_MSF", "CUE_STRING", "CUE_CATALOG",
935 "CUE_CDTEXTFILE", "CUE_FLAGS", "CUE_FILE", "CUE_INDEX", "CUE_ISRC",
936 "CUE_POSTGAP", "CUE_PREGAP", "CUE_REMARK", "CUE_TRACK",
937 "CUE_CDTEXT_ARRANGER", "CUE_CDTEXT_COMPOSER", "CUE_CDTEXT_DISC_ID",
938 "CUE_CDTEXT_GENRE", "CUE_CDTEXT_MESSAGE", "CUE_CDTEXT_PERFORMER",
939 "CUE_CDTEXT_SIZE_INFO", "CUE_CDTEXT_SONGWRITER", "CUE_CDTEXT_TITLE",
940 "CUE_CDTEXT_TOC_INFO1", "CUE_CDTEXT_TOC_INFO2", "CUE_CDTEXT_UPC_EAN",
941 "CUE_REMARK_LEAD_OUT", "CUE_REMARK_ORIGINAL_MEDIA_TYPE",
942 "CUE_REMARK_RUN_OUT", "CUE_REMARK_SESSION", "$accept", "cue_main",
943 "cue_main_items", "cue_main_item", "cue_main_tracks", "cue_main_track",
944 "cue_main_track_preceding_items", "cue_main_track_preceding_item",
945 "cue_main_track_leading_items", "cue_main_track_leading_item",
946 "cue_main_track_index_items", "cue_main_track_index_item",
947 "cue_main_track_trailing_items", "cue_main_track_trailing_item",
948 "cue_catalog", "cue_cdtext", "cue_cdtext_type", "cue_cdtextfile",
949 "cue_file", "cue_flags", "cue_flags_types", "cue_index", "cue_isrc",
950 "cue_postgap", "cue_pregap", "cue_remark_item", "cue_lead_out",
951 "cue_original_media_type", "cue_remark", "cue_remark_start",
952 "cue_run_out", "cue_session", "cue_track", "cue_empty_line", YY_NULLPTR
953 };
954
955 static const char *
yysymbol_name(yysymbol_kind_t yysymbol)956 yysymbol_name (yysymbol_kind_t yysymbol)
957 {
958 return yytname[yysymbol];
959 }
960 #endif
961
962 #ifdef YYPRINT
963 /* YYTOKNUM[NUM] -- (External) token number corresponding to the
964 (internal) symbol number NUM (which must be that of a token). */
965 static const yytype_int16 yytoknum[] =
966 {
967 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
968 265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
969 275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
970 285, 286, 287, 288, 289, 290, 291
971 };
972 #endif
973
974 #define YYPACT_NINF (-68)
975
976 #define yypact_value_is_default(Yyn) \
977 ((Yyn) == YYPACT_NINF)
978
979 #define YYTABLE_NINF (-14)
980
981 #define yytable_value_is_error(Yyn) \
982 0
983
984 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
985 STATE-NUM. */
986 static const yytype_int16 yypact[] =
987 {
988 70, -68, -5, -6, -68, -68, -68, -68, -68, -68,
989 -68, -68, -68, -68, -68, -68, -68, 2, 4, 6,
990 11, 18, 5, 70, -68, -68, 16, -68, -68, -68,
991 -68, -68, 27, -68, -68, -68, 28, 29, 30, 37,
992 38, 39, -68, 20, 70, -68, 44, 47, -68, -68,
993 -68, -68, -68, -68, 45, 138, -68, -68, 53, -68,
994 138, 54, 142, -68, -68, -68, -68, -68, 71, 36,
995 -68, 67, 69, 72, 74, 10, 36, -68, -68, -68,
996 -68, -68, -68, 75, 69, 77, 81, 82, 83, 104,
997 10, -68, -68, -68, -68, -68, -68, -68, -68, -68,
998 78, 99, -68, 104, -68, -68, -68, -68, -68, 87,
999 106, -68, -68, -68
1000 };
1001
1002 /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM.
1003 Performed when YYTABLE does not specify something else to do. Zero
1004 means the default is an error. */
1005 static const yytype_int8 yydefact[] =
1006 {
1007 3, 72, 0, 0, 68, 39, 40, 41, 42, 43,
1008 44, 45, 46, 47, 48, 49, 50, 0, 0, 0,
1009 0, 0, 0, 3, 5, 7, 0, 6, 8, 60,
1010 61, 62, 0, 63, 64, 9, 0, 0, 0, 0,
1011 0, 0, 1, 0, 3, 4, 0, 0, 37, 51,
1012 65, 66, 69, 70, 0, 10, 38, 67, 0, 2,
1013 10, 0, 13, 15, 16, 17, 52, 11, 0, 18,
1014 14, 0, 54, 0, 0, 26, 18, 20, 21, 22,
1015 23, 24, 25, 0, 54, 0, 0, 0, 0, 31,
1016 26, 28, 29, 30, 19, 71, 55, 53, 57, 59,
1017 0, 0, 12, 31, 33, 34, 35, 36, 27, 0,
1018 0, 32, 56, 58
1019 };
1020
1021 /* YYPGOTO[NTERM-NUM]. */
1022 static const yytype_int8 yypgoto[] =
1023 {
1024 -68, -68, -17, -68, 26, -68, 48, -68, 35, -68,
1025 22, -68, 12, -68, -68, -67, -68, -68, 91, -68,
1026 32, -68, -68, -68, -68, -55, -68, -68, -68, -68,
1027 -68, -68, -68, -52
1028 };
1029
1030 /* YYDEFGOTO[NTERM-NUM]. */
1031 static const yytype_int8 yydefgoto[] =
1032 {
1033 -1, 21, 22, 23, 59, 60, 61, 62, 75, 76,
1034 89, 90, 102, 103, 24, 25, 26, 27, 63, 78,
1035 85, 91, 79, 105, 80, 28, 29, 30, 31, 32,
1036 33, 34, 69, 35
1037 };
1038
1039 /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If
1040 positive, shift that token. If negative, reduce the rule whose
1041 number is the opposite. If YYTABLE_NINF, syntax error. */
1042 static const yytype_int8 yytable[] =
1043 {
1044 64, 36, 77, 65, 37, 64, 45, 64, 65, 77,
1045 65, 38, 39, 1, 81, 40, 41, 82, 42, 43,
1046 92, 81, 104, 93, 82, 88, 46, 55, 47, 4,
1047 54, 48, 49, 50, 106, 92, 104, 107, 93, 1,
1048 51, 52, 53, 17, 18, 19, 20, 56, 106, 72,
1049 57, 107, 73, 58, 74, 4, 66, 5, 6, 7,
1050 8, 9, 10, 11, 12, 13, 14, 15, 16, 17,
1051 18, 19, 20, 1, 68, 83, 71, 84, 95, 86,
1052 97, 2, 3, 87, 98, 99, 67, 109, 100, 4,
1053 112, 5, 6, 7, 8, 9, 10, 11, 12, 13,
1054 14, 15, 16, 17, 18, 19, 20, 1, 110, 113,
1055 70, 94, 108, 44, 0, 111, 96, 0, 0, 0,
1056 0, 101, 0, 4, 0, 5, 6, 7, 8, 9,
1057 10, 11, 12, 13, 14, 15, 16, 17, 18, 19,
1058 20, 1, 0, 0, 0, 1, 0, 0, 0, 0,
1059 0, 0, 43, 0, 0, 0, 43, 4, -13, 0,
1060 0, 4, 0, 0, 0, 0, 0, 0, 0, 0,
1061 0, 17, 18, 19, 20, 17, 18, 19, 20
1062 };
1063
1064 static const yytype_int8 yycheck[] =
1065 {
1066 55, 6, 69, 55, 10, 60, 23, 62, 60, 76,
1067 62, 9, 8, 3, 69, 9, 5, 69, 0, 14,
1068 75, 76, 89, 75, 76, 15, 10, 44, 1, 19,
1069 10, 3, 3, 3, 89, 90, 103, 89, 90, 3,
1070 3, 3, 3, 33, 34, 35, 36, 3, 103, 13,
1071 3, 103, 16, 8, 18, 19, 3, 21, 22, 23,
1072 24, 25, 26, 27, 28, 29, 30, 31, 32, 33,
1073 34, 35, 36, 3, 20, 8, 5, 8, 3, 7,
1074 3, 11, 12, 9, 3, 3, 60, 9, 5, 19,
1075 3, 21, 22, 23, 24, 25, 26, 27, 28, 29,
1076 30, 31, 32, 33, 34, 35, 36, 3, 9, 3,
1077 62, 76, 90, 22, -1, 103, 84, -1, -1, -1,
1078 -1, 17, -1, 19, -1, 21, 22, 23, 24, 25,
1079 26, 27, 28, 29, 30, 31, 32, 33, 34, 35,
1080 36, 3, -1, -1, -1, 3, -1, -1, -1, -1,
1081 -1, -1, 14, -1, -1, -1, 14, 19, 20, -1,
1082 -1, 19, -1, -1, -1, -1, -1, -1, -1, -1,
1083 -1, 33, 34, 35, 36, 33, 34, 35, 36
1084 };
1085
1086 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
1087 symbol of state STATE-NUM. */
1088 static const yytype_int8 yystos[] =
1089 {
1090 0, 3, 11, 12, 19, 21, 22, 23, 24, 25,
1091 26, 27, 28, 29, 30, 31, 32, 33, 34, 35,
1092 36, 38, 39, 40, 51, 52, 53, 54, 62, 63,
1093 64, 65, 66, 67, 68, 70, 6, 10, 9, 8,
1094 9, 5, 0, 14, 55, 39, 10, 1, 3, 3,
1095 3, 3, 3, 3, 10, 39, 3, 3, 8, 41,
1096 42, 43, 44, 55, 62, 70, 3, 41, 20, 69,
1097 43, 5, 13, 16, 18, 45, 46, 52, 56, 59,
1098 61, 62, 70, 8, 8, 57, 7, 9, 15, 47,
1099 48, 58, 62, 70, 45, 3, 57, 3, 3, 3,
1100 5, 17, 49, 50, 52, 60, 62, 70, 47, 9,
1101 9, 49, 3, 3
1102 };
1103
1104 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
1105 static const yytype_int8 yyr1[] =
1106 {
1107 0, 37, 38, 39, 39, 40, 40, 40, 40, 40,
1108 41, 41, 42, 43, 43, 44, 44, 44, 45, 45,
1109 46, 46, 46, 46, 46, 46, 47, 47, 48, 48,
1110 48, 49, 49, 50, 50, 50, 50, 51, 52, 53,
1111 53, 53, 53, 53, 53, 53, 53, 53, 53, 53,
1112 53, 54, 55, 56, 57, 57, 58, 59, 60, 61,
1113 62, 62, 62, 62, 62, 63, 64, 65, 66, 67,
1114 68, 69, 70
1115 };
1116
1117 /* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN. */
1118 static const yytype_int8 yyr2[] =
1119 {
1120 0, 2, 4, 0, 2, 1, 1, 1, 1, 1,
1121 0, 2, 5, 0, 2, 1, 1, 1, 0, 2,
1122 1, 1, 1, 1, 1, 1, 0, 2, 1, 1,
1123 1, 0, 2, 1, 1, 1, 1, 3, 3, 1,
1124 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1125 1, 3, 4, 3, 0, 2, 4, 3, 3, 3,
1126 1, 1, 1, 1, 1, 3, 3, 3, 1, 3,
1127 3, 4, 1
1128 };
1129
1130
1131 enum { YYENOMEM = -2 };
1132
1133 #define yyerrok (yyerrstatus = 0)
1134 #define yyclearin (yychar = YYEMPTY)
1135
1136 #define YYACCEPT goto yyacceptlab
1137 #define YYABORT goto yyabortlab
1138 #define YYERROR goto yyerrorlab
1139
1140
1141 #define YYRECOVERING() (!!yyerrstatus)
1142
1143 #define YYBACKUP(Token, Value) \
1144 do \
1145 if (yychar == YYEMPTY) \
1146 { \
1147 yychar = (Token); \
1148 yylval = (Value); \
1149 YYPOPSTACK (yylen); \
1150 yystate = *yyssp; \
1151 goto yybackup; \
1152 } \
1153 else \
1154 { \
1155 yyerror (parser_state, YY_("syntax error: cannot back up")); \
1156 YYERROR; \
1157 } \
1158 while (0)
1159
1160 /* Backward compatibility with an undocumented macro.
1161 Use YYerror or YYUNDEF. */
1162 #define YYERRCODE YYUNDEF
1163
1164
1165 /* Enable debugging if requested. */
1166 #if YYDEBUG
1167
1168 # ifndef YYFPRINTF
1169 # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
1170 # define YYFPRINTF fprintf
1171 # endif
1172
1173 # define YYDPRINTF(Args) \
1174 do { \
1175 if (yydebug) \
1176 YYFPRINTF Args; \
1177 } while (0)
1178
1179 /* This macro is provided for backward compatibility. */
1180 # ifndef YY_LOCATION_PRINT
1181 # define YY_LOCATION_PRINT(File, Loc) ((void) 0)
1182 # endif
1183
1184
1185 # define YY_SYMBOL_PRINT(Title, Kind, Value, Location) \
1186 do { \
1187 if (yydebug) \
1188 { \
1189 YYFPRINTF (stderr, "%s ", Title); \
1190 yy_symbol_print (stderr, \
1191 Kind, Value, parser_state); \
1192 YYFPRINTF (stderr, "\n"); \
1193 } \
1194 } while (0)
1195
1196
1197 /*-----------------------------------.
1198 | Print this symbol's value on YYO. |
1199 `-----------------------------------*/
1200
1201 static void
yy_symbol_value_print(FILE * yyo,yysymbol_kind_t yykind,YYSTYPE const * const yyvaluep,void * parser_state)1202 yy_symbol_value_print (FILE *yyo,
1203 yysymbol_kind_t yykind, YYSTYPE const * const yyvaluep, void *parser_state)
1204 {
1205 FILE *yyoutput = yyo;
1206 YYUSE (yyoutput);
1207 YYUSE (parser_state);
1208 if (!yyvaluep)
1209 return;
1210 # ifdef YYPRINT
1211 if (yykind < YYNTOKENS)
1212 YYPRINT (yyo, yytoknum[yykind], *yyvaluep);
1213 # endif
1214 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1215 YYUSE (yykind);
1216 YY_IGNORE_MAYBE_UNINITIALIZED_END
1217 }
1218
1219
1220 /*---------------------------.
1221 | Print this symbol on YYO. |
1222 `---------------------------*/
1223
1224 static void
yy_symbol_print(FILE * yyo,yysymbol_kind_t yykind,YYSTYPE const * const yyvaluep,void * parser_state)1225 yy_symbol_print (FILE *yyo,
1226 yysymbol_kind_t yykind, YYSTYPE const * const yyvaluep, void *parser_state)
1227 {
1228 YYFPRINTF (yyo, "%s %s (",
1229 yykind < YYNTOKENS ? "token" : "nterm", yysymbol_name (yykind));
1230
1231 yy_symbol_value_print (yyo, yykind, yyvaluep, parser_state);
1232 YYFPRINTF (yyo, ")");
1233 }
1234
1235 /*------------------------------------------------------------------.
1236 | yy_stack_print -- Print the state stack from its BOTTOM up to its |
1237 | TOP (included). |
1238 `------------------------------------------------------------------*/
1239
1240 static void
yy_stack_print(yy_state_t * yybottom,yy_state_t * yytop)1241 yy_stack_print (yy_state_t *yybottom, yy_state_t *yytop)
1242 {
1243 YYFPRINTF (stderr, "Stack now");
1244 for (; yybottom <= yytop; yybottom++)
1245 {
1246 int yybot = *yybottom;
1247 YYFPRINTF (stderr, " %d", yybot);
1248 }
1249 YYFPRINTF (stderr, "\n");
1250 }
1251
1252 # define YY_STACK_PRINT(Bottom, Top) \
1253 do { \
1254 if (yydebug) \
1255 yy_stack_print ((Bottom), (Top)); \
1256 } while (0)
1257
1258
1259 /*------------------------------------------------.
1260 | Report that the YYRULE is going to be reduced. |
1261 `------------------------------------------------*/
1262
1263 static void
yy_reduce_print(yy_state_t * yyssp,YYSTYPE * yyvsp,int yyrule,void * parser_state)1264 yy_reduce_print (yy_state_t *yyssp, YYSTYPE *yyvsp,
1265 int yyrule, void *parser_state)
1266 {
1267 int yylno = yyrline[yyrule];
1268 int yynrhs = yyr2[yyrule];
1269 int yyi;
1270 YYFPRINTF (stderr, "Reducing stack by rule %d (line %d):\n",
1271 yyrule - 1, yylno);
1272 /* The symbols being reduced. */
1273 for (yyi = 0; yyi < yynrhs; yyi++)
1274 {
1275 YYFPRINTF (stderr, " $%d = ", yyi + 1);
1276 yy_symbol_print (stderr,
1277 YY_ACCESSING_SYMBOL (+yyssp[yyi + 1 - yynrhs]),
1278 &yyvsp[(yyi + 1) - (yynrhs)], parser_state);
1279 YYFPRINTF (stderr, "\n");
1280 }
1281 }
1282
1283 # define YY_REDUCE_PRINT(Rule) \
1284 do { \
1285 if (yydebug) \
1286 yy_reduce_print (yyssp, yyvsp, Rule, parser_state); \
1287 } while (0)
1288
1289 /* Nonzero means print parse trace. It is left uninitialized so that
1290 multiple parsers can coexist. */
1291 int yydebug;
1292 #else /* !YYDEBUG */
1293 # define YYDPRINTF(Args) ((void) 0)
1294 # define YY_SYMBOL_PRINT(Title, Kind, Value, Location)
1295 # define YY_STACK_PRINT(Bottom, Top)
1296 # define YY_REDUCE_PRINT(Rule)
1297 #endif /* !YYDEBUG */
1298
1299
1300 /* YYINITDEPTH -- initial size of the parser's stacks. */
1301 #ifndef YYINITDEPTH
1302 # define YYINITDEPTH 200
1303 #endif
1304
1305 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
1306 if the built-in stack extension method is used).
1307
1308 Do not make this value too large; the results are undefined if
1309 YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
1310 evaluated with infinite-precision integer arithmetic. */
1311
1312 #ifndef YYMAXDEPTH
1313 # define YYMAXDEPTH 10000
1314 #endif
1315
1316
1317
1318
1319
1320
1321 /*-----------------------------------------------.
1322 | Release the memory associated to this symbol. |
1323 `-----------------------------------------------*/
1324
1325 static void
yydestruct(const char * yymsg,yysymbol_kind_t yykind,YYSTYPE * yyvaluep,void * parser_state)1326 yydestruct (const char *yymsg,
1327 yysymbol_kind_t yykind, YYSTYPE *yyvaluep, void *parser_state)
1328 {
1329 YYUSE (yyvaluep);
1330 YYUSE (parser_state);
1331 if (!yymsg)
1332 yymsg = "Deleting";
1333 YY_SYMBOL_PRINT (yymsg, yykind, yyvaluep, yylocationp);
1334
1335 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1336 YYUSE (yykind);
1337 YY_IGNORE_MAYBE_UNINITIALIZED_END
1338 }
1339
1340
1341 /* Lookahead token kind. */
1342 int yychar;
1343
1344 /* The semantic value of the lookahead symbol. */
1345 YYSTYPE yylval;
1346 /* Number of syntax errors so far. */
1347 int yynerrs;
1348
1349
1350
1351
1352 /*----------.
1353 | yyparse. |
1354 `----------*/
1355
1356 int
yyparse(void * parser_state)1357 yyparse (void *parser_state)
1358 {
1359 yy_state_fast_t yystate = 0;
1360 /* Number of tokens to shift before error messages enabled. */
1361 int yyerrstatus = 0;
1362
1363 /* Refer to the stacks through separate pointers, to allow yyoverflow
1364 to reallocate them elsewhere. */
1365
1366 /* Their size. */
1367 YYPTRDIFF_T yystacksize = YYINITDEPTH;
1368
1369 /* The state stack: array, bottom, top. */
1370 yy_state_t yyssa[YYINITDEPTH];
1371 yy_state_t *yyss = yyssa;
1372 yy_state_t *yyssp = yyss;
1373
1374 /* The semantic value stack: array, bottom, top. */
1375 YYSTYPE yyvsa[YYINITDEPTH];
1376 YYSTYPE *yyvs = yyvsa;
1377 YYSTYPE *yyvsp = yyvs;
1378
1379 int yyn;
1380 /* The return value of yyparse. */
1381 int yyresult;
1382 /* Lookahead symbol kind. */
1383 yysymbol_kind_t yytoken = YYSYMBOL_YYEMPTY;
1384 /* The variables used to return semantic value and location from the
1385 action routines. */
1386 YYSTYPE yyval;
1387
1388
1389
1390 #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
1391
1392 /* The number of symbols on the RHS of the reduced rule.
1393 Keep to zero when no symbol should be popped. */
1394 int yylen = 0;
1395
1396 YYDPRINTF ((stderr, "Starting parse\n"));
1397
1398 yychar = YYEMPTY; /* Cause a token to be read. */
1399 goto yysetstate;
1400
1401
1402 /*------------------------------------------------------------.
1403 | yynewstate -- push a new state, which is found in yystate. |
1404 `------------------------------------------------------------*/
1405 yynewstate:
1406 /* In all cases, when you get here, the value and location stacks
1407 have just been pushed. So pushing a state here evens the stacks. */
1408 yyssp++;
1409
1410
1411 /*--------------------------------------------------------------------.
1412 | yysetstate -- set current state (the top of the stack) to yystate. |
1413 `--------------------------------------------------------------------*/
1414 yysetstate:
1415 YYDPRINTF ((stderr, "Entering state %d\n", yystate));
1416 YY_ASSERT (0 <= yystate && yystate < YYNSTATES);
1417 YY_IGNORE_USELESS_CAST_BEGIN
1418 *yyssp = YY_CAST (yy_state_t, yystate);
1419 YY_IGNORE_USELESS_CAST_END
1420 YY_STACK_PRINT (yyss, yyssp);
1421
1422 if (yyss + yystacksize - 1 <= yyssp)
1423 #if !defined yyoverflow && !defined YYSTACK_RELOCATE
1424 goto yyexhaustedlab;
1425 #else
1426 {
1427 /* Get the current used size of the three stacks, in elements. */
1428 YYPTRDIFF_T yysize = yyssp - yyss + 1;
1429
1430 # if defined yyoverflow
1431 {
1432 /* Give user a chance to reallocate the stack. Use copies of
1433 these so that the &'s don't force the real ones into
1434 memory. */
1435 yy_state_t *yyss1 = yyss;
1436 YYSTYPE *yyvs1 = yyvs;
1437
1438 /* Each stack pointer address is followed by the size of the
1439 data in use in that stack, in bytes. This used to be a
1440 conditional around just the two extra args, but that might
1441 be undefined if yyoverflow is a macro. */
1442 yyoverflow (YY_("memory exhausted"),
1443 &yyss1, yysize * YYSIZEOF (*yyssp),
1444 &yyvs1, yysize * YYSIZEOF (*yyvsp),
1445 &yystacksize);
1446 yyss = yyss1;
1447 yyvs = yyvs1;
1448 }
1449 # else /* defined YYSTACK_RELOCATE */
1450 /* Extend the stack our own way. */
1451 if (YYMAXDEPTH <= yystacksize)
1452 goto yyexhaustedlab;
1453 yystacksize *= 2;
1454 if (YYMAXDEPTH < yystacksize)
1455 yystacksize = YYMAXDEPTH;
1456
1457 {
1458 yy_state_t *yyss1 = yyss;
1459 union yyalloc *yyptr =
1460 YY_CAST (union yyalloc *,
1461 YYSTACK_ALLOC (YY_CAST (YYSIZE_T, YYSTACK_BYTES (yystacksize))));
1462 if (! yyptr)
1463 goto yyexhaustedlab;
1464 YYSTACK_RELOCATE (yyss_alloc, yyss);
1465 YYSTACK_RELOCATE (yyvs_alloc, yyvs);
1466 # undef YYSTACK_RELOCATE
1467 if (yyss1 != yyssa)
1468 YYSTACK_FREE (yyss1);
1469 }
1470 # endif
1471
1472 yyssp = yyss + yysize - 1;
1473 yyvsp = yyvs + yysize - 1;
1474
1475 YY_IGNORE_USELESS_CAST_BEGIN
1476 YYDPRINTF ((stderr, "Stack size increased to %ld\n",
1477 YY_CAST (long, yystacksize)));
1478 YY_IGNORE_USELESS_CAST_END
1479
1480 if (yyss + yystacksize - 1 <= yyssp)
1481 YYABORT;
1482 }
1483 #endif /* !defined yyoverflow && !defined YYSTACK_RELOCATE */
1484
1485 if (yystate == YYFINAL)
1486 YYACCEPT;
1487
1488 goto yybackup;
1489
1490
1491 /*-----------.
1492 | yybackup. |
1493 `-----------*/
1494 yybackup:
1495 /* Do appropriate processing given the current state. Read a
1496 lookahead token if we need one and don't already have one. */
1497
1498 /* First try to decide what to do without reference to lookahead token. */
1499 yyn = yypact[yystate];
1500 if (yypact_value_is_default (yyn))
1501 goto yydefault;
1502
1503 /* Not known => get a lookahead token if don't already have one. */
1504
1505 /* YYCHAR is either empty, or end-of-input, or a valid lookahead. */
1506 if (yychar == YYEMPTY)
1507 {
1508 YYDPRINTF ((stderr, "Reading a token\n"));
1509 yychar = yylex (NULL);
1510 }
1511
1512 if (yychar <= YYEOF)
1513 {
1514 yychar = YYEOF;
1515 yytoken = YYSYMBOL_YYEOF;
1516 YYDPRINTF ((stderr, "Now at end of input.\n"));
1517 }
1518 else if (yychar == YYerror)
1519 {
1520 /* The scanner already issued an error message, process directly
1521 to error recovery. But do not keep the error token as
1522 lookahead, it is too special and may lead us to an endless
1523 loop in error recovery. */
1524 yychar = YYUNDEF;
1525 yytoken = YYSYMBOL_YYerror;
1526 goto yyerrlab1;
1527 }
1528 else
1529 {
1530 yytoken = YYTRANSLATE (yychar);
1531 YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
1532 }
1533
1534 /* If the proper action on seeing token YYTOKEN is to reduce or to
1535 detect an error, take that action. */
1536 yyn += yytoken;
1537 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
1538 goto yydefault;
1539 yyn = yytable[yyn];
1540 if (yyn <= 0)
1541 {
1542 if (yytable_value_is_error (yyn))
1543 goto yyerrlab;
1544 yyn = -yyn;
1545 goto yyreduce;
1546 }
1547
1548 /* Count tokens shifted since error; after three, turn off error
1549 status. */
1550 if (yyerrstatus)
1551 yyerrstatus--;
1552
1553 /* Shift the lookahead token. */
1554 YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
1555 yystate = yyn;
1556 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1557 *++yyvsp = yylval;
1558 YY_IGNORE_MAYBE_UNINITIALIZED_END
1559
1560 /* Discard the shifted token. */
1561 yychar = YYEMPTY;
1562 goto yynewstate;
1563
1564
1565 /*-----------------------------------------------------------.
1566 | yydefault -- do the default action for the current state. |
1567 `-----------------------------------------------------------*/
1568 yydefault:
1569 yyn = yydefact[yystate];
1570 if (yyn == 0)
1571 goto yyerrlab;
1572 goto yyreduce;
1573
1574
1575 /*-----------------------------.
1576 | yyreduce -- do a reduction. |
1577 `-----------------------------*/
1578 yyreduce:
1579 /* yyn is the number of a rule to reduce with. */
1580 yylen = yyr2[yyn];
1581
1582 /* If YYLEN is nonzero, implement the default value of the action:
1583 '$$ = $1'.
1584
1585 Otherwise, the following line sets YYVAL to garbage.
1586 This behavior is undocumented and Bison
1587 users should not rely upon it. Assigning to YYVAL
1588 unconditionally makes the parser a bit smaller, and it avoids a
1589 GCC warning that YYVAL may be used uninitialized. */
1590 yyval = yyvsp[1-yylen];
1591
1592
1593 YY_REDUCE_PRINT (yyn);
1594 switch (yyn)
1595 {
1596 case 37: /* cue_catalog: CUE_CATALOG CUE_CATALOG_NUMBER CUE_END_OF_LINE */
1597 {
1598 cue_parser_rule_print(
1599 "cue_catalog" );
1600 }
1601 break;
1602
1603 case 38: /* cue_cdtext: cue_cdtext_type CUE_STRING CUE_END_OF_LINE */
1604 {
1605 cue_parser_rule_print(
1606 "cue_cdtext" );
1607 }
1608 break;
1609
1610 case 51: /* cue_cdtextfile: CUE_CDTEXTFILE CUE_STRING CUE_END_OF_LINE */
1611 {
1612 cue_parser_rule_print(
1613 "cue_cdtextfile" );
1614 }
1615 break;
1616
1617 case 52: /* cue_file: CUE_FILE CUE_STRING CUE_KEYWORD_STRING CUE_END_OF_LINE */
1618 {
1619 cue_parser_rule_print(
1620 "cue_file" );
1621
1622 if( (yyvsp[-2].string_value).data == NULL )
1623 {
1624 libcerror_error_set(
1625 ( (cue_parser_state_t *) parser_state )->error,
1626 LIBCERROR_ERROR_DOMAIN_ARGUMENTS,
1627 LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE,
1628 "%s: invalid filename.",
1629 cue_parser_function );
1630
1631 YYABORT;
1632 }
1633 /* TODO what about the string quotation marks */
1634 if( (yyvsp[-1].string_value).data == NULL )
1635 {
1636 libcerror_error_set(
1637 ( (cue_parser_state_t *) parser_state )->error,
1638 LIBCERROR_ERROR_DOMAIN_ARGUMENTS,
1639 LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE,
1640 "%s: invalid file type.",
1641 cue_parser_function );
1642
1643 YYABORT;
1644 }
1645 ( (cue_parser_state_t *) parser_state )->file_type = LIBODRAW_FILE_TYPE_UNKNOWN;
1646
1647 if( (yyvsp[-1].string_value).length == 3 )
1648 {
1649 if( narrow_string_compare(
1650 (yyvsp[-1].string_value).data,
1651 "MP3",
1652 3 ) == 0 )
1653 {
1654 ( (cue_parser_state_t *) parser_state )->file_type = LIBODRAW_FILE_TYPE_AUDIO_MPEG1_LAYER3;
1655 }
1656 }
1657 else if( (yyvsp[-1].string_value).length == 4 )
1658 {
1659 if( narrow_string_compare(
1660 (yyvsp[-1].string_value).data,
1661 "AIFF",
1662 4 ) == 0 )
1663 {
1664 ( (cue_parser_state_t *) parser_state )->file_type = LIBODRAW_FILE_TYPE_AUDIO_AIFF;
1665 }
1666 else if( narrow_string_compare(
1667 (yyvsp[-1].string_value).data,
1668 "WAVE",
1669 4 ) == 0 )
1670 {
1671 ( (cue_parser_state_t *) parser_state )->file_type = LIBODRAW_FILE_TYPE_AUDIO_WAVE;
1672 }
1673 }
1674 else if( (yyvsp[-1].string_value).length == 6 )
1675 {
1676 if( narrow_string_compare(
1677 (yyvsp[-1].string_value).data,
1678 "BINARY",
1679 6 ) == 0 )
1680 {
1681 ( (cue_parser_state_t *) parser_state )->file_type = LIBODRAW_FILE_TYPE_BINARY_LITTLE_ENDIAN;
1682 }
1683 }
1684 else if( (yyvsp[-1].string_value).length == 8 )
1685 {
1686 if( narrow_string_compare(
1687 (yyvsp[-1].string_value).data,
1688 "MOTOROLA",
1689 8 ) == 0 )
1690 {
1691 ( (cue_parser_state_t *) parser_state )->file_type = LIBODRAW_FILE_TYPE_BINARY_BIG_ENDIAN;
1692 }
1693 }
1694 if( libodraw_handle_append_data_file(
1695 ( (cue_parser_state_t *) parser_state )->handle,
1696 (yyvsp[-2].string_value).data,
1697 (yyvsp[-2].string_value).length,
1698 ( (cue_parser_state_t *) parser_state )->file_type,
1699 ( (cue_parser_state_t *) parser_state )->error ) != 1 )
1700 {
1701 libcerror_error_set(
1702 ( (cue_parser_state_t *) parser_state )->error,
1703 LIBCERROR_ERROR_DOMAIN_RUNTIME,
1704 LIBCERROR_RUNTIME_ERROR_APPEND_FAILED,
1705 "%s: unable to append data file.",
1706 cue_parser_function );
1707
1708 YYABORT;
1709 }
1710 ( (cue_parser_state_t *) parser_state )->current_file_index += 1;
1711 }
1712 break;
1713
1714 case 53: /* cue_flags: CUE_FLAGS cue_flags_types CUE_END_OF_LINE */
1715 {
1716 cue_parser_rule_print(
1717 "cue_flags" );
1718 }
1719 break;
1720
1721 case 56: /* cue_index: CUE_INDEX CUE_2DIGIT CUE_MSF CUE_END_OF_LINE */
1722 {
1723 cue_parser_rule_print(
1724 "cue_index" );
1725
1726 if( (yyvsp[-2].string_value).data == NULL )
1727 {
1728 libcerror_error_set(
1729 ( (cue_parser_state_t *) parser_state )->error,
1730 LIBCERROR_ERROR_DOMAIN_ARGUMENTS,
1731 LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE,
1732 "%s: invalid index number.",
1733 cue_parser_function );
1734
1735 YYABORT;
1736 }
1737 ( (cue_parser_state_t *) parser_state )->previous_index = ( (cue_parser_state_t *) parser_state )->current_index;
1738
1739 if( ( ( (yyvsp[-2].string_value).data )[ 0 ] < '0' )
1740 || ( ( (yyvsp[-2].string_value).data )[ 0 ] > '9' ) )
1741 {
1742 libcerror_error_set(
1743 ( (cue_parser_state_t *) parser_state )->error,
1744 LIBCERROR_ERROR_DOMAIN_ARGUMENTS,
1745 LIBCERROR_ARGUMENT_ERROR_UNSUPPORTED_VALUE,
1746 "%s: unsupported index number.",
1747 cue_parser_function );
1748
1749 YYABORT;
1750 }
1751 ( (cue_parser_state_t *) parser_state )->current_index = ( (yyvsp[-2].string_value).data )[ 0 ] - '0';
1752
1753 if( (yyvsp[-2].string_value).length == 2 )
1754 {
1755 ( (cue_parser_state_t *) parser_state )->current_index *= 10;
1756
1757 if( ( ( (yyvsp[-2].string_value).data )[ 1 ] < '0' )
1758 || ( ( (yyvsp[-2].string_value).data )[ 1 ] > '9' ) )
1759 {
1760 libcerror_error_set(
1761 ( (cue_parser_state_t *) parser_state )->error,
1762 LIBCERROR_ERROR_DOMAIN_ARGUMENTS,
1763 LIBCERROR_ARGUMENT_ERROR_UNSUPPORTED_VALUE,
1764 "%s: unsupported index number.",
1765 cue_parser_function );
1766
1767 YYABORT;
1768 }
1769 ( (cue_parser_state_t *) parser_state )->current_index += ( (yyvsp[-2].string_value).data )[ 1 ] - '0';
1770 }
1771 if( ( ( (cue_parser_state_t *) parser_state )->current_index != 0 )
1772 && ( ( (cue_parser_state_t *) parser_state )->current_index != ( ( (cue_parser_state_t *) parser_state )->previous_index + 1 ) ) )
1773 {
1774 libcerror_error_set(
1775 ( (cue_parser_state_t *) parser_state )->error,
1776 LIBCERROR_ERROR_DOMAIN_RUNTIME,
1777 LIBCERROR_RUNTIME_ERROR_UNSUPPORTED_VALUE,
1778 "%s: unsupported index number - values are not sequential.",
1779 cue_parser_function );
1780
1781 YYABORT;
1782 }
1783 if( ( (yyvsp[-1].string_value).data == NULL )
1784 || ( (yyvsp[-1].string_value).length != 8 ) )
1785 {
1786 libcerror_error_set(
1787 ( (cue_parser_state_t *) parser_state )->error,
1788 LIBCERROR_ERROR_DOMAIN_ARGUMENTS,
1789 LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE,
1790 "%s: invalid index MSF.",
1791 cue_parser_function );
1792
1793 YYABORT;
1794 }
1795 if( ( ( (yyvsp[-1].string_value).data )[ 0 ] < '0' )
1796 || ( ( (yyvsp[-1].string_value).data )[ 0 ] > '9' )
1797 || ( ( (yyvsp[-1].string_value).data )[ 1 ] < '0' )
1798 || ( ( (yyvsp[-1].string_value).data )[ 1 ] > '9' )
1799 || ( ( (yyvsp[-1].string_value).data )[ 2 ] != ':' )
1800 || ( ( (yyvsp[-1].string_value).data )[ 3 ] < '0' )
1801 || ( ( (yyvsp[-1].string_value).data )[ 3 ] > '9' )
1802 || ( ( (yyvsp[-1].string_value).data )[ 4 ] < '0' )
1803 || ( ( (yyvsp[-1].string_value).data )[ 4 ] > '9' )
1804 || ( ( (yyvsp[-1].string_value).data )[ 5 ] != ':' )
1805 || ( ( (yyvsp[-1].string_value).data )[ 6 ] < '0' )
1806 || ( ( (yyvsp[-1].string_value).data )[ 6 ] > '9' )
1807 || ( ( (yyvsp[-1].string_value).data )[ 7 ] < '0' )
1808 || ( ( (yyvsp[-1].string_value).data )[ 7 ] > '9' ) )
1809 {
1810 libcerror_error_set(
1811 ( (cue_parser_state_t *) parser_state )->error,
1812 LIBCERROR_ERROR_DOMAIN_ARGUMENTS,
1813 LIBCERROR_ARGUMENT_ERROR_UNSUPPORTED_VALUE,
1814 "%s: unsupported index MSF.",
1815 cue_parser_function );
1816
1817 YYABORT;
1818 }
1819 cue_parser_copy_relative_msf_to_lba(
1820 (yyvsp[-1].string_value).data,
1821 ( (cue_parser_state_t *) parser_state )->current_start_sector );
1822
1823 /* The MSF can be relative to the start of the file
1824 */
1825 if( ( (cue_parser_state_t *) parser_state )->current_start_sector != 0 )
1826 {
1827 if( ( ( (cue_parser_state_t *) parser_state )->current_index == 0 )
1828 || ( ( (cue_parser_state_t *) parser_state )->current_index == 1 ) )
1829 {
1830 if( ( ( (cue_parser_state_t *) parser_state )->session_number_of_sectors == 0 )
1831 || ( ( (cue_parser_state_t *) parser_state )->previous_track_type == LIBODRAW_TRACK_TYPE_AUDIO ) )
1832 {
1833 if( ( (cue_parser_state_t *) parser_state )->current_start_sector < ( (cue_parser_state_t *) parser_state )->previous_session_start_sector )
1834 {
1835 libcerror_error_set(
1836 ( (cue_parser_state_t *) parser_state )->error,
1837 LIBCERROR_ERROR_DOMAIN_RUNTIME,
1838 LIBCERROR_RUNTIME_ERROR_VALUE_OUT_OF_BOUNDS,
1839 "%s: invalid session start sector value preceeds previous.",
1840 cue_parser_function );
1841
1842 YYABORT;
1843 }
1844 ( (cue_parser_state_t *) parser_state )->session_number_of_sectors = ( (cue_parser_state_t *) parser_state )->current_start_sector
1845 - ( (cue_parser_state_t *) parser_state )->previous_session_start_sector;
1846 }
1847 if( ( ( (cue_parser_state_t *) parser_state )->lead_out_number_of_sectors == 0 )
1848 || ( ( (cue_parser_state_t *) parser_state )->previous_track_type == LIBODRAW_TRACK_TYPE_AUDIO ) )
1849 {
1850 if( ( (cue_parser_state_t *) parser_state )->current_start_sector < ( (cue_parser_state_t *) parser_state )->previous_lead_out_start_sector )
1851 {
1852 libcerror_error_set(
1853 ( (cue_parser_state_t *) parser_state )->error,
1854 LIBCERROR_ERROR_DOMAIN_RUNTIME,
1855 LIBCERROR_RUNTIME_ERROR_VALUE_OUT_OF_BOUNDS,
1856 "%s: invalid lead-out start sector value preceeds previous.",
1857 cue_parser_function );
1858
1859 YYABORT;
1860 }
1861 ( (cue_parser_state_t *) parser_state )->lead_out_number_of_sectors = ( (cue_parser_state_t *) parser_state )->current_start_sector
1862 - ( (cue_parser_state_t *) parser_state )->previous_lead_out_start_sector;
1863 }
1864 }
1865 if( ( (cue_parser_state_t *) parser_state )->current_index == 1 )
1866 {
1867 if( ( (cue_parser_state_t *) parser_state )->track_number_of_sectors == 0 )
1868 {
1869 if( ( (cue_parser_state_t *) parser_state )->current_start_sector < ( (cue_parser_state_t *) parser_state )->previous_track_start_sector )
1870 {
1871 libcerror_error_set(
1872 ( (cue_parser_state_t *) parser_state )->error,
1873 LIBCERROR_ERROR_DOMAIN_RUNTIME,
1874 LIBCERROR_RUNTIME_ERROR_VALUE_OUT_OF_BOUNDS,
1875 "%s: invalid track start sector value preceeds previous.",
1876 cue_parser_function );
1877
1878 YYABORT;
1879 }
1880 ( (cue_parser_state_t *) parser_state )->track_number_of_sectors = ( (cue_parser_state_t *) parser_state )->current_start_sector
1881 - ( (cue_parser_state_t *) parser_state )->previous_track_start_sector;
1882 }
1883 }
1884 }
1885 if( ( (cue_parser_state_t *) parser_state )->current_index == 1 )
1886 {
1887 if( ( (cue_parser_state_t *) parser_state )->current_session > 1 )
1888 {
1889 if( libodraw_handle_append_session(
1890 ( (cue_parser_state_t *) parser_state )->handle,
1891 ( (cue_parser_state_t *) parser_state )->previous_session_start_sector,
1892 ( (cue_parser_state_t *) parser_state )->session_number_of_sectors,
1893 ( (cue_parser_state_t *) parser_state )->error ) != 1 )
1894 {
1895 libcerror_error_set(
1896 ( (cue_parser_state_t *) parser_state )->error,
1897 LIBCERROR_ERROR_DOMAIN_RUNTIME,
1898 LIBCERROR_RUNTIME_ERROR_APPEND_FAILED,
1899 "%s: unable to append session.",
1900 cue_parser_function );
1901
1902 YYABORT;
1903 }
1904 ( (cue_parser_state_t *) parser_state )->previous_session_start_sector = ( (cue_parser_state_t *) parser_state )->current_start_sector;
1905 ( (cue_parser_state_t *) parser_state )->session_number_of_sectors = 0;
1906 }
1907 if( ( (cue_parser_state_t *) parser_state )->current_lead_out > ( (cue_parser_state_t *) parser_state )->previous_lead_out )
1908 {
1909 if( libodraw_handle_append_lead_out(
1910 ( (cue_parser_state_t *) parser_state )->handle,
1911 ( (cue_parser_state_t *) parser_state )->previous_lead_out_start_sector,
1912 ( (cue_parser_state_t *) parser_state )->lead_out_number_of_sectors,
1913 ( (cue_parser_state_t *) parser_state )->error ) != 1 )
1914 {
1915 libcerror_error_set(
1916 ( (cue_parser_state_t *) parser_state )->error,
1917 LIBCERROR_ERROR_DOMAIN_RUNTIME,
1918 LIBCERROR_RUNTIME_ERROR_APPEND_FAILED,
1919 "%s: unable to append lead-out.",
1920 cue_parser_function );
1921
1922 YYABORT;
1923 }
1924 ( (cue_parser_state_t *) parser_state )->previous_lead_out = ( (cue_parser_state_t *) parser_state )->current_lead_out;
1925 ( (cue_parser_state_t *) parser_state )->lead_out_number_of_sectors = 0;
1926 }
1927 if( ( (cue_parser_state_t *) parser_state )->current_track > 1 )
1928 {
1929 if( ( (cue_parser_state_t *) parser_state )->previous_file_index < 0 )
1930 {
1931 ( (cue_parser_state_t *) parser_state )->file_sector = ( (cue_parser_state_t *) parser_state )->previous_track_start_sector;
1932
1933 ( (cue_parser_state_t *) parser_state )->previous_file_index += 1;
1934 }
1935 ( (cue_parser_state_t *) parser_state )->previous_file_sector = ( (cue_parser_state_t *) parser_state )->previous_track_start_sector
1936 - ( (cue_parser_state_t *) parser_state )->file_sector;
1937
1938 if( libodraw_handle_append_track(
1939 ( (cue_parser_state_t *) parser_state )->handle,
1940 ( (cue_parser_state_t *) parser_state )->previous_track_start_sector,
1941 ( (cue_parser_state_t *) parser_state )->track_number_of_sectors,
1942 ( (cue_parser_state_t *) parser_state )->previous_track_type,
1943 ( (cue_parser_state_t *) parser_state )->previous_file_index,
1944 ( (cue_parser_state_t *) parser_state )->previous_file_sector,
1945 ( (cue_parser_state_t *) parser_state )->error ) != 1 )
1946 {
1947 libcerror_error_set(
1948 ( (cue_parser_state_t *) parser_state )->error,
1949 LIBCERROR_ERROR_DOMAIN_RUNTIME,
1950 LIBCERROR_RUNTIME_ERROR_APPEND_FAILED,
1951 "%s: unable to append track.",
1952 cue_parser_function );
1953
1954 YYABORT;
1955 }
1956 if( ( (cue_parser_state_t *) parser_state )->previous_file_index < ( (cue_parser_state_t *) parser_state )->current_file_index )
1957 {
1958 ( (cue_parser_state_t *) parser_state )->file_sector = ( (cue_parser_state_t *) parser_state )->current_start_sector;
1959
1960 ( (cue_parser_state_t *) parser_state )->previous_file_index += 1;
1961 }
1962 ( (cue_parser_state_t *) parser_state )->previous_track_start_sector = ( (cue_parser_state_t *) parser_state )->current_start_sector;
1963 ( (cue_parser_state_t *) parser_state )->track_number_of_sectors = 0;
1964 }
1965 }
1966 }
1967 break;
1968
1969 case 57: /* cue_isrc: CUE_ISRC CUE_ISRC_CODE CUE_END_OF_LINE */
1970 {
1971 cue_parser_rule_print(
1972 "cue_isrc" );
1973 }
1974 break;
1975
1976 case 58: /* cue_postgap: CUE_POSTGAP CUE_MSF CUE_END_OF_LINE */
1977 {
1978 cue_parser_rule_print(
1979 "cue_postgap" );
1980 }
1981 break;
1982
1983 case 59: /* cue_pregap: CUE_PREGAP CUE_MSF CUE_END_OF_LINE */
1984 {
1985 cue_parser_rule_print(
1986 "cue_pregap" );
1987 }
1988 break;
1989
1990 case 65: /* cue_lead_out: CUE_REMARK_LEAD_OUT CUE_MSF CUE_END_OF_LINE */
1991 {
1992 cue_parser_rule_print(
1993 "cue_lead_out" );
1994
1995 if( ( (yyvsp[-1].string_value).data == NULL )
1996 || ( (yyvsp[-1].string_value).length != 8 ) )
1997 {
1998 libcerror_error_set(
1999 ( (cue_parser_state_t *) parser_state )->error,
2000 LIBCERROR_ERROR_DOMAIN_ARGUMENTS,
2001 LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE,
2002 "%s: invalid index MSF.",
2003 cue_parser_function );
2004
2005 YYABORT;
2006 }
2007 if( ( ( (yyvsp[-1].string_value).data )[ 0 ] < '0' )
2008 || ( ( (yyvsp[-1].string_value).data )[ 0 ] > '9' )
2009 || ( ( (yyvsp[-1].string_value).data )[ 1 ] < '0' )
2010 || ( ( (yyvsp[-1].string_value).data )[ 1 ] > '9' )
2011 || ( ( (yyvsp[-1].string_value).data )[ 2 ] != ':' )
2012 || ( ( (yyvsp[-1].string_value).data )[ 3 ] < '0' )
2013 || ( ( (yyvsp[-1].string_value).data )[ 3 ] > '9' )
2014 || ( ( (yyvsp[-1].string_value).data )[ 4 ] < '0' )
2015 || ( ( (yyvsp[-1].string_value).data )[ 4 ] > '9' )
2016 || ( ( (yyvsp[-1].string_value).data )[ 5 ] != ':' )
2017 || ( ( (yyvsp[-1].string_value).data )[ 6 ] < '0' )
2018 || ( ( (yyvsp[-1].string_value).data )[ 6 ] > '9' )
2019 || ( ( (yyvsp[-1].string_value).data )[ 7 ] < '0' )
2020 || ( ( (yyvsp[-1].string_value).data )[ 7 ] > '9' ) )
2021 {
2022 libcerror_error_set(
2023 ( (cue_parser_state_t *) parser_state )->error,
2024 LIBCERROR_ERROR_DOMAIN_ARGUMENTS,
2025 LIBCERROR_ARGUMENT_ERROR_UNSUPPORTED_VALUE,
2026 "%s: unsupported index MSF.",
2027 cue_parser_function );
2028
2029 YYABORT;
2030 }
2031 cue_parser_copy_relative_msf_to_lba(
2032 (yyvsp[-1].string_value).data,
2033 ( (cue_parser_state_t *) parser_state )->previous_lead_out_start_sector );
2034
2035 if( ( (cue_parser_state_t *) parser_state )->track_number_of_sectors == 0 )
2036 {
2037 if( ( (cue_parser_state_t *) parser_state )->previous_lead_out_start_sector < ( (cue_parser_state_t *) parser_state )->previous_track_start_sector )
2038 {
2039 libcerror_error_set(
2040 ( (cue_parser_state_t *) parser_state )->error,
2041 LIBCERROR_ERROR_DOMAIN_RUNTIME,
2042 LIBCERROR_RUNTIME_ERROR_VALUE_OUT_OF_BOUNDS,
2043 "%s: invalid lead-out start sector value preceeds previous track start sector.",
2044 cue_parser_function );
2045
2046 YYABORT;
2047 }
2048 ( (cue_parser_state_t *) parser_state )->track_number_of_sectors = ( (cue_parser_state_t *) parser_state )->previous_lead_out_start_sector
2049 - ( (cue_parser_state_t *) parser_state )->previous_track_start_sector;
2050 }
2051 ( (cue_parser_state_t *) parser_state )->current_lead_out += 1;
2052 }
2053 break;
2054
2055 case 66: /* cue_original_media_type: CUE_REMARK_ORIGINAL_MEDIA_TYPE CUE_KEYWORD_STRING CUE_END_OF_LINE */
2056 {
2057 cue_parser_rule_print(
2058 "cue_original_media_type" );
2059 }
2060 break;
2061
2062 case 67: /* cue_remark: cue_remark_start error CUE_END_OF_LINE */
2063 {
2064 cue_parser_rule_print(
2065 "cue_remark" );
2066
2067 cue_scanner_suppress_error = 0;
2068 }
2069 break;
2070
2071 case 68: /* cue_remark_start: CUE_REMARK */
2072 {
2073 /* The build-in rule error will gobble up all the tokens until the end-of-line
2074 * because these are no syntax errors suppress the error output
2075 */
2076 cue_scanner_suppress_error = 1;
2077 }
2078 break;
2079
2080 case 69: /* cue_run_out: CUE_REMARK_RUN_OUT CUE_MSF CUE_END_OF_LINE */
2081 {
2082 cue_parser_rule_print(
2083 "cue_run_out" );
2084
2085 if( ( (yyvsp[-1].string_value).data == NULL )
2086 || ( (yyvsp[-1].string_value).length != 8 ) )
2087 {
2088 libcerror_error_set(
2089 ( (cue_parser_state_t *) parser_state )->error,
2090 LIBCERROR_ERROR_DOMAIN_ARGUMENTS,
2091 LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE,
2092 "%s: invalid index MSF.",
2093 cue_parser_function );
2094
2095 YYABORT;
2096 }
2097 if( ( ( (yyvsp[-1].string_value).data )[ 0 ] < '0' )
2098 || ( ( (yyvsp[-1].string_value).data )[ 0 ] > '9' )
2099 || ( ( (yyvsp[-1].string_value).data )[ 1 ] < '0' )
2100 || ( ( (yyvsp[-1].string_value).data )[ 1 ] > '9' )
2101 || ( ( (yyvsp[-1].string_value).data )[ 2 ] != ':' )
2102 || ( ( (yyvsp[-1].string_value).data )[ 3 ] < '0' )
2103 || ( ( (yyvsp[-1].string_value).data )[ 3 ] > '9' )
2104 || ( ( (yyvsp[-1].string_value).data )[ 4 ] < '0' )
2105 || ( ( (yyvsp[-1].string_value).data )[ 4 ] > '9' )
2106 || ( ( (yyvsp[-1].string_value).data )[ 5 ] != ':' )
2107 || ( ( (yyvsp[-1].string_value).data )[ 6 ] < '0' )
2108 || ( ( (yyvsp[-1].string_value).data )[ 6 ] > '9' )
2109 || ( ( (yyvsp[-1].string_value).data )[ 7 ] < '0' )
2110 || ( ( (yyvsp[-1].string_value).data )[ 7 ] > '9' ) )
2111 {
2112 libcerror_error_set(
2113 ( (cue_parser_state_t *) parser_state )->error,
2114 LIBCERROR_ERROR_DOMAIN_ARGUMENTS,
2115 LIBCERROR_ARGUMENT_ERROR_UNSUPPORTED_VALUE,
2116 "%s: unsupported index MSF.",
2117 cue_parser_function );
2118
2119 YYABORT;
2120 }
2121 cue_parser_copy_relative_msf_to_lba(
2122 (yyvsp[-1].string_value).data,
2123 ( (cue_parser_state_t *) parser_state )->current_start_sector );
2124
2125 if( ( (cue_parser_state_t *) parser_state )->track_number_of_sectors == 0 )
2126 {
2127 if( ( (cue_parser_state_t *) parser_state )->current_start_sector < ( (cue_parser_state_t *) parser_state )->previous_track_start_sector )
2128 {
2129 libcerror_error_set(
2130 ( (cue_parser_state_t *) parser_state )->error,
2131 LIBCERROR_ERROR_DOMAIN_RUNTIME,
2132 LIBCERROR_RUNTIME_ERROR_VALUE_OUT_OF_BOUNDS,
2133 "%s: invalid track start sector value preceeds previous.",
2134 cue_parser_function );
2135
2136 YYABORT;
2137 }
2138 ( (cue_parser_state_t *) parser_state )->track_number_of_sectors = ( (cue_parser_state_t *) parser_state )->current_start_sector
2139 - ( (cue_parser_state_t *) parser_state )->previous_track_start_sector;
2140 }
2141 }
2142 break;
2143
2144 case 70: /* cue_session: CUE_REMARK_SESSION CUE_2DIGIT CUE_END_OF_LINE */
2145 {
2146 cue_parser_rule_print(
2147 "cue_session" );
2148
2149 if( (yyvsp[-1].string_value).data == NULL )
2150 {
2151 libcerror_error_set(
2152 ( (cue_parser_state_t *) parser_state )->error,
2153 LIBCERROR_ERROR_DOMAIN_ARGUMENTS,
2154 LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE,
2155 "%s: invalid session number.",
2156 cue_parser_function );
2157
2158 YYABORT;
2159 }
2160 ( (cue_parser_state_t *) parser_state )->previous_session = ( (cue_parser_state_t *) parser_state )->current_session;
2161
2162 if( ( ( (yyvsp[-1].string_value).data )[ 0 ] < '0' )
2163 || ( ( (yyvsp[-1].string_value).data )[ 0 ] > '9' ) )
2164 {
2165 libcerror_error_set(
2166 ( (cue_parser_state_t *) parser_state )->error,
2167 LIBCERROR_ERROR_DOMAIN_ARGUMENTS,
2168 LIBCERROR_ARGUMENT_ERROR_UNSUPPORTED_VALUE,
2169 "%s: unsupported session number.",
2170 cue_parser_function );
2171
2172 YYABORT;
2173 }
2174 ( (cue_parser_state_t *) parser_state )->current_session = ( (yyvsp[-1].string_value).data )[ 0 ] - '0';
2175
2176 if( (yyvsp[-1].string_value).length == 2 )
2177 {
2178 ( (cue_parser_state_t *) parser_state )->current_session *= 10;
2179
2180 if( ( ( (yyvsp[-1].string_value).data )[ 1 ] < '0' )
2181 || ( ( (yyvsp[-1].string_value).data )[ 1 ] > '9' ) )
2182 {
2183 libcerror_error_set(
2184 ( (cue_parser_state_t *) parser_state )->error,
2185 LIBCERROR_ERROR_DOMAIN_ARGUMENTS,
2186 LIBCERROR_ARGUMENT_ERROR_UNSUPPORTED_VALUE,
2187 "%s: unsupported session number.",
2188 cue_parser_function );
2189
2190 YYABORT;
2191 }
2192 ( (cue_parser_state_t *) parser_state )->current_session += ( (yyvsp[-1].string_value).data )[ 1 ] - '0';
2193 }
2194 if( ( ( (cue_parser_state_t *) parser_state )->current_session != 0 )
2195 && ( ( (cue_parser_state_t *) parser_state )->current_session != ( ( (cue_parser_state_t *) parser_state )->previous_session + 1 ) ) )
2196 {
2197 libcerror_error_set(
2198 ( (cue_parser_state_t *) parser_state )->error,
2199 LIBCERROR_ERROR_DOMAIN_RUNTIME,
2200 LIBCERROR_RUNTIME_ERROR_UNSUPPORTED_VALUE,
2201 "%s: unsupported session number - values are not sequential.",
2202 cue_parser_function );
2203
2204 YYABORT;
2205 }
2206 }
2207 break;
2208
2209 case 71: /* cue_track: CUE_TRACK CUE_2DIGIT CUE_KEYWORD_STRING CUE_END_OF_LINE */
2210 {
2211 cue_parser_rule_print(
2212 "cue_track" );
2213
2214 if( (yyvsp[-2].string_value).data == NULL )
2215 {
2216 libcerror_error_set(
2217 ( (cue_parser_state_t *) parser_state )->error,
2218 LIBCERROR_ERROR_DOMAIN_ARGUMENTS,
2219 LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE,
2220 "%s: invalid track number.",
2221 cue_parser_function );
2222
2223 YYABORT;
2224 }
2225 ( (cue_parser_state_t *) parser_state )->previous_track = ( (cue_parser_state_t *) parser_state )->current_track;
2226
2227 if( ( ( (yyvsp[-2].string_value).data )[ 0 ] < '0' )
2228 || ( ( (yyvsp[-2].string_value).data )[ 0 ] > '9' ) )
2229 {
2230 libcerror_error_set(
2231 ( (cue_parser_state_t *) parser_state )->error,
2232 LIBCERROR_ERROR_DOMAIN_ARGUMENTS,
2233 LIBCERROR_ARGUMENT_ERROR_UNSUPPORTED_VALUE,
2234 "%s: unsupported track number.",
2235 cue_parser_function );
2236
2237 YYABORT;
2238 }
2239 ( (cue_parser_state_t *) parser_state )->current_track = ( (yyvsp[-2].string_value).data )[ 0 ] - '0';
2240
2241 if( (yyvsp[-2].string_value).length == 2 )
2242 {
2243 ( (cue_parser_state_t *) parser_state )->current_track *= 10;
2244
2245 if( ( ( (yyvsp[-2].string_value).data )[ 1 ] < '0' )
2246 || ( ( (yyvsp[-2].string_value).data )[ 1 ] > '9' ) )
2247 {
2248 libcerror_error_set(
2249 ( (cue_parser_state_t *) parser_state )->error,
2250 LIBCERROR_ERROR_DOMAIN_ARGUMENTS,
2251 LIBCERROR_ARGUMENT_ERROR_UNSUPPORTED_VALUE,
2252 "%s: unsupported track number.",
2253 cue_parser_function );
2254
2255 YYABORT;
2256 }
2257 ( (cue_parser_state_t *) parser_state )->current_track += ( (yyvsp[-2].string_value).data )[ 1 ] - '0';
2258 }
2259 if( ( ( (cue_parser_state_t *) parser_state )->current_track != 0 )
2260 && ( ( (cue_parser_state_t *) parser_state )->current_track != ( ( (cue_parser_state_t *) parser_state )->previous_track + 1 ) ) )
2261 {
2262 libcerror_error_set(
2263 ( (cue_parser_state_t *) parser_state )->error,
2264 LIBCERROR_ERROR_DOMAIN_RUNTIME,
2265 LIBCERROR_RUNTIME_ERROR_UNSUPPORTED_VALUE,
2266 "%s: unsupported track number - values are not sequential.",
2267 cue_parser_function );
2268
2269 YYABORT;
2270 }
2271 if( (yyvsp[-1].string_value).data == NULL )
2272 {
2273 libcerror_error_set(
2274 ( (cue_parser_state_t *) parser_state )->error,
2275 LIBCERROR_ERROR_DOMAIN_ARGUMENTS,
2276 LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE,
2277 "%s: invalid track number.",
2278 cue_parser_function );
2279
2280 YYABORT;
2281 }
2282 ( (cue_parser_state_t *) parser_state )->previous_track_type = ( (cue_parser_state_t *) parser_state )->current_track_type;
2283
2284 ( (cue_parser_state_t *) parser_state )->previous_index = 0;
2285 ( (cue_parser_state_t *) parser_state )->current_index = 0;
2286 ( (cue_parser_state_t *) parser_state )->current_track_type = LIBODRAW_TRACK_TYPE_UNKNOWN;
2287
2288 if( (yyvsp[-1].string_value).length == 3 )
2289 {
2290 if( narrow_string_compare(
2291 (yyvsp[-1].string_value).data,
2292 "CDG",
2293 3 ) == 0 )
2294 {
2295 ( (cue_parser_state_t *) parser_state )->current_track_type = LIBODRAW_TRACK_TYPE_CDG;
2296 }
2297 }
2298 else if( (yyvsp[-1].string_value).length == 5 )
2299 {
2300 if( narrow_string_compare(
2301 (yyvsp[-1].string_value).data,
2302 "AUDIO",
2303 5 ) == 0 )
2304 {
2305 ( (cue_parser_state_t *) parser_state )->current_track_type = LIBODRAW_TRACK_TYPE_AUDIO;
2306 }
2307 }
2308 else if( (yyvsp[-1].string_value).length == 8 )
2309 {
2310 if( narrow_string_compare(
2311 (yyvsp[-1].string_value).data,
2312 "CDI",
2313 3 ) == 0 )
2314 {
2315 if( ( (yyvsp[-1].string_value).data )[ 3 ] == '/' )
2316 {
2317 if( narrow_string_compare(
2318 &( ( (yyvsp[-1].string_value).data )[ 4 ] ),
2319 "2336",
2320 4 ) == 0 )
2321 {
2322 ( (cue_parser_state_t *) parser_state )->current_track_type = LIBODRAW_TRACK_TYPE_CDI_2336;
2323 }
2324 else if( narrow_string_compare(
2325 &( ( (yyvsp[-1].string_value).data )[ 4 ] ),
2326 "2352",
2327 4 ) == 0 )
2328 {
2329 ( (cue_parser_state_t *) parser_state )->current_track_type = LIBODRAW_TRACK_TYPE_CDI_2352;
2330 }
2331 }
2332 }
2333 }
2334 else if( (yyvsp[-1].string_value).length == 10 )
2335 {
2336 if( narrow_string_compare(
2337 (yyvsp[-1].string_value).data,
2338 "MODE",
2339 4 ) == 0 )
2340 {
2341 if( ( (yyvsp[-1].string_value).data )[ 5 ] == '/' )
2342 {
2343 if( ( (yyvsp[-1].string_value).data )[ 4 ] == '1' )
2344 {
2345 if( narrow_string_compare(
2346 &( ( (yyvsp[-1].string_value).data )[ 6 ] ),
2347 "2048",
2348 4 ) == 0 )
2349 {
2350 ( (cue_parser_state_t *) parser_state )->current_track_type = LIBODRAW_TRACK_TYPE_MODE1_2048;
2351 }
2352 else if( narrow_string_compare(
2353 &( ( (yyvsp[-1].string_value).data )[ 6 ] ),
2354 "2352",
2355 4 ) == 0 )
2356 {
2357 ( (cue_parser_state_t *) parser_state )->current_track_type = LIBODRAW_TRACK_TYPE_MODE1_2352;
2358 }
2359 }
2360 else if( ( (yyvsp[-1].string_value).data )[ 4 ] == '2' )
2361 {
2362 if( narrow_string_compare(
2363 &( ( (yyvsp[-1].string_value).data )[ 6 ] ),
2364 "2048",
2365 4 ) == 0 )
2366 {
2367 ( (cue_parser_state_t *) parser_state )->current_track_type = LIBODRAW_TRACK_TYPE_MODE2_2048;
2368 }
2369 else if( narrow_string_compare(
2370 &( ( (yyvsp[-1].string_value).data )[ 6 ] ),
2371 "2324",
2372 4 ) == 0 )
2373 {
2374 ( (cue_parser_state_t *) parser_state )->current_track_type = LIBODRAW_TRACK_TYPE_MODE2_2324;
2375 }
2376 else if( narrow_string_compare(
2377 &( ( (yyvsp[-1].string_value).data )[ 6 ] ),
2378 "2336",
2379 4 ) == 0 )
2380 {
2381 ( (cue_parser_state_t *) parser_state )->current_track_type = LIBODRAW_TRACK_TYPE_MODE2_2336;
2382 }
2383 else if( narrow_string_compare(
2384 &( ( (yyvsp[-1].string_value).data )[ 6 ] ),
2385 "2352",
2386 4 ) == 0 )
2387 {
2388 ( (cue_parser_state_t *) parser_state )->current_track_type = LIBODRAW_TRACK_TYPE_MODE2_2352;
2389 }
2390 }
2391 }
2392 }
2393 }
2394 }
2395 break;
2396
2397
2398
2399 default: break;
2400 }
2401 /* User semantic actions sometimes alter yychar, and that requires
2402 that yytoken be updated with the new translation. We take the
2403 approach of translating immediately before every use of yytoken.
2404 One alternative is translating here after every semantic action,
2405 but that translation would be missed if the semantic action invokes
2406 YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or
2407 if it invokes YYBACKUP. In the case of YYABORT or YYACCEPT, an
2408 incorrect destructor might then be invoked immediately. In the
2409 case of YYERROR or YYBACKUP, subsequent parser actions might lead
2410 to an incorrect destructor call or verbose syntax error message
2411 before the lookahead is translated. */
2412 YY_SYMBOL_PRINT ("-> $$ =", YY_CAST (yysymbol_kind_t, yyr1[yyn]), &yyval, &yyloc);
2413
2414 YYPOPSTACK (yylen);
2415 yylen = 0;
2416
2417 *++yyvsp = yyval;
2418
2419 /* Now 'shift' the result of the reduction. Determine what state
2420 that goes to, based on the state we popped back to and the rule
2421 number reduced by. */
2422 {
2423 const int yylhs = yyr1[yyn] - YYNTOKENS;
2424 const int yyi = yypgoto[yylhs] + *yyssp;
2425 yystate = (0 <= yyi && yyi <= YYLAST && yycheck[yyi] == *yyssp
2426 ? yytable[yyi]
2427 : yydefgoto[yylhs]);
2428 }
2429
2430 goto yynewstate;
2431
2432
2433 /*--------------------------------------.
2434 | yyerrlab -- here on detecting error. |
2435 `--------------------------------------*/
2436 yyerrlab:
2437 /* Make sure we have latest lookahead translation. See comments at
2438 user semantic actions for why this is necessary. */
2439 yytoken = yychar == YYEMPTY ? YYSYMBOL_YYEMPTY : YYTRANSLATE (yychar);
2440 /* If not already recovering from an error, report this error. */
2441 if (!yyerrstatus)
2442 {
2443 ++yynerrs;
2444 yyerror (parser_state, YY_("syntax error"));
2445 }
2446
2447 if (yyerrstatus == 3)
2448 {
2449 /* If just tried and failed to reuse lookahead token after an
2450 error, discard it. */
2451
2452 if (yychar <= YYEOF)
2453 {
2454 /* Return failure if at end of input. */
2455 if (yychar == YYEOF)
2456 YYABORT;
2457 }
2458 else
2459 {
2460 yydestruct ("Error: discarding",
2461 yytoken, &yylval, parser_state);
2462 yychar = YYEMPTY;
2463 }
2464 }
2465
2466 /* Else will try to reuse lookahead token after shifting the error
2467 token. */
2468 goto yyerrlab1;
2469
2470
2471 /*---------------------------------------------------.
2472 | yyerrorlab -- error raised explicitly by YYERROR. |
2473 `---------------------------------------------------*/
2474 yyerrorlab:
2475 /* Pacify compilers when the user code never invokes YYERROR and the
2476 label yyerrorlab therefore never appears in user code. */
2477 if (0)
2478 YYERROR;
2479
2480 /* Do not reclaim the symbols of the rule whose action triggered
2481 this YYERROR. */
2482 YYPOPSTACK (yylen);
2483 yylen = 0;
2484 YY_STACK_PRINT (yyss, yyssp);
2485 yystate = *yyssp;
2486 goto yyerrlab1;
2487
2488
2489 /*-------------------------------------------------------------.
2490 | yyerrlab1 -- common code for both syntax error and YYERROR. |
2491 `-------------------------------------------------------------*/
2492 yyerrlab1:
2493 yyerrstatus = 3; /* Each real token shifted decrements this. */
2494
2495 /* Pop stack until we find a state that shifts the error token. */
2496 for (;;)
2497 {
2498 yyn = yypact[yystate];
2499 if (!yypact_value_is_default (yyn))
2500 {
2501 yyn += YYSYMBOL_YYerror;
2502 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYSYMBOL_YYerror)
2503 {
2504 yyn = yytable[yyn];
2505 if (0 < yyn)
2506 break;
2507 }
2508 }
2509
2510 /* Pop the current state because it cannot handle the error token. */
2511 if (yyssp == yyss)
2512 YYABORT;
2513
2514
2515 yydestruct ("Error: popping",
2516 YY_ACCESSING_SYMBOL (yystate), yyvsp, parser_state);
2517 YYPOPSTACK (1);
2518 yystate = *yyssp;
2519 YY_STACK_PRINT (yyss, yyssp);
2520 }
2521
2522 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
2523 *++yyvsp = yylval;
2524 YY_IGNORE_MAYBE_UNINITIALIZED_END
2525
2526
2527 /* Shift the error token. */
2528 YY_SYMBOL_PRINT ("Shifting", YY_ACCESSING_SYMBOL (yyn), yyvsp, yylsp);
2529
2530 yystate = yyn;
2531 goto yynewstate;
2532
2533
2534 /*-------------------------------------.
2535 | yyacceptlab -- YYACCEPT comes here. |
2536 `-------------------------------------*/
2537 yyacceptlab:
2538 yyresult = 0;
2539 goto yyreturn;
2540
2541
2542 /*-----------------------------------.
2543 | yyabortlab -- YYABORT comes here. |
2544 `-----------------------------------*/
2545 yyabortlab:
2546 yyresult = 1;
2547 goto yyreturn;
2548
2549
2550 #if !defined yyoverflow
2551 /*-------------------------------------------------.
2552 | yyexhaustedlab -- memory exhaustion comes here. |
2553 `-------------------------------------------------*/
2554 yyexhaustedlab:
2555 yyerror (parser_state, YY_("memory exhausted"));
2556 yyresult = 2;
2557 goto yyreturn;
2558 #endif
2559
2560
2561 /*-------------------------------------------------------.
2562 | yyreturn -- parsing is finished, clean up and return. |
2563 `-------------------------------------------------------*/
2564 yyreturn:
2565 if (yychar != YYEMPTY)
2566 {
2567 /* Make sure we have latest lookahead translation. See comments at
2568 user semantic actions for why this is necessary. */
2569 yytoken = YYTRANSLATE (yychar);
2570 yydestruct ("Cleanup: discarding lookahead",
2571 yytoken, &yylval, parser_state);
2572 }
2573 /* Do not reclaim the symbols of the rule whose action triggered
2574 this YYABORT or YYACCEPT. */
2575 YYPOPSTACK (yylen);
2576 YY_STACK_PRINT (yyss, yyssp);
2577 while (yyssp != yyss)
2578 {
2579 yydestruct ("Cleanup: popping",
2580 YY_ACCESSING_SYMBOL (+*yyssp), yyvsp, parser_state);
2581 YYPOPSTACK (1);
2582 }
2583 #ifndef yyoverflow
2584 if (yyss != yyssa)
2585 YYSTACK_FREE (yyss);
2586 #endif
2587
2588 return yyresult;
2589 }
2590
2591
2592
cue_parser_parse_buffer(libodraw_handle_t * handle,const uint8_t * buffer,size_t buffer_size,libcerror_error_t ** error)2593 int cue_parser_parse_buffer(
2594 libodraw_handle_t *handle,
2595 const uint8_t *buffer,
2596 size_t buffer_size,
2597 libcerror_error_t **error )
2598 {
2599 cue_parser_state_t parser_state;
2600
2601 YY_BUFFER_STATE buffer_state = NULL;
2602 size_t buffer_offset = 0;
2603 int result = -1;
2604
2605 if( buffer_size >= 3 )
2606 {
2607 if( ( buffer[ 0 ] == 0x0ef )
2608 && ( buffer[ 1 ] == 0x0bb )
2609 && ( buffer[ 2 ] == 0x0bf ) )
2610 {
2611 buffer_offset = 3;
2612 }
2613 }
2614 buffer_state = cue_scanner__scan_buffer(
2615 (char *) &( buffer[ buffer_offset ] ),
2616 buffer_size - buffer_offset );
2617
2618 cue_scanner_buffer_offset = (size_t) buffer_offset;
2619
2620 if( buffer_state != NULL )
2621 {
2622 parser_state.handle = handle;
2623 parser_state.error = error;
2624 parser_state.previous_file_index = -1;
2625 parser_state.current_file_index = -1;
2626 parser_state.file_type = 0;
2627 parser_state.previous_file_sector = 0;
2628 parser_state.file_sector = 0;
2629 parser_state.previous_session_start_sector = 0;
2630 parser_state.previous_lead_out_start_sector = 0;
2631 parser_state.previous_track_start_sector = 0;
2632 parser_state.current_start_sector = 0;
2633 parser_state.session_number_of_sectors = 0;
2634 parser_state.lead_out_number_of_sectors = 0;
2635 parser_state.track_number_of_sectors = 0;
2636 parser_state.previous_track_type = 0;
2637 parser_state.current_track_type = 0;
2638 parser_state.previous_session = 0;
2639 parser_state.current_session = 0;
2640 parser_state.previous_lead_out = 0;
2641 parser_state.current_lead_out = 0;
2642 parser_state.previous_track = 0;
2643 parser_state.current_track = 0;
2644 parser_state.previous_index = 0;
2645 parser_state.current_index = 0;
2646
2647 if( cue_scanner_parse(
2648 &parser_state ) == 0 )
2649 {
2650 result = 1;
2651 }
2652 cue_scanner__delete_buffer(
2653 buffer_state );
2654
2655 if( parser_state.current_session > 0 )
2656 {
2657 if( libodraw_handle_append_session(
2658 parser_state.handle,
2659 parser_state.previous_session_start_sector,
2660 0,
2661 parser_state.error ) != 1 )
2662 {
2663 libcerror_error_set(
2664 parser_state.error,
2665 LIBCERROR_ERROR_DOMAIN_RUNTIME,
2666 LIBCERROR_RUNTIME_ERROR_APPEND_FAILED,
2667 "%s: unable to append session.",
2668 cue_parser_function );
2669
2670 result = -1;
2671 }
2672 }
2673 if( parser_state.current_lead_out > parser_state.previous_lead_out )
2674 {
2675 if( libodraw_handle_append_lead_out(
2676 parser_state.handle,
2677 parser_state.previous_lead_out_start_sector,
2678 0,
2679 parser_state.error ) != 1 )
2680 {
2681 libcerror_error_set(
2682 parser_state.error,
2683 LIBCERROR_ERROR_DOMAIN_RUNTIME,
2684 LIBCERROR_RUNTIME_ERROR_APPEND_FAILED,
2685 "%s: unable to append lead-out.",
2686 cue_parser_function );
2687
2688 result = -1;
2689 }
2690 }
2691 if( parser_state.current_track > 0 )
2692 {
2693 if( parser_state.previous_file_index < 0 )
2694 {
2695 parser_state.file_sector = parser_state.previous_track_start_sector;
2696
2697 parser_state.previous_file_index += 1;
2698 }
2699 parser_state.previous_file_sector = parser_state.previous_track_start_sector
2700 - parser_state.file_sector;
2701
2702 if( libodraw_handle_append_track(
2703 parser_state.handle,
2704 parser_state.previous_track_start_sector,
2705 0,
2706 parser_state.current_track_type,
2707 parser_state.current_file_index,
2708 parser_state.previous_file_sector,
2709 parser_state.error ) != 1 )
2710 {
2711 libcerror_error_set(
2712 parser_state.error,
2713 LIBCERROR_ERROR_DOMAIN_RUNTIME,
2714 LIBCERROR_RUNTIME_ERROR_APPEND_FAILED,
2715 "%s: unable to append track.",
2716 cue_parser_function );
2717
2718 result = -1;
2719 }
2720 }
2721 }
2722 cue_scanner_lex_destroy();
2723
2724 return( result );
2725 }
2726
2727