1
/* A Bison parser, made by GNU Bison 2.3. */
3
/* Skeleton implementation for Bison's Yacc-like parsers in C
5
Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
6
Free Software Foundation, Inc.
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 2, or (at your option)
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.
18
You should have received a copy of the GNU General Public License
19
along with this program; if not, write to the Free Software
20
Foundation, Inc., 51 Franklin Street, Fifth Floor,
21
Boston, MA 02110-1301, USA. */
23
/* As a special exception, you may create a larger work that contains
24
part or all of the Bison parser skeleton and distribute that work
25
under terms of your choice, so long as that work isn't itself a
26
parser generator using the skeleton or a modified version thereof
27
as a parser skeleton. Alternatively, if you modify or redistribute
28
the parser skeleton itself, you may (at your option) remove this
29
special exception, which will cause the skeleton and the resulting
30
Bison output files to be licensed under the GNU General Public
31
License without this special exception.
33
This special exception was added by the Free Software Foundation in
34
version 2.2 of Bison. */
36
/* C LALR(1) parser skeleton written by Richard Stallman, by
37
simplifying the original so-called "semantic" parser. */
39
/* All symbols defined below should begin with yy or YY, to avoid
40
infringing on user name space. This should be done even for local
41
variables, as they might otherwise be expanded by user macros.
42
There are some unavoidable exceptions within include files to
43
define necessary library symbols; they are noted "INFRINGES ON
44
USER NAME SPACE" below. */
46
/* Identify Bison output. */
50
#define YYBISON_VERSION "2.3"
53
#define YYSKELETON_NAME "yacc.c"
58
/* Using locations. */
59
#define YYLSP_NEEDED 0
61
/* Substitute the variable and function names. */
62
#define yyparse res_parse
64
#define yyerror res_error
65
#define yylval res_lval
66
#define yychar res_char
67
#define yydebug res_debug
68
#define yynerrs res_nerrs
74
/* Put the tokens into the symbol table, so that GDB and other debuggers
92
/* Copy the first part of user declarations. */
93
#line 20 "resource_parser.y"
97
* Parser for RES (*.wrf) files
100
extern int res_lex(void);
101
extern int res_get_lineno(void);
102
extern char* res_get_text(void);
104
/* Allow frame header files to be singly included */
105
#define FRAME_LIB_INCLUDE
107
#include "lib/framework/frame.h"
111
#include "lib/framework/string_ext.h"
112
#include "lib/framework/frameresource.h"
113
#include "lib/framework/resly.h"
115
extern void yyerror(const char* msg);
116
void yyerror(const char* msg)
118
debug(LOG_ERROR, "RES file parse error:\n%s at line %d\nText: '%s'\n", msg, res_get_lineno(), res_get_text());
123
/* Enabling traces. */
128
/* Enabling verbose error messages. */
129
#ifdef YYERROR_VERBOSE
130
# undef YYERROR_VERBOSE
131
# define YYERROR_VERBOSE 1
133
# define YYERROR_VERBOSE 0
136
/* Enabling the token table. */
137
#ifndef YYTOKEN_TABLE
138
# define YYTOKEN_TABLE 0
141
#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
142
typedef union YYSTYPE
143
#line 51 "resource_parser.y"
147
/* Line 187 of yacc.c. */
148
#line 149 "resource_parser.tab.c"
150
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
151
# define YYSTYPE_IS_DECLARED 1
152
# define YYSTYPE_IS_TRIVIAL 1
157
/* Copy the second part of user declarations. */
160
/* Line 216 of yacc.c. */
161
#line 162 "resource_parser.tab.c"
168
typedef YYTYPE_UINT8 yytype_uint8;
170
typedef unsigned char yytype_uint8;
174
typedef YYTYPE_INT8 yytype_int8;
175
#elif (defined __STDC__ || defined __C99__FUNC__ \
176
|| defined __cplusplus || defined _MSC_VER)
177
typedef signed char yytype_int8;
179
typedef short int yytype_int8;
183
typedef YYTYPE_UINT16 yytype_uint16;
185
typedef unsigned short int yytype_uint16;
189
typedef YYTYPE_INT16 yytype_int16;
191
typedef short int yytype_int16;
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 && (defined __STDC__ || defined __C99__FUNC__ \
200
|| defined __cplusplus || defined _MSC_VER)
201
# include <stddef.h> /* INFRINGES ON USER NAME SPACE */
202
# define YYSIZE_T size_t
204
# define YYSIZE_T unsigned int
208
#define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
213
# include <libintl.h> /* INFRINGES ON USER NAME SPACE */
214
# define YY_(msgid) dgettext ("bison-runtime", msgid)
218
# define YY_(msgid) msgid
222
/* Suppress unused-variable warnings by "using" E. */
223
#if ! defined lint || defined __GNUC__
224
# define YYUSE(e) ((void) (e))
226
# define YYUSE(e) /* empty */
229
/* Identity function, used to suppress warnings about constant conditions. */
233
#if (defined __STDC__ || defined __C99__FUNC__ \
234
|| defined __cplusplus || defined _MSC_VER)
247
#if ! defined yyoverflow || YYERROR_VERBOSE
249
/* The parser invokes alloca or malloc; define the necessary symbols. */
251
# ifdef YYSTACK_USE_ALLOCA
252
# if YYSTACK_USE_ALLOCA
254
# define YYSTACK_ALLOC __builtin_alloca
255
# elif defined __BUILTIN_VA_ARG_INCR
256
# include <alloca.h> /* INFRINGES ON USER NAME SPACE */
258
# define YYSTACK_ALLOC __alloca
259
# elif defined _MSC_VER
260
# include <malloc.h> /* INFRINGES ON USER NAME SPACE */
261
# define alloca _alloca
263
# define YYSTACK_ALLOC alloca
264
# if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
265
|| defined __cplusplus || defined _MSC_VER)
266
# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
275
# ifdef YYSTACK_ALLOC
276
/* Pacify GCC's `empty if-body' warning. */
277
# define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0))
278
# ifndef YYSTACK_ALLOC_MAXIMUM
279
/* The OS might guarantee only one guard page at the bottom of the stack,
280
and a page size can be as small as 4096 bytes. So we cannot safely
281
invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
282
to allow for a few compiler-allocated temporary stack slots. */
283
# define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
286
# define YYSTACK_ALLOC YYMALLOC
287
# define YYSTACK_FREE YYFREE
288
# ifndef YYSTACK_ALLOC_MAXIMUM
289
# define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
291
# if (defined __cplusplus && ! defined _STDLIB_H \
292
&& ! ((defined YYMALLOC || defined malloc) \
293
&& (defined YYFREE || defined free)))
294
# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
300
# define YYMALLOC malloc
301
# if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
302
|| defined __cplusplus || defined _MSC_VER)
303
void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
308
# if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
309
|| defined __cplusplus || defined _MSC_VER)
310
void free (void *); /* INFRINGES ON USER NAME SPACE */
314
#endif /* ! defined yyoverflow || YYERROR_VERBOSE */
317
#if (! defined yyoverflow \
318
&& (! defined __cplusplus \
319
|| (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
321
/* A type that is properly aligned for any stack member. */
328
/* The size of the maximum gap between one aligned stack and the next. */
329
# define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
331
/* The size of an array large to enough to hold all stacks, each with
333
# define YYSTACK_BYTES(N) \
334
((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
335
+ YYSTACK_GAP_MAXIMUM)
337
/* Copy COUNT objects from FROM to TO. The source and destination do
340
# if defined __GNUC__ && 1 < __GNUC__
341
# define YYCOPY(To, From, Count) \
342
__builtin_memcpy (To, From, (Count) * sizeof (*(From)))
344
# define YYCOPY(To, From, Count) \
348
for (yyi = 0; yyi < (Count); yyi++) \
349
(To)[yyi] = (From)[yyi]; \
355
/* Relocate STACK from its old location to the new one. The
356
local variables YYSIZE and YYSTACKSIZE give the old and new number of
357
elements in the stack, and YYPTR gives the new location of the
358
stack. Advance YYPTR to a properly aligned location for the next
360
# define YYSTACK_RELOCATE(Stack) \
363
YYSIZE_T yynewbytes; \
364
YYCOPY (&yyptr->Stack, Stack, yysize); \
365
Stack = &yyptr->Stack; \
366
yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
367
yyptr += yynewbytes / sizeof (*yyptr); \
373
/* YYFINAL -- State number of the termination state. */
375
/* YYLAST -- Last index in YYTABLE. */
378
/* YYNTOKENS -- Number of terminals. */
380
/* YYNNTS -- Number of nonterminals. */
382
/* YYNRULES -- Number of rules. */
384
/* YYNRULES -- Number of states. */
387
/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
389
#define YYMAXUTOK 261
391
#define YYTRANSLATE(YYX) \
392
((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
394
/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
395
static const yytype_uint8 yytranslate[] =
397
0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
398
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
399
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
400
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
401
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
402
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
403
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
404
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
405
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
406
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
407
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
408
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
409
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
410
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
411
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
412
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
413
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
414
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
415
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
416
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
417
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
418
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
419
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
420
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
421
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
422
2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
427
/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
429
static const yytype_uint8 yyprhs[] =
431
0, 0, 3, 5, 8, 10, 12, 15
434
/* YYRHS -- A `-1'-separated list of the rules' RHS. */
435
static const yytype_int8 yyrhs[] =
437
8, 0, -1, 9, -1, 8, 9, -1, 10, -1,
438
11, -1, 5, 4, -1, 6, 3, 4, -1
441
/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
442
static const yytype_uint8 yyrline[] =
444
0, 75, 75, 76, 79, 80, 83, 112
448
#if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
449
/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
450
First, the terminals, then, starting at YYNTOKENS, nonterminals. */
451
static const char *const yytname[] =
453
"$end", "error", "$undefined", "TEXT_T", "QTEXT_T", "DIRECTORY",
454
"FILETOKEN", "$accept", "res_file", "res_line", "dir_line", "file_line", 0
459
/* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
461
static const yytype_uint16 yytoknum[] =
463
0, 256, 257, 258, 259, 260, 261
467
/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
468
static const yytype_uint8 yyr1[] =
470
0, 7, 8, 8, 9, 9, 10, 11
473
/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
474
static const yytype_uint8 yyr2[] =
476
0, 2, 1, 2, 1, 1, 2, 3
479
/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
480
STATE-NUM when YYTABLE doesn't specify something else to do. Zero
481
means the default is an error. */
482
static const yytype_uint8 yydefact[] =
484
0, 0, 0, 0, 2, 4, 5, 6, 0, 1,
488
/* YYDEFGOTO[NTERM-NUM]. */
489
static const yytype_int8 yydefgoto[] =
494
/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
496
#define YYPACT_NINF -5
497
static const yytype_int8 yypact[] =
499
-4, -1, 1, 0, -5, -5, -5, -5, 3, -5,
503
/* YYPGOTO[NTERM-NUM]. */
504
static const yytype_int8 yypgoto[] =
509
/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
510
positive, shift that token. If negative, reduce the rule which
511
number is the opposite. If zero, do what YYDEFACT says.
512
If YYTABLE_NINF, syntax error. */
513
#define YYTABLE_NINF -1
514
static const yytype_uint8 yytable[] =
516
9, 1, 2, 7, 8, 1, 2, 11, 10
519
static const yytype_uint8 yycheck[] =
521
0, 5, 6, 4, 3, 5, 6, 4, 3
524
/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
525
symbol of state STATE-NUM. */
526
static const yytype_uint8 yystos[] =
528
0, 5, 6, 8, 9, 10, 11, 4, 3, 0,
532
#define yyerrok (yyerrstatus = 0)
533
#define yyclearin (yychar = YYEMPTY)
537
#define YYACCEPT goto yyacceptlab
538
#define YYABORT goto yyabortlab
539
#define YYERROR goto yyerrorlab
542
/* Like YYERROR except do call yyerror. This remains here temporarily
543
to ease the transition to the new meaning of YYERROR, for GCC.
544
Once GCC version 2 has supplanted version 1, this can go. */
546
#define YYFAIL goto yyerrlab
548
#define YYRECOVERING() (!!yyerrstatus)
550
#define YYBACKUP(Token, Value) \
552
if (yychar == YYEMPTY && yylen == 1) \
556
yytoken = YYTRANSLATE (yychar); \
562
yyerror (YY_("syntax error: cannot back up")); \
569
#define YYERRCODE 256
572
/* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
573
If N is 0, then set CURRENT to the empty location which ends
574
the previous symbol: RHS[0] (always defined). */
576
#define YYRHSLOC(Rhs, K) ((Rhs)[K])
577
#ifndef YYLLOC_DEFAULT
578
# define YYLLOC_DEFAULT(Current, Rhs, N) \
582
(Current).first_line = YYRHSLOC (Rhs, 1).first_line; \
583
(Current).first_column = YYRHSLOC (Rhs, 1).first_column; \
584
(Current).last_line = YYRHSLOC (Rhs, N).last_line; \
585
(Current).last_column = YYRHSLOC (Rhs, N).last_column; \
589
(Current).first_line = (Current).last_line = \
590
YYRHSLOC (Rhs, 0).last_line; \
591
(Current).first_column = (Current).last_column = \
592
YYRHSLOC (Rhs, 0).last_column; \
598
/* YY_LOCATION_PRINT -- Print the location on the stream.
599
This macro was not mandated originally: define only if we know
600
we won't break user code: when these are the locations we know. */
602
#ifndef YY_LOCATION_PRINT
603
# if YYLTYPE_IS_TRIVIAL
604
# define YY_LOCATION_PRINT(File, Loc) \
605
fprintf (File, "%d.%d-%d.%d", \
606
(Loc).first_line, (Loc).first_column, \
607
(Loc).last_line, (Loc).last_column)
609
# define YY_LOCATION_PRINT(File, Loc) ((void) 0)
614
/* YYLEX -- calling `yylex' with the right arguments. */
617
# define YYLEX yylex (YYLEX_PARAM)
619
# define YYLEX yylex ()
622
/* Enable debugging if requested. */
626
# include <stdio.h> /* INFRINGES ON USER NAME SPACE */
627
# define YYFPRINTF fprintf
630
# define YYDPRINTF(Args) \
636
# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
640
YYFPRINTF (stderr, "%s ", Title); \
641
yy_symbol_print (stderr, \
643
YYFPRINTF (stderr, "\n"); \
648
/*--------------------------------.
649
| Print this symbol on YYOUTPUT. |
650
`--------------------------------*/
653
#if (defined __STDC__ || defined __C99__FUNC__ \
654
|| defined __cplusplus || defined _MSC_VER)
656
yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
659
yy_symbol_value_print (yyoutput, yytype, yyvaluep)
662
YYSTYPE const * const yyvaluep;
668
if (yytype < YYNTOKENS)
669
YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
681
/*--------------------------------.
682
| Print this symbol on YYOUTPUT. |
683
`--------------------------------*/
685
#if (defined __STDC__ || defined __C99__FUNC__ \
686
|| defined __cplusplus || defined _MSC_VER)
688
yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
691
yy_symbol_print (yyoutput, yytype, yyvaluep)
694
YYSTYPE const * const yyvaluep;
697
if (yytype < YYNTOKENS)
698
YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
700
YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
702
yy_symbol_value_print (yyoutput, yytype, yyvaluep);
703
YYFPRINTF (yyoutput, ")");
706
/*------------------------------------------------------------------.
707
| yy_stack_print -- Print the state stack from its BOTTOM up to its |
709
`------------------------------------------------------------------*/
711
#if (defined __STDC__ || defined __C99__FUNC__ \
712
|| defined __cplusplus || defined _MSC_VER)
714
yy_stack_print (yytype_int16 *bottom, yytype_int16 *top)
717
yy_stack_print (bottom, top)
718
yytype_int16 *bottom;
722
YYFPRINTF (stderr, "Stack now");
723
for (; bottom <= top; ++bottom)
724
YYFPRINTF (stderr, " %d", *bottom);
725
YYFPRINTF (stderr, "\n");
728
# define YY_STACK_PRINT(Bottom, Top) \
731
yy_stack_print ((Bottom), (Top)); \
735
/*------------------------------------------------.
736
| Report that the YYRULE is going to be reduced. |
737
`------------------------------------------------*/
739
#if (defined __STDC__ || defined __C99__FUNC__ \
740
|| defined __cplusplus || defined _MSC_VER)
742
yy_reduce_print (YYSTYPE *yyvsp, int yyrule)
745
yy_reduce_print (yyvsp, yyrule)
750
int yynrhs = yyr2[yyrule];
752
unsigned long int yylno = yyrline[yyrule];
753
YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
755
/* The symbols being reduced. */
756
for (yyi = 0; yyi < yynrhs; yyi++)
758
fprintf (stderr, " $%d = ", yyi + 1);
759
yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi],
760
&(yyvsp[(yyi + 1) - (yynrhs)])
762
fprintf (stderr, "\n");
766
# define YY_REDUCE_PRINT(Rule) \
769
yy_reduce_print (yyvsp, Rule); \
772
/* Nonzero means print parse trace. It is left uninitialized so that
773
multiple parsers can coexist. */
776
# define YYDPRINTF(Args)
777
# define YY_SYMBOL_PRINT(Title, Type, Value, Location)
778
# define YY_STACK_PRINT(Bottom, Top)
779
# define YY_REDUCE_PRINT(Rule)
780
#endif /* !YYDEBUG */
783
/* YYINITDEPTH -- initial size of the parser's stacks. */
785
# define YYINITDEPTH 200
788
/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
789
if the built-in stack extension method is used).
791
Do not make this value too large; the results are undefined if
792
YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
793
evaluated with infinite-precision integer arithmetic. */
796
# define YYMAXDEPTH 10000
804
# if defined __GLIBC__ && defined _STRING_H
805
# define yystrlen strlen
807
/* Return the length of YYSTR. */
808
#if (defined __STDC__ || defined __C99__FUNC__ \
809
|| defined __cplusplus || defined _MSC_VER)
811
yystrlen (const char *yystr)
819
for (yylen = 0; yystr[yylen]; yylen++)
827
# if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
828
# define yystpcpy stpcpy
830
/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
832
#if (defined __STDC__ || defined __C99__FUNC__ \
833
|| defined __cplusplus || defined _MSC_VER)
835
yystpcpy (char *yydest, const char *yysrc)
838
yystpcpy (yydest, yysrc)
844
const char *yys = yysrc;
846
while ((*yyd++ = *yys++) != '\0')
855
/* Copy to YYRES the contents of YYSTR after stripping away unnecessary
856
quotes and backslashes, so that it's suitable for yyerror. The
857
heuristic is that double-quoting is unnecessary unless the string
858
contains an apostrophe, a comma, or backslash (other than
859
backslash-backslash). YYSTR is taken from yytname. If YYRES is
860
null, do not copy; instead, return the length of what the result
863
yytnamerr (char *yyres, const char *yystr)
868
char const *yyp = yystr;
875
goto do_not_strip_quotes;
879
goto do_not_strip_quotes;
892
do_not_strip_quotes: ;
896
return yystrlen (yystr);
898
return yystpcpy (yyres, yystr) - yyres;
902
/* Copy into YYRESULT an error message about the unexpected token
903
YYCHAR while in state YYSTATE. Return the number of bytes copied,
904
including the terminating null byte. If YYRESULT is null, do not
905
copy anything; just return the number of bytes that would be
906
copied. As a special case, return 0 if an ordinary "syntax error"
907
message will do. Return YYSIZE_MAXIMUM if overflow occurs during
910
yysyntax_error (char *yyresult, int yystate, int yychar)
912
int yyn = yypact[yystate];
914
if (! (YYPACT_NINF < yyn && yyn <= YYLAST))
918
int yytype = YYTRANSLATE (yychar);
919
YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]);
920
YYSIZE_T yysize = yysize0;
922
int yysize_overflow = 0;
923
enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
924
char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
928
/* This is so xgettext sees the translatable formats that are
929
constructed on the fly. */
930
YY_("syntax error, unexpected %s");
931
YY_("syntax error, unexpected %s, expecting %s");
932
YY_("syntax error, unexpected %s, expecting %s or %s");
933
YY_("syntax error, unexpected %s, expecting %s or %s or %s");
934
YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s");
938
static char const yyunexpected[] = "syntax error, unexpected %s";
939
static char const yyexpecting[] = ", expecting %s";
940
static char const yyor[] = " or %s";
941
char yyformat[sizeof yyunexpected
942
+ sizeof yyexpecting - 1
943
+ ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2)
944
* (sizeof yyor - 1))];
945
char const *yyprefix = yyexpecting;
947
/* Start YYX at -YYN if negative to avoid negative indexes in
949
int yyxbegin = yyn < 0 ? -yyn : 0;
951
/* Stay within bounds of both yycheck and yytname. */
952
int yychecklim = YYLAST - yyn + 1;
953
int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
956
yyarg[0] = yytname[yytype];
957
yyfmt = yystpcpy (yyformat, yyunexpected);
959
for (yyx = yyxbegin; yyx < yyxend; ++yyx)
960
if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
962
if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
966
yyformat[sizeof yyunexpected - 1] = '\0';
969
yyarg[yycount++] = yytname[yyx];
970
yysize1 = yysize + yytnamerr (0, yytname[yyx]);
971
yysize_overflow |= (yysize1 < yysize);
973
yyfmt = yystpcpy (yyfmt, yyprefix);
978
yysize1 = yysize + yystrlen (yyf);
979
yysize_overflow |= (yysize1 < yysize);
983
return YYSIZE_MAXIMUM;
987
/* Avoid sprintf, as that infringes on the user's name space.
988
Don't have undefined behavior even if the translation
989
produced a string with the wrong number of "%s"s. */
990
char *yyp = yyresult;
992
while ((*yyp = *yyf) != '\0')
994
if (*yyp == '%' && yyf[1] == 's' && yyi < yycount)
996
yyp += yytnamerr (yyp, yyarg[yyi++]);
1009
#endif /* YYERROR_VERBOSE */
1012
/*-----------------------------------------------.
1013
| Release the memory associated to this symbol. |
1014
`-----------------------------------------------*/
1017
#if (defined __STDC__ || defined __C99__FUNC__ \
1018
|| defined __cplusplus || defined _MSC_VER)
1020
yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep)
1023
yydestruct (yymsg, yytype, yyvaluep)
1033
YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
1037
case 3: /* "TEXT_T" */
1038
#line 59 "resource_parser.y"
1041
// Force type checking by the compiler
1042
char * const s = (yyvaluep->sval);
1048
#line 1049 "resource_parser.tab.c"
1050
case 4: /* "QTEXT_T" */
1051
#line 59 "resource_parser.y"
1054
// Force type checking by the compiler
1055
char * const s = (yyvaluep->sval);
1061
#line 1062 "resource_parser.tab.c"
1070
/* Prevent warnings from -Wmissing-prototypes. */
1072
#ifdef YYPARSE_PARAM
1073
#if defined __STDC__ || defined __cplusplus
1074
int yyparse (void *YYPARSE_PARAM);
1078
#else /* ! YYPARSE_PARAM */
1079
#if defined __STDC__ || defined __cplusplus
1084
#endif /* ! YYPARSE_PARAM */
1088
/* The look-ahead symbol. */
1091
/* The semantic value of the look-ahead symbol. */
1094
/* Number of syntax errors so far. */
1103
#ifdef YYPARSE_PARAM
1104
#if (defined __STDC__ || defined __C99__FUNC__ \
1105
|| defined __cplusplus || defined _MSC_VER)
1107
yyparse (void *YYPARSE_PARAM)
1110
yyparse (YYPARSE_PARAM)
1111
void *YYPARSE_PARAM;
1113
#else /* ! YYPARSE_PARAM */
1114
#if (defined __STDC__ || defined __C99__FUNC__ \
1115
|| defined __cplusplus || defined _MSC_VER)
1129
/* Number of tokens to shift before error messages enabled. */
1131
/* Look-ahead token as an internal (translated) token number. */
1134
/* Buffer for error messages, and its allocated size. */
1136
char *yymsg = yymsgbuf;
1137
YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
1140
/* Three stacks and their tools:
1141
`yyss': related to states,
1142
`yyvs': related to semantic values,
1143
`yyls': related to locations.
1145
Refer to the stacks thru separate pointers, to allow yyoverflow
1146
to reallocate them elsewhere. */
1148
/* The state stack. */
1149
yytype_int16 yyssa[YYINITDEPTH];
1150
yytype_int16 *yyss = yyssa;
1151
yytype_int16 *yyssp;
1153
/* The semantic value stack. */
1154
YYSTYPE yyvsa[YYINITDEPTH];
1155
YYSTYPE *yyvs = yyvsa;
1160
#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
1162
YYSIZE_T yystacksize = YYINITDEPTH;
1164
/* The variables used to return semantic value and location from the
1169
/* The number of symbols on the RHS of the reduced rule.
1170
Keep to zero when no symbol should be popped. */
1173
YYDPRINTF ((stderr, "Starting parse\n"));
1178
yychar = YYEMPTY; /* Cause a token to be read. */
1180
/* Initialize stack pointers.
1181
Waste one element of value and location stack
1182
so that they stay on the same level as the state stack.
1183
The wasted elements are never initialized. */
1190
/*------------------------------------------------------------.
1191
| yynewstate -- Push a new state, which is found in yystate. |
1192
`------------------------------------------------------------*/
1194
/* In all cases, when you get here, the value and location stacks
1195
have just been pushed. So pushing a state here evens the stacks. */
1201
if (yyss + yystacksize - 1 <= yyssp)
1203
/* Get the current used size of the three stacks, in elements. */
1204
YYSIZE_T yysize = yyssp - yyss + 1;
1208
/* Give user a chance to reallocate the stack. Use copies of
1209
these so that the &'s don't force the real ones into
1211
YYSTYPE *yyvs1 = yyvs;
1212
yytype_int16 *yyss1 = yyss;
1215
/* Each stack pointer address is followed by the size of the
1216
data in use in that stack, in bytes. This used to be a
1217
conditional around just the two extra args, but that might
1218
be undefined if yyoverflow is a macro. */
1219
yyoverflow (YY_("memory exhausted"),
1220
&yyss1, yysize * sizeof (*yyssp),
1221
&yyvs1, yysize * sizeof (*yyvsp),
1228
#else /* no yyoverflow */
1229
# ifndef YYSTACK_RELOCATE
1230
goto yyexhaustedlab;
1232
/* Extend the stack our own way. */
1233
if (YYMAXDEPTH <= yystacksize)
1234
goto yyexhaustedlab;
1236
if (YYMAXDEPTH < yystacksize)
1237
yystacksize = YYMAXDEPTH;
1240
yytype_int16 *yyss1 = yyss;
1241
union yyalloc *yyptr =
1242
(union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
1244
goto yyexhaustedlab;
1245
YYSTACK_RELOCATE (yyss);
1246
YYSTACK_RELOCATE (yyvs);
1248
# undef YYSTACK_RELOCATE
1250
YYSTACK_FREE (yyss1);
1253
#endif /* no yyoverflow */
1255
yyssp = yyss + yysize - 1;
1256
yyvsp = yyvs + yysize - 1;
1259
YYDPRINTF ((stderr, "Stack size increased to %lu\n",
1260
(unsigned long int) yystacksize));
1262
if (yyss + yystacksize - 1 <= yyssp)
1266
YYDPRINTF ((stderr, "Entering state %d\n", yystate));
1275
/* Do appropriate processing given the current state. Read a
1276
look-ahead token if we need one and don't already have one. */
1278
/* First try to decide what to do without reference to look-ahead token. */
1279
yyn = yypact[yystate];
1280
if (yyn == YYPACT_NINF)
1283
/* Not known => get a look-ahead token if don't already have one. */
1285
/* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */
1286
if (yychar == YYEMPTY)
1288
YYDPRINTF ((stderr, "Reading a token: "));
1292
if (yychar <= YYEOF)
1294
yychar = yytoken = YYEOF;
1295
YYDPRINTF ((stderr, "Now at end of input.\n"));
1299
yytoken = YYTRANSLATE (yychar);
1300
YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
1303
/* If the proper action on seeing token YYTOKEN is to reduce or to
1304
detect an error, take that action. */
1306
if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
1311
if (yyn == 0 || yyn == YYTABLE_NINF)
1320
/* Count tokens shifted since error; after three, turn off error
1325
/* Shift the look-ahead token. */
1326
YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
1328
/* Discard the shifted token unless it is eof. */
1329
if (yychar != YYEOF)
1338
/*-----------------------------------------------------------.
1339
| yydefault -- do the default action for the current state. |
1340
`-----------------------------------------------------------*/
1342
yyn = yydefact[yystate];
1348
/*-----------------------------.
1349
| yyreduce -- Do a reduction. |
1350
`-----------------------------*/
1352
/* yyn is the number of a rule to reduce with. */
1355
/* If YYLEN is nonzero, implement the default value of the action:
1358
Otherwise, the following line sets YYVAL to garbage.
1359
This behavior is undocumented and Bison
1360
users should not rely upon it. Assigning to YYVAL
1361
unconditionally makes the parser a bit smaller, and it avoids a
1362
GCC warning that YYVAL may be used uninitialized. */
1363
yyval = yyvsp[1-yylen];
1366
YY_REDUCE_PRINT (yyn);
1370
#line 84 "resource_parser.y"
1374
// set a new input directory
1375
debug(LOG_NEVER, "directory: %s", (yyvsp[(2) - (2)].sval));
1376
if (strncmp((yyvsp[(2) - (2)].sval), "/:", strlen("/:")) == 0)
1378
// the new dir is rooted
1379
sstrcpy(aCurrResDir, (yyvsp[(2) - (2)].sval));
1383
sstrcpy(aCurrResDir, aResDir);
1384
sstrcat(aCurrResDir, (yyvsp[(2) - (2)].sval));
1386
if (strlen((yyvsp[(2) - (2)].sval)) > 0)
1388
// Add a trailing '/'
1389
len = strlen(aCurrResDir);
1390
aCurrResDir[len] = '/';
1391
aCurrResDir[len+1] = 0;
1392
debug(LOG_NEVER, "Current resource directory: %s", aCurrResDir);
1394
free((yyvsp[(2) - (2)].sval));
1399
#line 113 "resource_parser.y"
1402
/* load a data file */
1403
debug(LOG_NEVER, "file: %s %s", (yyvsp[(2) - (3)].sval), (yyvsp[(3) - (3)].sval));
1404
succes = resLoadFile((yyvsp[(2) - (3)].sval), (yyvsp[(3) - (3)].sval));
1405
free((yyvsp[(2) - (3)].sval));
1406
free((yyvsp[(3) - (3)].sval));
1416
/* Line 1267 of yacc.c. */
1417
#line 1418 "resource_parser.tab.c"
1420
YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
1424
YY_STACK_PRINT (yyss, yyssp);
1429
/* Now `shift' the result of the reduction. Determine what state
1430
that goes to, based on the state we popped back to and the rule
1431
number reduced by. */
1435
yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
1436
if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
1437
yystate = yytable[yystate];
1439
yystate = yydefgoto[yyn - YYNTOKENS];
1444
/*------------------------------------.
1445
| yyerrlab -- here on detecting error |
1446
`------------------------------------*/
1448
/* If not already recovering from an error, report this error. */
1452
#if ! YYERROR_VERBOSE
1453
yyerror (YY_("syntax error"));
1456
YYSIZE_T yysize = yysyntax_error (0, yystate, yychar);
1457
if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM)
1459
YYSIZE_T yyalloc = 2 * yysize;
1460
if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM))
1461
yyalloc = YYSTACK_ALLOC_MAXIMUM;
1462
if (yymsg != yymsgbuf)
1463
YYSTACK_FREE (yymsg);
1464
yymsg = (char *) YYSTACK_ALLOC (yyalloc);
1466
yymsg_alloc = yyalloc;
1470
yymsg_alloc = sizeof yymsgbuf;
1474
if (0 < yysize && yysize <= yymsg_alloc)
1476
(void) yysyntax_error (yymsg, yystate, yychar);
1481
yyerror (YY_("syntax error"));
1483
goto yyexhaustedlab;
1491
if (yyerrstatus == 3)
1493
/* If just tried and failed to reuse look-ahead token after an
1494
error, discard it. */
1496
if (yychar <= YYEOF)
1498
/* Return failure if at end of input. */
1499
if (yychar == YYEOF)
1504
yydestruct ("Error: discarding",
1510
/* Else will try to reuse look-ahead token after shifting the error
1515
/*---------------------------------------------------.
1516
| yyerrorlab -- error raised explicitly by YYERROR. |
1517
`---------------------------------------------------*/
1520
/* Pacify compilers like GCC when the user code never invokes
1521
YYERROR and the label yyerrorlab therefore never appears in user
1523
if (/*CONSTCOND*/ 0)
1526
/* Do not reclaim the symbols of the rule which action triggered
1530
YY_STACK_PRINT (yyss, yyssp);
1535
/*-------------------------------------------------------------.
1536
| yyerrlab1 -- common code for both syntax error and YYERROR. |
1537
`-------------------------------------------------------------*/
1539
yyerrstatus = 3; /* Each real token shifted decrements this. */
1543
yyn = yypact[yystate];
1544
if (yyn != YYPACT_NINF)
1547
if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
1555
/* Pop the current state because it cannot handle the error token. */
1560
yydestruct ("Error: popping",
1561
yystos[yystate], yyvsp);
1564
YY_STACK_PRINT (yyss, yyssp);
1573
/* Shift the error token. */
1574
YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
1580
/*-------------------------------------.
1581
| yyacceptlab -- YYACCEPT comes here. |
1582
`-------------------------------------*/
1587
/*-----------------------------------.
1588
| yyabortlab -- YYABORT comes here. |
1589
`-----------------------------------*/
1595
/*-------------------------------------------------.
1596
| yyexhaustedlab -- memory exhaustion comes here. |
1597
`-------------------------------------------------*/
1599
yyerror (YY_("memory exhausted"));
1605
if (yychar != YYEOF && yychar != YYEMPTY)
1606
yydestruct ("Cleanup: discarding lookahead",
1608
/* Do not reclaim the symbols of the rule which action triggered
1609
this YYABORT or YYACCEPT. */
1611
YY_STACK_PRINT (yyss, yyssp);
1612
while (yyssp != yyss)
1614
yydestruct ("Cleanup: popping",
1615
yystos[*yyssp], yyvsp);
1620
YYSTACK_FREE (yyss);
1623
if (yymsg != yymsgbuf)
1624
YYSTACK_FREE (yymsg);
1626
/* Make sure YYID is used. */
1627
return YYID (yyresult);