1 /* A Bison parser, made by GNU Bison 3.0.4. */
2
3 /* Bison implementation for Yacc-like parsers in C
4
5 Copyright (C) 1984, 1989-1990, 2000-2015 Free Software Foundation, Inc.
6
7 This program is free software: you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation, either version 3 of the License, or
10 (at your option) any later version.
11
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
16
17 You should have received a copy of the GNU General Public License
18 along with this program. If not, see <http://www.gnu.org/licenses/>. */
19
20 /* As a special exception, you may create a larger work that contains
21 part or all of the Bison parser skeleton and distribute that work
22 under terms of your choice, so long as that work isn't itself a
23 parser generator using the skeleton or a modified version thereof
24 as a parser skeleton. Alternatively, if you modify or redistribute
25 the parser skeleton itself, you may (at your option) remove this
26 special exception, which will cause the skeleton and the resulting
27 Bison output files to be licensed under the GNU General Public
28 License without this special exception.
29
30 This special exception was added by the Free Software Foundation in
31 version 2.2 of Bison. */
32
33 /* C LALR(1) parser skeleton written by Richard Stallman, by
34 simplifying the original so-called "semantic" parser. */
35
36 /* All symbols defined below should begin with yy or YY, to avoid
37 infringing on user name space. This should be done even for local
38 variables, as they might otherwise be expanded by user macros.
39 There are some unavoidable exceptions within include files to
40 define necessary library symbols; they are noted "INFRINGES ON
41 USER NAME SPACE" below. */
42
43 /* Identify Bison output. */
44 #define YYBISON 1
45
46 /* Bison version. */
47 #define YYBISON_VERSION "3.0.4"
48
49 /* Skeleton name. */
50 #define YYSKELETON_NAME "yacc.c"
51
52 /* Pure parsers. */
53 #define YYPURE 0
54
55 /* Push parsers. */
56 #define YYPUSH 0
57
58 /* Pull parsers. */
59 #define YYPULL 1
60
61
62 /* Substitute the variable and function names. */
63 #define yyparse audp_parse
64 #define yylex audp_lex
65 #define yyerror audp_error
66 #define yydebug audp_debug
67 #define yynerrs audp_nerrs
68
69 #define yylval audp_lval
70 #define yychar audp_char
71
72 /* Copy the first part of user declarations. */
73 #line 21 "../lib/gamelib/audp_parser.ypp" /* yacc.c:339 */
74
75
76 #include "lib/framework/frame.h"
77 #include "lib/gamelib/parser.h"
78 #include "lib/sound/audio.h"
79 #include "lib/framework/lexer_input.h"
80
81 extern int audp_lex(void);
82 extern int audp_lex_destroy(void);
83 extern int audp_get_lineno(void);
84 extern char* audp_get_text(void);
85 extern void audp_set_extra(YY_EXTRA_TYPE user_defined);
86
87 void yyerror(const char* fmt);
88
89
90 #line 91 "audp_parser.tab.cpp" /* yacc.c:339 */
91
92 # ifndef YY_NULLPTR
93 # if defined __cplusplus && 201103L <= __cplusplus
94 # define YY_NULLPTR nullptr
95 # else
96 # define YY_NULLPTR 0
97 # endif
98 # endif
99
100 /* Enabling verbose error messages. */
101 #ifdef YYERROR_VERBOSE
102 # undef YYERROR_VERBOSE
103 # define YYERROR_VERBOSE 1
104 #else
105 # define YYERROR_VERBOSE 0
106 #endif
107
108 /* In a future release of Bison, this section will be replaced
109 by #include "audp_parser.tab.hpp". */
110 #ifndef YY_AUDP_AUDP_PARSER_TAB_HPP_INCLUDED
111 # define YY_AUDP_AUDP_PARSER_TAB_HPP_INCLUDED
112 /* Debug traces. */
113 #ifndef YYDEBUG
114 # define YYDEBUG 0
115 #endif
116 #if YYDEBUG
117 extern int audp_debug;
118 #endif
119
120 /* Token type. */
121 #ifndef YYTOKENTYPE
122 # define YYTOKENTYPE
123 enum yytokentype
124 {
125 FLOAT_T = 258,
126 INTEGER = 259,
127 QTEXT = 260,
128 ONESHOT = 261,
129 LOOP = 262,
130 AUDIO = 263,
131 AUDIO_MODULE = 264
132 };
133 #endif
134
135 /* Value type. */
136 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
137
138 union YYSTYPE
139 {
140 #line 40 "../lib/gamelib/audp_parser.ypp" /* yacc.c:355 */
141
142 float fval;
143 long ival;
144 bool bval;
145 char* sval;
146
147 #line 148 "audp_parser.tab.cpp" /* yacc.c:355 */
148 };
149
150 typedef union YYSTYPE YYSTYPE;
151 # define YYSTYPE_IS_TRIVIAL 1
152 # define YYSTYPE_IS_DECLARED 1
153 #endif
154
155
156 extern YYSTYPE audp_lval;
157
158 int audp_parse (void);
159
160 #endif /* !YY_AUDP_AUDP_PARSER_TAB_HPP_INCLUDED */
161
162 /* Copy the second part of user declarations. */
163
164 #line 165 "audp_parser.tab.cpp" /* yacc.c:358 */
165
166 #ifdef short
167 # undef short
168 #endif
169
170 #ifdef YYTYPE_UINT8
171 typedef YYTYPE_UINT8 yytype_uint8;
172 #else
173 typedef unsigned char yytype_uint8;
174 #endif
175
176 #ifdef YYTYPE_INT8
177 typedef YYTYPE_INT8 yytype_int8;
178 #else
179 typedef signed char yytype_int8;
180 #endif
181
182 #ifdef YYTYPE_UINT16
183 typedef YYTYPE_UINT16 yytype_uint16;
184 #else
185 typedef unsigned short int yytype_uint16;
186 #endif
187
188 #ifdef YYTYPE_INT16
189 typedef YYTYPE_INT16 yytype_int16;
190 #else
191 typedef short int yytype_int16;
192 #endif
193
194 #ifndef YYSIZE_T
195 # ifdef __SIZE_TYPE__
196 # define YYSIZE_T __SIZE_TYPE__
197 # elif defined size_t
198 # define YYSIZE_T size_t
199 # elif ! defined YYSIZE_T
200 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
201 # define YYSIZE_T size_t
202 # else
203 # define YYSIZE_T unsigned int
204 # endif
205 #endif
206
207 #define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
208
209 #ifndef YY_
210 # if defined YYENABLE_NLS && YYENABLE_NLS
211 # if ENABLE_NLS
212 # include <libintl.h> /* INFRINGES ON USER NAME SPACE */
213 # define YY_(Msgid) dgettext ("bison-runtime", Msgid)
214 # endif
215 # endif
216 # ifndef YY_
217 # define YY_(Msgid) Msgid
218 # endif
219 #endif
220
221 #ifndef YY_ATTRIBUTE
222 # if (defined __GNUC__ \
223 && (2 < __GNUC__ || (__GNUC__ == 2 && 96 <= __GNUC_MINOR__))) \
224 || defined __SUNPRO_C && 0x5110 <= __SUNPRO_C
225 # define YY_ATTRIBUTE(Spec) __attribute__(Spec)
226 # else
227 # define YY_ATTRIBUTE(Spec) /* empty */
228 # endif
229 #endif
230
231 #ifndef YY_ATTRIBUTE_PURE
232 # define YY_ATTRIBUTE_PURE YY_ATTRIBUTE ((__pure__))
233 #endif
234
235 #ifndef YY_ATTRIBUTE_UNUSED
236 # define YY_ATTRIBUTE_UNUSED YY_ATTRIBUTE ((__unused__))
237 #endif
238
239 #if !defined _Noreturn \
240 && (!defined __STDC_VERSION__ || __STDC_VERSION__ < 201112)
241 # if defined _MSC_VER && 1200 <= _MSC_VER
242 # define _Noreturn __declspec (noreturn)
243 # else
244 # define _Noreturn YY_ATTRIBUTE ((__noreturn__))
245 # endif
246 #endif
247
248 /* Suppress unused-variable warnings by "using" E. */
249 #if ! defined lint || defined __GNUC__
250 # define YYUSE(E) ((void) (E))
251 #else
252 # define YYUSE(E) /* empty */
253 #endif
254
255 #if defined __GNUC__ && 407 <= __GNUC__ * 100 + __GNUC_MINOR__
256 /* Suppress an incorrect diagnostic about yylval being uninitialized. */
257 # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \
258 _Pragma ("GCC diagnostic push") \
259 _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")\
260 _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"")
261 # define YY_IGNORE_MAYBE_UNINITIALIZED_END \
262 _Pragma ("GCC diagnostic pop")
263 #else
264 # define YY_INITIAL_VALUE(Value) Value
265 #endif
266 #ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
267 # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
268 # define YY_IGNORE_MAYBE_UNINITIALIZED_END
269 #endif
270 #ifndef YY_INITIAL_VALUE
271 # define YY_INITIAL_VALUE(Value) /* Nothing. */
272 #endif
273
274
275 #if ! defined yyoverflow || YYERROR_VERBOSE
276
277 /* The parser invokes alloca or malloc; define the necessary symbols. */
278
279 # ifdef YYSTACK_USE_ALLOCA
280 # if YYSTACK_USE_ALLOCA
281 # ifdef __GNUC__
282 # define YYSTACK_ALLOC __builtin_alloca
283 # elif defined __BUILTIN_VA_ARG_INCR
284 # include <alloca.h> /* INFRINGES ON USER NAME SPACE */
285 # elif defined _AIX
286 # define YYSTACK_ALLOC __alloca
287 # elif defined _MSC_VER
288 # include <malloc.h> /* INFRINGES ON USER NAME SPACE */
289 # define alloca _alloca
290 # else
291 # define YYSTACK_ALLOC alloca
292 # if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS
293 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
294 /* Use EXIT_SUCCESS as a witness for stdlib.h. */
295 # ifndef EXIT_SUCCESS
296 # define EXIT_SUCCESS 0
297 # endif
298 # endif
299 # endif
300 # endif
301 # endif
302
303 # ifdef YYSTACK_ALLOC
304 /* Pacify GCC's 'empty if-body' warning. */
305 # define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
306 # ifndef YYSTACK_ALLOC_MAXIMUM
307 /* The OS might guarantee only one guard page at the bottom of the stack,
308 and a page size can be as small as 4096 bytes. So we cannot safely
309 invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
310 to allow for a few compiler-allocated temporary stack slots. */
311 # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
312 # endif
313 # else
314 # define YYSTACK_ALLOC YYMALLOC
315 # define YYSTACK_FREE YYFREE
316 # ifndef YYSTACK_ALLOC_MAXIMUM
317 # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
318 # endif
319 # if (defined __cplusplus && ! defined EXIT_SUCCESS \
320 && ! ((defined YYMALLOC || defined malloc) \
321 && (defined YYFREE || defined free)))
322 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
323 # ifndef EXIT_SUCCESS
324 # define EXIT_SUCCESS 0
325 # endif
326 # endif
327 # ifndef YYMALLOC
328 # define YYMALLOC malloc
329 # if ! defined malloc && ! defined EXIT_SUCCESS
330 void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
331 # endif
332 # endif
333 # ifndef YYFREE
334 # define YYFREE free
335 # if ! defined free && ! defined EXIT_SUCCESS
336 void free (void *); /* INFRINGES ON USER NAME SPACE */
337 # endif
338 # endif
339 # endif
340 #endif /* ! defined yyoverflow || YYERROR_VERBOSE */
341
342
343 #if (! defined yyoverflow \
344 && (! defined __cplusplus \
345 || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
346
347 /* A type that is properly aligned for any stack member. */
348 union yyalloc
349 {
350 yytype_int16 yyss_alloc;
351 YYSTYPE yyvs_alloc;
352 };
353
354 /* The size of the maximum gap between one aligned stack and the next. */
355 # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
356
357 /* The size of an array large to enough to hold all stacks, each with
358 N elements. */
359 # define YYSTACK_BYTES(N) \
360 ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
361 + YYSTACK_GAP_MAXIMUM)
362
363 # define YYCOPY_NEEDED 1
364
365 /* Relocate STACK from its old location to the new one. The
366 local variables YYSIZE and YYSTACKSIZE give the old and new number of
367 elements in the stack, and YYPTR gives the new location of the
368 stack. Advance YYPTR to a properly aligned location for the next
369 stack. */
370 # define YYSTACK_RELOCATE(Stack_alloc, Stack) \
371 do \
372 { \
373 YYSIZE_T yynewbytes; \
374 YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \
375 Stack = &yyptr->Stack_alloc; \
376 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
377 yyptr += yynewbytes / sizeof (*yyptr); \
378 } \
379 while (0)
380
381 #endif
382
383 #if defined YYCOPY_NEEDED && YYCOPY_NEEDED
384 /* Copy COUNT objects from SRC to DST. The source and destination do
385 not overlap. */
386 # ifndef YYCOPY
387 # if defined __GNUC__ && 1 < __GNUC__
388 # define YYCOPY(Dst, Src, Count) \
389 __builtin_memcpy (Dst, Src, (Count) * sizeof (*(Src)))
390 # else
391 # define YYCOPY(Dst, Src, Count) \
392 do \
393 { \
394 YYSIZE_T yyi; \
395 for (yyi = 0; yyi < (Count); yyi++) \
396 (Dst)[yyi] = (Src)[yyi]; \
397 } \
398 while (0)
399 # endif
400 # endif
401 #endif /* !YYCOPY_NEEDED */
402
403 /* YYFINAL -- State number of the termination state. */
404 #define YYFINAL 8
405 /* YYLAST -- Last index in YYTABLE. */
406 #define YYLAST 13
407
408 /* YYNTOKENS -- Number of terminals. */
409 #define YYNTOKENS 12
410 /* YYNNTS -- Number of nonterminals. */
411 #define YYNNTS 9
412 /* YYNRULES -- Number of rules. */
413 #define YYNRULES 13
414 /* YYNSTATES -- Number of states. */
415 #define YYNSTATES 22
416
417 /* YYTRANSLATE[YYX] -- Symbol number corresponding to YYX as returned
418 by yylex, with out-of-bounds checking. */
419 #define YYUNDEFTOK 2
420 #define YYMAXUTOK 264
421
422 #define YYTRANSLATE(YYX) \
423 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
424
425 /* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM
426 as returned by yylex, without out-of-bounds checking. */
427 static const yytype_uint8 yytranslate[] =
428 {
429 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
430 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
431 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
432 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
433 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
434 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
435 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
436 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
437 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
438 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
439 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
440 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
441 2, 2, 2, 10, 2, 11, 2, 2, 2, 2,
442 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
443 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
444 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
445 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
446 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
447 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
448 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
449 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
450 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
451 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
452 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
453 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
454 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
455 5, 6, 7, 8, 9
456 };
457
458 #if YYDEBUG
459 /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */
460 static const yytype_uint8 yyrline[] =
461 {
462 0, 73, 73, 76, 77, 80, 83, 86, 87, 90,
463 91, 97, 104, 106
464 };
465 #endif
466
467 #if YYDEBUG || YYERROR_VERBOSE || 0
468 /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
469 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
470 static const char *const yytname[] =
471 {
472 "$end", "error", "$undefined", "FLOAT_T", "INTEGER", "QTEXT", "ONESHOT",
473 "LOOP", "AUDIO", "AUDIO_MODULE", "'{'", "'}'", "$accept", "data_file",
474 "module_file", "data_list", "audio_header", "audio_module", "audio_list",
475 "audio_track", "looping", YY_NULLPTR
476 };
477 #endif
478
479 # ifdef YYPRINT
480 /* YYTOKNUM[NUM] -- (External) token number corresponding to the
481 (internal) symbol number NUM (which must be that of a token). */
482 static const yytype_uint16 yytoknum[] =
483 {
484 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
485 123, 125
486 };
487 # endif
488
489 #define YYPACT_NINF -9
490
491 #define yypact_value_is_default(Yystate) \
492 (!!((Yystate) == (-9)))
493
494 #define YYTABLE_NINF -1
495
496 #define yytable_value_is_error(Yytable_value) \
497 0
498
499 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
500 STATE-NUM. */
501 static const yytype_int8 yypact[] =
502 {
503 -2, 0, 2, -2, -9, -8, -9, -9, -9, -9,
504 3, -9, -7, -9, -1, -9, -9, -9, -9, 5,
505 7, -9
506 };
507
508 /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM.
509 Performed when YYTABLE does not specify something else to do. Zero
510 means the default is an error. */
511 static const yytype_uint8 yydefact[] =
512 {
513 0, 0, 0, 2, 4, 0, 5, 6, 1, 3,
514 0, 8, 0, 10, 0, 7, 9, 13, 12, 0,
515 0, 11
516 };
517
518 /* YYPGOTO[NTERM-NUM]. */
519 static const yytype_int8 yypgoto[] =
520 {
521 -9, -9, -9, 9, -9, -9, -9, 1, -9
522 };
523
524 /* YYDEFGOTO[NTERM-NUM]. */
525 static const yytype_int8 yydefgoto[] =
526 {
527 -1, 2, 3, 4, 5, 6, 12, 13, 19
528 };
529
530 /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If
531 positive, shift that token. If negative, reduce the rule whose
532 number is the opposite. If YYTABLE_NINF, syntax error. */
533 static const yytype_uint8 yytable[] =
534 {
535 10, 10, 8, 11, 15, 17, 18, 1, 14, 20,
536 7, 21, 9, 16
537 };
538
539 static const yytype_uint8 yycheck[] =
540 {
541 8, 8, 0, 11, 11, 6, 7, 9, 5, 4,
542 10, 4, 3, 12
543 };
544
545 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
546 symbol of state STATE-NUM. */
547 static const yytype_uint8 yystos[] =
548 {
549 0, 9, 13, 14, 15, 16, 17, 10, 0, 15,
550 8, 11, 18, 19, 5, 11, 19, 6, 7, 20,
551 4, 4
552 };
553
554 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
555 static const yytype_uint8 yyr1[] =
556 {
557 0, 12, 13, 14, 14, 15, 16, 17, 17, 18,
558 18, 19, 20, 20
559 };
560
561 /* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN. */
562 static const yytype_uint8 yyr2[] =
563 {
564 0, 2, 1, 2, 1, 1, 2, 3, 2, 2,
565 1, 5, 1, 1
566 };
567
568
569 #define yyerrok (yyerrstatus = 0)
570 #define yyclearin (yychar = YYEMPTY)
571 #define YYEMPTY (-2)
572 #define YYEOF 0
573
574 #define YYACCEPT goto yyacceptlab
575 #define YYABORT goto yyabortlab
576 #define YYERROR goto yyerrorlab
577
578
579 #define YYRECOVERING() (!!yyerrstatus)
580
581 #define YYBACKUP(Token, Value) \
582 do \
583 if (yychar == YYEMPTY) \
584 { \
585 yychar = (Token); \
586 yylval = (Value); \
587 YYPOPSTACK (yylen); \
588 yystate = *yyssp; \
589 goto yybackup; \
590 } \
591 else \
592 { \
593 yyerror (YY_("syntax error: cannot back up")); \
594 YYERROR; \
595 } \
596 while (0)
597
598 /* Error token number */
599 #define YYTERROR 1
600 #define YYERRCODE 256
601
602
603
604 /* Enable debugging if requested. */
605 #if YYDEBUG
606
607 # ifndef YYFPRINTF
608 # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
609 # define YYFPRINTF fprintf
610 # endif
611
612 # define YYDPRINTF(Args) \
613 do { \
614 if (yydebug) \
615 YYFPRINTF Args; \
616 } while (0)
617
618 /* This macro is provided for backward compatibility. */
619 #ifndef YY_LOCATION_PRINT
620 # define YY_LOCATION_PRINT(File, Loc) ((void) 0)
621 #endif
622
623
624 # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
625 do { \
626 if (yydebug) \
627 { \
628 YYFPRINTF (stderr, "%s ", Title); \
629 yy_symbol_print (stderr, \
630 Type, Value); \
631 YYFPRINTF (stderr, "\n"); \
632 } \
633 } while (0)
634
635
636 /*----------------------------------------.
637 | Print this symbol's value on YYOUTPUT. |
638 `----------------------------------------*/
639
640 static void
yy_symbol_value_print(FILE * yyoutput,int yytype,YYSTYPE const * const yyvaluep)641 yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
642 {
643 FILE *yyo = yyoutput;
644 YYUSE (yyo);
645 if (!yyvaluep)
646 return;
647 # ifdef YYPRINT
648 if (yytype < YYNTOKENS)
649 YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
650 # endif
651 YYUSE (yytype);
652 }
653
654
655 /*--------------------------------.
656 | Print this symbol on YYOUTPUT. |
657 `--------------------------------*/
658
659 static void
yy_symbol_print(FILE * yyoutput,int yytype,YYSTYPE const * const yyvaluep)660 yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
661 {
662 YYFPRINTF (yyoutput, "%s %s (",
663 yytype < YYNTOKENS ? "token" : "nterm", yytname[yytype]);
664
665 yy_symbol_value_print (yyoutput, yytype, yyvaluep);
666 YYFPRINTF (yyoutput, ")");
667 }
668
669 /*------------------------------------------------------------------.
670 | yy_stack_print -- Print the state stack from its BOTTOM up to its |
671 | TOP (included). |
672 `------------------------------------------------------------------*/
673
674 static void
yy_stack_print(yytype_int16 * yybottom,yytype_int16 * yytop)675 yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop)
676 {
677 YYFPRINTF (stderr, "Stack now");
678 for (; yybottom <= yytop; yybottom++)
679 {
680 int yybot = *yybottom;
681 YYFPRINTF (stderr, " %d", yybot);
682 }
683 YYFPRINTF (stderr, "\n");
684 }
685
686 # define YY_STACK_PRINT(Bottom, Top) \
687 do { \
688 if (yydebug) \
689 yy_stack_print ((Bottom), (Top)); \
690 } while (0)
691
692
693 /*------------------------------------------------.
694 | Report that the YYRULE is going to be reduced. |
695 `------------------------------------------------*/
696
697 static void
yy_reduce_print(yytype_int16 * yyssp,YYSTYPE * yyvsp,int yyrule)698 yy_reduce_print (yytype_int16 *yyssp, YYSTYPE *yyvsp, int yyrule)
699 {
700 unsigned long int yylno = yyrline[yyrule];
701 int yynrhs = yyr2[yyrule];
702 int yyi;
703 YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
704 yyrule - 1, yylno);
705 /* The symbols being reduced. */
706 for (yyi = 0; yyi < yynrhs; yyi++)
707 {
708 YYFPRINTF (stderr, " $%d = ", yyi + 1);
709 yy_symbol_print (stderr,
710 yystos[yyssp[yyi + 1 - yynrhs]],
711 &(yyvsp[(yyi + 1) - (yynrhs)])
712 );
713 YYFPRINTF (stderr, "\n");
714 }
715 }
716
717 # define YY_REDUCE_PRINT(Rule) \
718 do { \
719 if (yydebug) \
720 yy_reduce_print (yyssp, yyvsp, Rule); \
721 } while (0)
722
723 /* Nonzero means print parse trace. It is left uninitialized so that
724 multiple parsers can coexist. */
725 int yydebug;
726 #else /* !YYDEBUG */
727 # define YYDPRINTF(Args)
728 # define YY_SYMBOL_PRINT(Title, Type, Value, Location)
729 # define YY_STACK_PRINT(Bottom, Top)
730 # define YY_REDUCE_PRINT(Rule)
731 #endif /* !YYDEBUG */
732
733
734 /* YYINITDEPTH -- initial size of the parser's stacks. */
735 #ifndef YYINITDEPTH
736 # define YYINITDEPTH 200
737 #endif
738
739 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
740 if the built-in stack extension method is used).
741
742 Do not make this value too large; the results are undefined if
743 YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
744 evaluated with infinite-precision integer arithmetic. */
745
746 #ifndef YYMAXDEPTH
747 # define YYMAXDEPTH 10000
748 #endif
749
750
751 #if YYERROR_VERBOSE
752
753 # ifndef yystrlen
754 # if defined __GLIBC__ && defined _STRING_H
755 # define yystrlen strlen
756 # else
757 /* Return the length of YYSTR. */
758 static YYSIZE_T
yystrlen(const char * yystr)759 yystrlen (const char *yystr)
760 {
761 YYSIZE_T yylen;
762 for (yylen = 0; yystr[yylen]; yylen++)
763 continue;
764 return yylen;
765 }
766 # endif
767 # endif
768
769 # ifndef yystpcpy
770 # if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
771 # define yystpcpy stpcpy
772 # else
773 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
774 YYDEST. */
775 static char *
yystpcpy(char * yydest,const char * yysrc)776 yystpcpy (char *yydest, const char *yysrc)
777 {
778 char *yyd = yydest;
779 const char *yys = yysrc;
780
781 while ((*yyd++ = *yys++) != '\0')
782 continue;
783
784 return yyd - 1;
785 }
786 # endif
787 # endif
788
789 # ifndef yytnamerr
790 /* Copy to YYRES the contents of YYSTR after stripping away unnecessary
791 quotes and backslashes, so that it's suitable for yyerror. The
792 heuristic is that double-quoting is unnecessary unless the string
793 contains an apostrophe, a comma, or backslash (other than
794 backslash-backslash). YYSTR is taken from yytname. If YYRES is
795 null, do not copy; instead, return the length of what the result
796 would have been. */
797 static YYSIZE_T
yytnamerr(char * yyres,const char * yystr)798 yytnamerr (char *yyres, const char *yystr)
799 {
800 if (*yystr == '"')
801 {
802 YYSIZE_T yyn = 0;
803 char const *yyp = yystr;
804
805 for (;;)
806 switch (*++yyp)
807 {
808 case '\'':
809 case ',':
810 goto do_not_strip_quotes;
811
812 case '\\':
813 if (*++yyp != '\\')
814 goto do_not_strip_quotes;
815 /* Fall through. */
816 default:
817 if (yyres)
818 yyres[yyn] = *yyp;
819 yyn++;
820 break;
821
822 case '"':
823 if (yyres)
824 yyres[yyn] = '\0';
825 return yyn;
826 }
827 do_not_strip_quotes: ;
828 }
829
830 if (! yyres)
831 return yystrlen (yystr);
832
833 return yystpcpy (yyres, yystr) - yyres;
834 }
835 # endif
836
837 /* Copy into *YYMSG, which is of size *YYMSG_ALLOC, an error message
838 about the unexpected token YYTOKEN for the state stack whose top is
839 YYSSP.
840
841 Return 0 if *YYMSG was successfully written. Return 1 if *YYMSG is
842 not large enough to hold the message. In that case, also set
843 *YYMSG_ALLOC to the required number of bytes. Return 2 if the
844 required number of bytes is too large to store. */
845 static int
yysyntax_error(YYSIZE_T * yymsg_alloc,char ** yymsg,yytype_int16 * yyssp,int yytoken)846 yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
847 yytype_int16 *yyssp, int yytoken)
848 {
849 YYSIZE_T yysize0 = yytnamerr (YY_NULLPTR, yytname[yytoken]);
850 YYSIZE_T yysize = yysize0;
851 enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
852 /* Internationalized format string. */
853 const char *yyformat = YY_NULLPTR;
854 /* Arguments of yyformat. */
855 char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
856 /* Number of reported tokens (one for the "unexpected", one per
857 "expected"). */
858 int yycount = 0;
859
860 /* There are many possibilities here to consider:
861 - If this state is a consistent state with a default action, then
862 the only way this function was invoked is if the default action
863 is an error action. In that case, don't check for expected
864 tokens because there are none.
865 - The only way there can be no lookahead present (in yychar) is if
866 this state is a consistent state with a default action. Thus,
867 detecting the absence of a lookahead is sufficient to determine
868 that there is no unexpected or expected token to report. In that
869 case, just report a simple "syntax error".
870 - Don't assume there isn't a lookahead just because this state is a
871 consistent state with a default action. There might have been a
872 previous inconsistent state, consistent state with a non-default
873 action, or user semantic action that manipulated yychar.
874 - Of course, the expected token list depends on states to have
875 correct lookahead information, and it depends on the parser not
876 to perform extra reductions after fetching a lookahead from the
877 scanner and before detecting a syntax error. Thus, state merging
878 (from LALR or IELR) and default reductions corrupt the expected
879 token list. However, the list is correct for canonical LR with
880 one exception: it will still contain any token that will not be
881 accepted due to an error action in a later state.
882 */
883 if (yytoken != YYEMPTY)
884 {
885 int yyn = yypact[*yyssp];
886 yyarg[yycount++] = yytname[yytoken];
887 if (!yypact_value_is_default (yyn))
888 {
889 /* Start YYX at -YYN if negative to avoid negative indexes in
890 YYCHECK. In other words, skip the first -YYN actions for
891 this state because they are default actions. */
892 int yyxbegin = yyn < 0 ? -yyn : 0;
893 /* Stay within bounds of both yycheck and yytname. */
894 int yychecklim = YYLAST - yyn + 1;
895 int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
896 int yyx;
897
898 for (yyx = yyxbegin; yyx < yyxend; ++yyx)
899 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR
900 && !yytable_value_is_error (yytable[yyx + yyn]))
901 {
902 if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
903 {
904 yycount = 1;
905 yysize = yysize0;
906 break;
907 }
908 yyarg[yycount++] = yytname[yyx];
909 {
910 YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULLPTR, yytname[yyx]);
911 if (! (yysize <= yysize1
912 && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
913 return 2;
914 yysize = yysize1;
915 }
916 }
917 }
918 }
919
920 switch (yycount)
921 {
922 # define YYCASE_(N, S) \
923 case N: \
924 yyformat = S; \
925 break
926 YYCASE_(0, YY_("syntax error"));
927 YYCASE_(1, YY_("syntax error, unexpected %s"));
928 YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s"));
929 YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s"));
930 YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s"));
931 YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"));
932 # undef YYCASE_
933 }
934
935 {
936 YYSIZE_T yysize1 = yysize + yystrlen (yyformat);
937 if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
938 return 2;
939 yysize = yysize1;
940 }
941
942 if (*yymsg_alloc < yysize)
943 {
944 *yymsg_alloc = 2 * yysize;
945 if (! (yysize <= *yymsg_alloc
946 && *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM))
947 *yymsg_alloc = YYSTACK_ALLOC_MAXIMUM;
948 return 1;
949 }
950
951 /* Avoid sprintf, as that infringes on the user's name space.
952 Don't have undefined behavior even if the translation
953 produced a string with the wrong number of "%s"s. */
954 {
955 char *yyp = *yymsg;
956 int yyi = 0;
957 while ((*yyp = *yyformat) != '\0')
958 if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount)
959 {
960 yyp += yytnamerr (yyp, yyarg[yyi++]);
961 yyformat += 2;
962 }
963 else
964 {
965 yyp++;
966 yyformat++;
967 }
968 }
969 return 0;
970 }
971 #endif /* YYERROR_VERBOSE */
972
973 /*-----------------------------------------------.
974 | Release the memory associated to this symbol. |
975 `-----------------------------------------------*/
976
977 static void
yydestruct(const char * yymsg,int yytype,YYSTYPE * yyvaluep)978 yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep)
979 {
980 YYUSE (yyvaluep);
981 if (!yymsg)
982 yymsg = "Deleting";
983 YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
984
985 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
986 switch (yytype)
987 {
988 case 5: /* QTEXT */
989 #line 52 "../lib/gamelib/audp_parser.ypp" /* yacc.c:1257 */
990 {
991 #ifndef WZ_OS_WIN
992 // Force type checking by the compiler
993 char * const s = ((*yyvaluep).sval);
994
995 if (s)
996 free(s);
997 #endif
998 }
999 #line 1000 "audp_parser.tab.cpp" /* yacc.c:1257 */
1000 break;
1001
1002
1003 default:
1004 break;
1005 }
1006 YY_IGNORE_MAYBE_UNINITIALIZED_END
1007 }
1008
1009
1010
1011
1012 /* The lookahead symbol. */
1013 int yychar;
1014
1015 /* The semantic value of the lookahead symbol. */
1016 YYSTYPE yylval;
1017 /* Number of syntax errors so far. */
1018 int yynerrs;
1019
1020
1021 /*----------.
1022 | yyparse. |
1023 `----------*/
1024
1025 int
yyparse(void)1026 yyparse (void)
1027 {
1028 int yystate;
1029 /* Number of tokens to shift before error messages enabled. */
1030 int yyerrstatus;
1031
1032 /* The stacks and their tools:
1033 'yyss': related to states.
1034 'yyvs': related to semantic values.
1035
1036 Refer to the stacks through separate pointers, to allow yyoverflow
1037 to reallocate them elsewhere. */
1038
1039 /* The state stack. */
1040 yytype_int16 yyssa[YYINITDEPTH];
1041 yytype_int16 *yyss;
1042 yytype_int16 *yyssp;
1043
1044 /* The semantic value stack. */
1045 YYSTYPE yyvsa[YYINITDEPTH];
1046 YYSTYPE *yyvs;
1047 YYSTYPE *yyvsp;
1048
1049 YYSIZE_T yystacksize;
1050
1051 int yyn;
1052 int yyresult;
1053 /* Lookahead token as an internal (translated) token number. */
1054 int yytoken = 0;
1055 /* The variables used to return semantic value and location from the
1056 action routines. */
1057 YYSTYPE yyval;
1058
1059 #if YYERROR_VERBOSE
1060 /* Buffer for error messages, and its allocated size. */
1061 char yymsgbuf[128];
1062 char *yymsg = yymsgbuf;
1063 YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
1064 #endif
1065
1066 #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
1067
1068 /* The number of symbols on the RHS of the reduced rule.
1069 Keep to zero when no symbol should be popped. */
1070 int yylen = 0;
1071
1072 yyssp = yyss = yyssa;
1073 yyvsp = yyvs = yyvsa;
1074 yystacksize = YYINITDEPTH;
1075
1076 YYDPRINTF ((stderr, "Starting parse\n"));
1077
1078 yystate = 0;
1079 yyerrstatus = 0;
1080 yynerrs = 0;
1081 yychar = YYEMPTY; /* Cause a token to be read. */
1082 goto yysetstate;
1083
1084 /*------------------------------------------------------------.
1085 | yynewstate -- Push a new state, which is found in yystate. |
1086 `------------------------------------------------------------*/
1087 yynewstate:
1088 /* In all cases, when you get here, the value and location stacks
1089 have just been pushed. So pushing a state here evens the stacks. */
1090 yyssp++;
1091
1092 yysetstate:
1093 *yyssp = yystate;
1094
1095 if (yyss + yystacksize - 1 <= yyssp)
1096 {
1097 /* Get the current used size of the three stacks, in elements. */
1098 YYSIZE_T yysize = yyssp - yyss + 1;
1099
1100 #ifdef yyoverflow
1101 {
1102 /* Give user a chance to reallocate the stack. Use copies of
1103 these so that the &'s don't force the real ones into
1104 memory. */
1105 YYSTYPE *yyvs1 = yyvs;
1106 yytype_int16 *yyss1 = yyss;
1107
1108 /* Each stack pointer address is followed by the size of the
1109 data in use in that stack, in bytes. This used to be a
1110 conditional around just the two extra args, but that might
1111 be undefined if yyoverflow is a macro. */
1112 yyoverflow (YY_("memory exhausted"),
1113 &yyss1, yysize * sizeof (*yyssp),
1114 &yyvs1, yysize * sizeof (*yyvsp),
1115 &yystacksize);
1116
1117 yyss = yyss1;
1118 yyvs = yyvs1;
1119 }
1120 #else /* no yyoverflow */
1121 # ifndef YYSTACK_RELOCATE
1122 goto yyexhaustedlab;
1123 # else
1124 /* Extend the stack our own way. */
1125 if (YYMAXDEPTH <= yystacksize)
1126 goto yyexhaustedlab;
1127 yystacksize *= 2;
1128 if (YYMAXDEPTH < yystacksize)
1129 yystacksize = YYMAXDEPTH;
1130
1131 {
1132 yytype_int16 *yyss1 = yyss;
1133 union yyalloc *yyptr =
1134 (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
1135 if (! yyptr)
1136 goto yyexhaustedlab;
1137 YYSTACK_RELOCATE (yyss_alloc, yyss);
1138 YYSTACK_RELOCATE (yyvs_alloc, yyvs);
1139 # undef YYSTACK_RELOCATE
1140 if (yyss1 != yyssa)
1141 YYSTACK_FREE (yyss1);
1142 }
1143 # endif
1144 #endif /* no yyoverflow */
1145
1146 yyssp = yyss + yysize - 1;
1147 yyvsp = yyvs + yysize - 1;
1148
1149 YYDPRINTF ((stderr, "Stack size increased to %lu\n",
1150 (unsigned long int) yystacksize));
1151
1152 if (yyss + yystacksize - 1 <= yyssp)
1153 YYABORT;
1154 }
1155
1156 YYDPRINTF ((stderr, "Entering state %d\n", yystate));
1157
1158 if (yystate == YYFINAL)
1159 YYACCEPT;
1160
1161 goto yybackup;
1162
1163 /*-----------.
1164 | yybackup. |
1165 `-----------*/
1166 yybackup:
1167
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 yyn = yypact[yystate];
1173 if (yypact_value_is_default (yyn))
1174 goto yydefault;
1175
1176 /* Not known => get a lookahead token if don't already have one. */
1177
1178 /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */
1179 if (yychar == YYEMPTY)
1180 {
1181 YYDPRINTF ((stderr, "Reading a token: "));
1182 yychar = yylex ();
1183 }
1184
1185 if (yychar <= YYEOF)
1186 {
1187 yychar = yytoken = YYEOF;
1188 YYDPRINTF ((stderr, "Now at end of input.\n"));
1189 }
1190 else
1191 {
1192 yytoken = YYTRANSLATE (yychar);
1193 YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
1194 }
1195
1196 /* If the proper action on seeing token YYTOKEN is to reduce or to
1197 detect an error, take that action. */
1198 yyn += yytoken;
1199 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
1200 goto yydefault;
1201 yyn = yytable[yyn];
1202 if (yyn <= 0)
1203 {
1204 if (yytable_value_is_error (yyn))
1205 goto yyerrlab;
1206 yyn = -yyn;
1207 goto yyreduce;
1208 }
1209
1210 /* Count tokens shifted since error; after three, turn off error
1211 status. */
1212 if (yyerrstatus)
1213 yyerrstatus--;
1214
1215 /* Shift the lookahead token. */
1216 YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
1217
1218 /* Discard the shifted token. */
1219 yychar = YYEMPTY;
1220
1221 yystate = yyn;
1222 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1223 *++yyvsp = yylval;
1224 YY_IGNORE_MAYBE_UNINITIALIZED_END
1225
1226 goto yynewstate;
1227
1228
1229 /*-----------------------------------------------------------.
1230 | yydefault -- do the default action for the current state. |
1231 `-----------------------------------------------------------*/
1232 yydefault:
1233 yyn = yydefact[yystate];
1234 if (yyn == 0)
1235 goto yyerrlab;
1236 goto yyreduce;
1237
1238
1239 /*-----------------------------.
1240 | yyreduce -- Do a reduction. |
1241 `-----------------------------*/
1242 yyreduce:
1243 /* yyn is the number of a rule to reduce with. */
1244 yylen = yyr2[yyn];
1245
1246 /* If YYLEN is nonzero, implement the default value of the action:
1247 '$$ = $1'.
1248
1249 Otherwise, the following line sets YYVAL to garbage.
1250 This behavior is undocumented and Bison
1251 users should not rely upon it. Assigning to YYVAL
1252 unconditionally makes the parser a bit smaller, and it avoids a
1253 GCC warning that YYVAL may be used uninitialized. */
1254 yyval = yyvsp[1-yylen];
1255
1256
1257 YY_REDUCE_PRINT (yyn);
1258 switch (yyn)
1259 {
1260 case 11:
1261 #line 98 "../lib/gamelib/audp_parser.ypp" /* yacc.c:1646 */
1262 {
1263 audio_SetTrackVals((yyvsp[-3].sval), (yyvsp[-2].bval), (yyvsp[-1].ival), (yyvsp[0].ival));
1264 free((yyvsp[-3].sval));
1265 }
1266 #line 1267 "audp_parser.tab.cpp" /* yacc.c:1646 */
1267 break;
1268
1269 case 12:
1270 #line 105 "../lib/gamelib/audp_parser.ypp" /* yacc.c:1646 */
1271 { (yyval.bval) = true; }
1272 #line 1273 "audp_parser.tab.cpp" /* yacc.c:1646 */
1273 break;
1274
1275 case 13:
1276 #line 107 "../lib/gamelib/audp_parser.ypp" /* yacc.c:1646 */
1277 { (yyval.bval) = false; }
1278 #line 1279 "audp_parser.tab.cpp" /* yacc.c:1646 */
1279 break;
1280
1281
1282 #line 1283 "audp_parser.tab.cpp" /* yacc.c:1646 */
1283 default: break;
1284 }
1285 /* User semantic actions sometimes alter yychar, and that requires
1286 that yytoken be updated with the new translation. We take the
1287 approach of translating immediately before every use of yytoken.
1288 One alternative is translating here after every semantic action,
1289 but that translation would be missed if the semantic action invokes
1290 YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or
1291 if it invokes YYBACKUP. In the case of YYABORT or YYACCEPT, an
1292 incorrect destructor might then be invoked immediately. In the
1293 case of YYERROR or YYBACKUP, subsequent parser actions might lead
1294 to an incorrect destructor call or verbose syntax error message
1295 before the lookahead is translated. */
1296 YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
1297
1298 YYPOPSTACK (yylen);
1299 yylen = 0;
1300 YY_STACK_PRINT (yyss, yyssp);
1301
1302 *++yyvsp = yyval;
1303
1304 /* Now 'shift' the result of the reduction. Determine what state
1305 that goes to, based on the state we popped back to and the rule
1306 number reduced by. */
1307
1308 yyn = yyr1[yyn];
1309
1310 yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
1311 if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
1312 yystate = yytable[yystate];
1313 else
1314 yystate = yydefgoto[yyn - YYNTOKENS];
1315
1316 goto yynewstate;
1317
1318
1319 /*--------------------------------------.
1320 | yyerrlab -- here on detecting error. |
1321 `--------------------------------------*/
1322 yyerrlab:
1323 /* Make sure we have latest lookahead translation. See comments at
1324 user semantic actions for why this is necessary. */
1325 yytoken = yychar == YYEMPTY ? YYEMPTY : YYTRANSLATE (yychar);
1326
1327 /* If not already recovering from an error, report this error. */
1328 if (!yyerrstatus)
1329 {
1330 ++yynerrs;
1331 #if ! YYERROR_VERBOSE
1332 yyerror (YY_("syntax error"));
1333 #else
1334 # define YYSYNTAX_ERROR yysyntax_error (&yymsg_alloc, &yymsg, \
1335 yyssp, yytoken)
1336 {
1337 char const *yymsgp = YY_("syntax error");
1338 int yysyntax_error_status;
1339 yysyntax_error_status = YYSYNTAX_ERROR;
1340 if (yysyntax_error_status == 0)
1341 yymsgp = yymsg;
1342 else if (yysyntax_error_status == 1)
1343 {
1344 if (yymsg != yymsgbuf)
1345 YYSTACK_FREE (yymsg);
1346 yymsg = (char *) YYSTACK_ALLOC (yymsg_alloc);
1347 if (!yymsg)
1348 {
1349 yymsg = yymsgbuf;
1350 yymsg_alloc = sizeof yymsgbuf;
1351 yysyntax_error_status = 2;
1352 }
1353 else
1354 {
1355 yysyntax_error_status = YYSYNTAX_ERROR;
1356 yymsgp = yymsg;
1357 }
1358 }
1359 yyerror (yymsgp);
1360 if (yysyntax_error_status == 2)
1361 goto yyexhaustedlab;
1362 }
1363 # undef YYSYNTAX_ERROR
1364 #endif
1365 }
1366
1367
1368
1369 if (yyerrstatus == 3)
1370 {
1371 /* If just tried and failed to reuse lookahead token after an
1372 error, discard it. */
1373
1374 if (yychar <= YYEOF)
1375 {
1376 /* Return failure if at end of input. */
1377 if (yychar == YYEOF)
1378 YYABORT;
1379 }
1380 else
1381 {
1382 yydestruct ("Error: discarding",
1383 yytoken, &yylval);
1384 yychar = YYEMPTY;
1385 }
1386 }
1387
1388 /* Else will try to reuse lookahead token after shifting the error
1389 token. */
1390 goto yyerrlab1;
1391
1392
1393 /*---------------------------------------------------.
1394 | yyerrorlab -- error raised explicitly by YYERROR. |
1395 `---------------------------------------------------*/
1396 yyerrorlab:
1397
1398 /* Pacify compilers like GCC when the user code never invokes
1399 YYERROR and the label yyerrorlab therefore never appears in user
1400 code. */
1401 if (/*CONSTCOND*/ 0)
1402 goto yyerrorlab;
1403
1404 /* Do not reclaim the symbols of the rule whose action triggered
1405 this YYERROR. */
1406 YYPOPSTACK (yylen);
1407 yylen = 0;
1408 YY_STACK_PRINT (yyss, yyssp);
1409 yystate = *yyssp;
1410 goto yyerrlab1;
1411
1412
1413 /*-------------------------------------------------------------.
1414 | yyerrlab1 -- common code for both syntax error and YYERROR. |
1415 `-------------------------------------------------------------*/
1416 yyerrlab1:
1417 yyerrstatus = 3; /* Each real token shifted decrements this. */
1418
1419 for (;;)
1420 {
1421 yyn = yypact[yystate];
1422 if (!yypact_value_is_default (yyn))
1423 {
1424 yyn += YYTERROR;
1425 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
1426 {
1427 yyn = yytable[yyn];
1428 if (0 < yyn)
1429 break;
1430 }
1431 }
1432
1433 /* Pop the current state because it cannot handle the error token. */
1434 if (yyssp == yyss)
1435 YYABORT;
1436
1437
1438 yydestruct ("Error: popping",
1439 yystos[yystate], yyvsp);
1440 YYPOPSTACK (1);
1441 yystate = *yyssp;
1442 YY_STACK_PRINT (yyss, yyssp);
1443 }
1444
1445 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1446 *++yyvsp = yylval;
1447 YY_IGNORE_MAYBE_UNINITIALIZED_END
1448
1449
1450 /* Shift the error token. */
1451 YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
1452
1453 yystate = yyn;
1454 goto yynewstate;
1455
1456
1457 /*-------------------------------------.
1458 | yyacceptlab -- YYACCEPT comes here. |
1459 `-------------------------------------*/
1460 yyacceptlab:
1461 yyresult = 0;
1462 goto yyreturn;
1463
1464 /*-----------------------------------.
1465 | yyabortlab -- YYABORT comes here. |
1466 `-----------------------------------*/
1467 yyabortlab:
1468 yyresult = 1;
1469 goto yyreturn;
1470
1471 #if !defined yyoverflow || YYERROR_VERBOSE
1472 /*-------------------------------------------------.
1473 | yyexhaustedlab -- memory exhaustion comes here. |
1474 `-------------------------------------------------*/
1475 yyexhaustedlab:
1476 yyerror (YY_("memory exhausted"));
1477 yyresult = 2;
1478 /* Fall through. */
1479 #endif
1480
1481 yyreturn:
1482 if (yychar != YYEMPTY)
1483 {
1484 /* Make sure we have latest lookahead translation. See comments at
1485 user semantic actions for why this is necessary. */
1486 yytoken = YYTRANSLATE (yychar);
1487 yydestruct ("Cleanup: discarding lookahead",
1488 yytoken, &yylval);
1489 }
1490 /* Do not reclaim the symbols of the rule whose action triggered
1491 this YYABORT or YYACCEPT. */
1492 YYPOPSTACK (yylen);
1493 YY_STACK_PRINT (yyss, yyssp);
1494 while (yyssp != yyss)
1495 {
1496 yydestruct ("Cleanup: popping",
1497 yystos[*yyssp], yyvsp);
1498 YYPOPSTACK (1);
1499 }
1500 #ifndef yyoverflow
1501 if (yyss != yyssa)
1502 YYSTACK_FREE (yyss);
1503 #endif
1504 #if YYERROR_VERBOSE
1505 if (yymsg != yymsgbuf)
1506 YYSTACK_FREE (yymsg);
1507 #endif
1508 return yyresult;
1509 }
1510 #line 110 "../lib/gamelib/audp_parser.ypp" /* yacc.c:1906 */
1511
1512
1513 /* A simple error reporting routine */
yyerror(const char * msg)1514 void yyerror(const char* msg)
1515 {
1516 debug(LOG_ERROR, "RES file parse error:\n%s at line %d\nToken: %d, Text: '%s'\n", msg, audp_get_lineno(), audp_char, audp_get_text());
1517 }
1518
1519 /** Read an audio properties file
1520 */
ParseResourceFile(PHYSFS_file * fileHandle)1521 bool ParseResourceFile(PHYSFS_file* fileHandle)
1522 {
1523 bool retval;
1524 lexerinput_t input;
1525 input.type = LEXINPUT_PHYSFS;
1526 input.input.physfsfile = fileHandle;
1527
1528 audp_set_extra(&input);
1529
1530 retval = (audp_parse() == 0);
1531 audp_lex_destroy();
1532
1533 return retval;
1534 }
1535