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 strres_parse
63
#define yylex strres_lex
64
#define yyerror strres_error
65
#define yylval strres_lval
66
#define yychar strres_char
67
#define yydebug strres_debug
68
#define yynerrs strres_nerrs
74
/* Put the tokens into the symbol table, so that GDB and other debuggers
88
/* Copy the first part of user declarations. */
89
#line 20 "strres_parser.y"
93
* Parser for string resource files
96
#include "lib/framework/frame.h"
97
#include "lib/framework/strres.h"
98
#include "lib/framework/strresly.h"
100
extern int strres_lex(void);
101
extern int strres_get_lineno(void);
102
extern char* strres_get_text(void);
104
void yyerror(const char* msg)
106
debug(LOG_ERROR, "STRRES file parse error:\n%s at line %d\nText: '%s'", msg, strres_get_lineno(), strres_get_text());
109
// Forward declaration to allow pointers to this type
112
#define YYPARSE_PARAM psStrRes
116
/* Enabling traces. */
121
/* Enabling verbose error messages. */
122
#ifdef YYERROR_VERBOSE
123
# undef YYERROR_VERBOSE
124
# define YYERROR_VERBOSE 1
126
# define YYERROR_VERBOSE 0
129
/* Enabling the token table. */
130
#ifndef YYTOKEN_TABLE
131
# define YYTOKEN_TABLE 0
134
#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
135
typedef union YYSTYPE
136
#line 48 "strres_parser.y"
140
/* Line 187 of yacc.c. */
141
#line 142 "strres_parser.tab.c"
143
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
144
# define YYSTYPE_IS_DECLARED 1
145
# define YYSTYPE_IS_TRIVIAL 1
150
/* Copy the second part of user declarations. */
153
/* Line 216 of yacc.c. */
154
#line 155 "strres_parser.tab.c"
161
typedef YYTYPE_UINT8 yytype_uint8;
163
typedef unsigned char yytype_uint8;
167
typedef YYTYPE_INT8 yytype_int8;
168
#elif (defined __STDC__ || defined __C99__FUNC__ \
169
|| defined __cplusplus || defined _MSC_VER)
170
typedef signed char yytype_int8;
172
typedef short int yytype_int8;
176
typedef YYTYPE_UINT16 yytype_uint16;
178
typedef unsigned short int yytype_uint16;
182
typedef YYTYPE_INT16 yytype_int16;
184
typedef short int yytype_int16;
188
# ifdef __SIZE_TYPE__
189
# define YYSIZE_T __SIZE_TYPE__
190
# elif defined size_t
191
# define YYSIZE_T size_t
192
# elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \
193
|| defined __cplusplus || defined _MSC_VER)
194
# include <stddef.h> /* INFRINGES ON USER NAME SPACE */
195
# define YYSIZE_T size_t
197
# define YYSIZE_T unsigned int
201
#define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
206
# include <libintl.h> /* INFRINGES ON USER NAME SPACE */
207
# define YY_(msgid) dgettext ("bison-runtime", msgid)
211
# define YY_(msgid) msgid
215
/* Suppress unused-variable warnings by "using" E. */
216
#if ! defined lint || defined __GNUC__
217
# define YYUSE(e) ((void) (e))
219
# define YYUSE(e) /* empty */
222
/* Identity function, used to suppress warnings about constant conditions. */
226
#if (defined __STDC__ || defined __C99__FUNC__ \
227
|| defined __cplusplus || defined _MSC_VER)
240
#if ! defined yyoverflow || YYERROR_VERBOSE
242
/* The parser invokes alloca or malloc; define the necessary symbols. */
244
# ifdef YYSTACK_USE_ALLOCA
245
# if YYSTACK_USE_ALLOCA
247
# define YYSTACK_ALLOC __builtin_alloca
248
# elif defined __BUILTIN_VA_ARG_INCR
249
# include <alloca.h> /* INFRINGES ON USER NAME SPACE */
251
# define YYSTACK_ALLOC __alloca
252
# elif defined _MSC_VER
253
# include <malloc.h> /* INFRINGES ON USER NAME SPACE */
254
# define alloca _alloca
256
# define YYSTACK_ALLOC alloca
257
# if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
258
|| defined __cplusplus || defined _MSC_VER)
259
# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
268
# ifdef YYSTACK_ALLOC
269
/* Pacify GCC's `empty if-body' warning. */
270
# define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0))
271
# ifndef YYSTACK_ALLOC_MAXIMUM
272
/* The OS might guarantee only one guard page at the bottom of the stack,
273
and a page size can be as small as 4096 bytes. So we cannot safely
274
invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
275
to allow for a few compiler-allocated temporary stack slots. */
276
# define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
279
# define YYSTACK_ALLOC YYMALLOC
280
# define YYSTACK_FREE YYFREE
281
# ifndef YYSTACK_ALLOC_MAXIMUM
282
# define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
284
# if (defined __cplusplus && ! defined _STDLIB_H \
285
&& ! ((defined YYMALLOC || defined malloc) \
286
&& (defined YYFREE || defined free)))
287
# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
293
# define YYMALLOC malloc
294
# if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
295
|| defined __cplusplus || defined _MSC_VER)
296
void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
301
# if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
302
|| defined __cplusplus || defined _MSC_VER)
303
void free (void *); /* INFRINGES ON USER NAME SPACE */
307
#endif /* ! defined yyoverflow || YYERROR_VERBOSE */
310
#if (! defined yyoverflow \
311
&& (! defined __cplusplus \
312
|| (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
314
/* A type that is properly aligned for any stack member. */
321
/* The size of the maximum gap between one aligned stack and the next. */
322
# define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
324
/* The size of an array large to enough to hold all stacks, each with
326
# define YYSTACK_BYTES(N) \
327
((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
328
+ YYSTACK_GAP_MAXIMUM)
330
/* Copy COUNT objects from FROM to TO. The source and destination do
333
# if defined __GNUC__ && 1 < __GNUC__
334
# define YYCOPY(To, From, Count) \
335
__builtin_memcpy (To, From, (Count) * sizeof (*(From)))
337
# define YYCOPY(To, From, Count) \
341
for (yyi = 0; yyi < (Count); yyi++) \
342
(To)[yyi] = (From)[yyi]; \
348
/* Relocate STACK from its old location to the new one. The
349
local variables YYSIZE and YYSTACKSIZE give the old and new number of
350
elements in the stack, and YYPTR gives the new location of the
351
stack. Advance YYPTR to a properly aligned location for the next
353
# define YYSTACK_RELOCATE(Stack) \
356
YYSIZE_T yynewbytes; \
357
YYCOPY (&yyptr->Stack, Stack, yysize); \
358
Stack = &yyptr->Stack; \
359
yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
360
yyptr += yynewbytes / sizeof (*yyptr); \
366
/* YYFINAL -- State number of the termination state. */
368
/* YYLAST -- Last index in YYTABLE. */
371
/* YYNTOKENS -- Number of terminals. */
373
/* YYNNTS -- Number of nonterminals. */
375
/* YYNRULES -- Number of rules. */
377
/* YYNRULES -- Number of states. */
380
/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
382
#define YYMAXUTOK 259
384
#define YYTRANSLATE(YYX) \
385
((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
387
/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
388
static const yytype_uint8 yytranslate[] =
390
0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
391
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
392
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
393
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
394
6, 7, 2, 2, 2, 2, 2, 2, 2, 2,
395
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
396
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
397
2, 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, 5, 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, 1, 2, 3, 4
419
/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
421
static const yytype_uint8 yyprhs[] =
423
0, 0, 3, 5, 8, 11, 13
426
/* YYRHS -- A `-1'-separated list of the rules' RHS. */
427
static const yytype_int8 yyrhs[] =
429
9, 0, -1, 10, -1, 9, 10, -1, 3, 11,
430
-1, 4, -1, 5, 6, 4, 7, -1
433
/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
434
static const yytype_uint8 yyrline[] =
436
0, 71, 71, 72, 75, 91, 92
440
#if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
441
/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
442
First, the terminals, then, starting at YYNTOKENS, nonterminals. */
443
static const char *const yytname[] =
445
"$end", "error", "$undefined", "TEXT_T", "QTEXT_T", "'_'", "'('", "')'",
446
"$accept", "file", "line", "string", 0
451
/* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
453
static const yytype_uint16 yytoknum[] =
455
0, 256, 257, 258, 259, 95, 40, 41
459
/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
460
static const yytype_uint8 yyr1[] =
462
0, 8, 9, 9, 10, 11, 11
465
/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
466
static const yytype_uint8 yyr2[] =
471
/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
472
STATE-NUM when YYTABLE doesn't specify something else to do. Zero
473
means the default is an error. */
474
static const yytype_uint8 yydefact[] =
476
0, 0, 0, 2, 5, 0, 4, 1, 3, 0,
480
/* YYDEFGOTO[NTERM-NUM]. */
481
static const yytype_int8 yydefgoto[] =
486
/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
488
#define YYPACT_NINF -4
489
static const yytype_int8 yypact[] =
491
1, -3, 0, -4, -4, -1, -4, -4, -4, 2,
495
/* YYPGOTO[NTERM-NUM]. */
496
static const yytype_int8 yypgoto[] =
501
/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
502
positive, shift that token. If negative, reduce the rule which
503
number is the opposite. If zero, do what YYDEFACT says.
504
If YYTABLE_NINF, syntax error. */
505
#define YYTABLE_NINF -1
506
static const yytype_uint8 yytable[] =
508
7, 4, 5, 1, 1, 9, 10, 8, 0, 0,
512
static const yytype_int8 yycheck[] =
514
0, 4, 5, 3, 3, 6, 4, 2, -1, -1,
518
/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
519
symbol of state STATE-NUM. */
520
static const yytype_uint8 yystos[] =
522
0, 3, 9, 10, 4, 5, 11, 0, 10, 6,
526
#define yyerrok (yyerrstatus = 0)
527
#define yyclearin (yychar = YYEMPTY)
531
#define YYACCEPT goto yyacceptlab
532
#define YYABORT goto yyabortlab
533
#define YYERROR goto yyerrorlab
536
/* Like YYERROR except do call yyerror. This remains here temporarily
537
to ease the transition to the new meaning of YYERROR, for GCC.
538
Once GCC version 2 has supplanted version 1, this can go. */
540
#define YYFAIL goto yyerrlab
542
#define YYRECOVERING() (!!yyerrstatus)
544
#define YYBACKUP(Token, Value) \
546
if (yychar == YYEMPTY && yylen == 1) \
550
yytoken = YYTRANSLATE (yychar); \
556
yyerror (YY_("syntax error: cannot back up")); \
563
#define YYERRCODE 256
566
/* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
567
If N is 0, then set CURRENT to the empty location which ends
568
the previous symbol: RHS[0] (always defined). */
570
#define YYRHSLOC(Rhs, K) ((Rhs)[K])
571
#ifndef YYLLOC_DEFAULT
572
# define YYLLOC_DEFAULT(Current, Rhs, N) \
576
(Current).first_line = YYRHSLOC (Rhs, 1).first_line; \
577
(Current).first_column = YYRHSLOC (Rhs, 1).first_column; \
578
(Current).last_line = YYRHSLOC (Rhs, N).last_line; \
579
(Current).last_column = YYRHSLOC (Rhs, N).last_column; \
583
(Current).first_line = (Current).last_line = \
584
YYRHSLOC (Rhs, 0).last_line; \
585
(Current).first_column = (Current).last_column = \
586
YYRHSLOC (Rhs, 0).last_column; \
592
/* YY_LOCATION_PRINT -- Print the location on the stream.
593
This macro was not mandated originally: define only if we know
594
we won't break user code: when these are the locations we know. */
596
#ifndef YY_LOCATION_PRINT
597
# if YYLTYPE_IS_TRIVIAL
598
# define YY_LOCATION_PRINT(File, Loc) \
599
fprintf (File, "%d.%d-%d.%d", \
600
(Loc).first_line, (Loc).first_column, \
601
(Loc).last_line, (Loc).last_column)
603
# define YY_LOCATION_PRINT(File, Loc) ((void) 0)
608
/* YYLEX -- calling `yylex' with the right arguments. */
611
# define YYLEX yylex (YYLEX_PARAM)
613
# define YYLEX yylex ()
616
/* Enable debugging if requested. */
620
# include <stdio.h> /* INFRINGES ON USER NAME SPACE */
621
# define YYFPRINTF fprintf
624
# define YYDPRINTF(Args) \
630
# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
634
YYFPRINTF (stderr, "%s ", Title); \
635
yy_symbol_print (stderr, \
637
YYFPRINTF (stderr, "\n"); \
642
/*--------------------------------.
643
| Print this symbol on YYOUTPUT. |
644
`--------------------------------*/
647
#if (defined __STDC__ || defined __C99__FUNC__ \
648
|| defined __cplusplus || defined _MSC_VER)
650
yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
653
yy_symbol_value_print (yyoutput, yytype, yyvaluep)
656
YYSTYPE const * const yyvaluep;
662
if (yytype < YYNTOKENS)
663
YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
675
/*--------------------------------.
676
| Print this symbol on YYOUTPUT. |
677
`--------------------------------*/
679
#if (defined __STDC__ || defined __C99__FUNC__ \
680
|| defined __cplusplus || defined _MSC_VER)
682
yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
685
yy_symbol_print (yyoutput, yytype, yyvaluep)
688
YYSTYPE const * const yyvaluep;
691
if (yytype < YYNTOKENS)
692
YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
694
YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
696
yy_symbol_value_print (yyoutput, yytype, yyvaluep);
697
YYFPRINTF (yyoutput, ")");
700
/*------------------------------------------------------------------.
701
| yy_stack_print -- Print the state stack from its BOTTOM up to its |
703
`------------------------------------------------------------------*/
705
#if (defined __STDC__ || defined __C99__FUNC__ \
706
|| defined __cplusplus || defined _MSC_VER)
708
yy_stack_print (yytype_int16 *bottom, yytype_int16 *top)
711
yy_stack_print (bottom, top)
712
yytype_int16 *bottom;
716
YYFPRINTF (stderr, "Stack now");
717
for (; bottom <= top; ++bottom)
718
YYFPRINTF (stderr, " %d", *bottom);
719
YYFPRINTF (stderr, "\n");
722
# define YY_STACK_PRINT(Bottom, Top) \
725
yy_stack_print ((Bottom), (Top)); \
729
/*------------------------------------------------.
730
| Report that the YYRULE is going to be reduced. |
731
`------------------------------------------------*/
733
#if (defined __STDC__ || defined __C99__FUNC__ \
734
|| defined __cplusplus || defined _MSC_VER)
736
yy_reduce_print (YYSTYPE *yyvsp, int yyrule)
739
yy_reduce_print (yyvsp, yyrule)
744
int yynrhs = yyr2[yyrule];
746
unsigned long int yylno = yyrline[yyrule];
747
YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
749
/* The symbols being reduced. */
750
for (yyi = 0; yyi < yynrhs; yyi++)
752
fprintf (stderr, " $%d = ", yyi + 1);
753
yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi],
754
&(yyvsp[(yyi + 1) - (yynrhs)])
756
fprintf (stderr, "\n");
760
# define YY_REDUCE_PRINT(Rule) \
763
yy_reduce_print (yyvsp, Rule); \
766
/* Nonzero means print parse trace. It is left uninitialized so that
767
multiple parsers can coexist. */
770
# define YYDPRINTF(Args)
771
# define YY_SYMBOL_PRINT(Title, Type, Value, Location)
772
# define YY_STACK_PRINT(Bottom, Top)
773
# define YY_REDUCE_PRINT(Rule)
774
#endif /* !YYDEBUG */
777
/* YYINITDEPTH -- initial size of the parser's stacks. */
779
# define YYINITDEPTH 200
782
/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
783
if the built-in stack extension method is used).
785
Do not make this value too large; the results are undefined if
786
YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
787
evaluated with infinite-precision integer arithmetic. */
790
# define YYMAXDEPTH 10000
798
# if defined __GLIBC__ && defined _STRING_H
799
# define yystrlen strlen
801
/* Return the length of YYSTR. */
802
#if (defined __STDC__ || defined __C99__FUNC__ \
803
|| defined __cplusplus || defined _MSC_VER)
805
yystrlen (const char *yystr)
813
for (yylen = 0; yystr[yylen]; yylen++)
821
# if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
822
# define yystpcpy stpcpy
824
/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
826
#if (defined __STDC__ || defined __C99__FUNC__ \
827
|| defined __cplusplus || defined _MSC_VER)
829
yystpcpy (char *yydest, const char *yysrc)
832
yystpcpy (yydest, yysrc)
838
const char *yys = yysrc;
840
while ((*yyd++ = *yys++) != '\0')
849
/* Copy to YYRES the contents of YYSTR after stripping away unnecessary
850
quotes and backslashes, so that it's suitable for yyerror. The
851
heuristic is that double-quoting is unnecessary unless the string
852
contains an apostrophe, a comma, or backslash (other than
853
backslash-backslash). YYSTR is taken from yytname. If YYRES is
854
null, do not copy; instead, return the length of what the result
857
yytnamerr (char *yyres, const char *yystr)
862
char const *yyp = yystr;
869
goto do_not_strip_quotes;
873
goto do_not_strip_quotes;
886
do_not_strip_quotes: ;
890
return yystrlen (yystr);
892
return yystpcpy (yyres, yystr) - yyres;
896
/* Copy into YYRESULT an error message about the unexpected token
897
YYCHAR while in state YYSTATE. Return the number of bytes copied,
898
including the terminating null byte. If YYRESULT is null, do not
899
copy anything; just return the number of bytes that would be
900
copied. As a special case, return 0 if an ordinary "syntax error"
901
message will do. Return YYSIZE_MAXIMUM if overflow occurs during
904
yysyntax_error (char *yyresult, int yystate, int yychar)
906
int yyn = yypact[yystate];
908
if (! (YYPACT_NINF < yyn && yyn <= YYLAST))
912
int yytype = YYTRANSLATE (yychar);
913
YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]);
914
YYSIZE_T yysize = yysize0;
916
int yysize_overflow = 0;
917
enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
918
char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
922
/* This is so xgettext sees the translatable formats that are
923
constructed on the fly. */
924
YY_("syntax error, unexpected %s");
925
YY_("syntax error, unexpected %s, expecting %s");
926
YY_("syntax error, unexpected %s, expecting %s or %s");
927
YY_("syntax error, unexpected %s, expecting %s or %s or %s");
928
YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s");
932
static char const yyunexpected[] = "syntax error, unexpected %s";
933
static char const yyexpecting[] = ", expecting %s";
934
static char const yyor[] = " or %s";
935
char yyformat[sizeof yyunexpected
936
+ sizeof yyexpecting - 1
937
+ ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2)
938
* (sizeof yyor - 1))];
939
char const *yyprefix = yyexpecting;
941
/* Start YYX at -YYN if negative to avoid negative indexes in
943
int yyxbegin = yyn < 0 ? -yyn : 0;
945
/* Stay within bounds of both yycheck and yytname. */
946
int yychecklim = YYLAST - yyn + 1;
947
int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
950
yyarg[0] = yytname[yytype];
951
yyfmt = yystpcpy (yyformat, yyunexpected);
953
for (yyx = yyxbegin; yyx < yyxend; ++yyx)
954
if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
956
if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
960
yyformat[sizeof yyunexpected - 1] = '\0';
963
yyarg[yycount++] = yytname[yyx];
964
yysize1 = yysize + yytnamerr (0, yytname[yyx]);
965
yysize_overflow |= (yysize1 < yysize);
967
yyfmt = yystpcpy (yyfmt, yyprefix);
972
yysize1 = yysize + yystrlen (yyf);
973
yysize_overflow |= (yysize1 < yysize);
977
return YYSIZE_MAXIMUM;
981
/* Avoid sprintf, as that infringes on the user's name space.
982
Don't have undefined behavior even if the translation
983
produced a string with the wrong number of "%s"s. */
984
char *yyp = yyresult;
986
while ((*yyp = *yyf) != '\0')
988
if (*yyp == '%' && yyf[1] == 's' && yyi < yycount)
990
yyp += yytnamerr (yyp, yyarg[yyi++]);
1003
#endif /* YYERROR_VERBOSE */
1006
/*-----------------------------------------------.
1007
| Release the memory associated to this symbol. |
1008
`-----------------------------------------------*/
1011
#if (defined __STDC__ || defined __C99__FUNC__ \
1012
|| defined __cplusplus || defined _MSC_VER)
1014
yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep)
1017
yydestruct (yymsg, yytype, yyvaluep)
1027
YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
1031
case 3: /* "TEXT_T" */
1032
#line 59 "strres_parser.y"
1035
// Force type checking by the compiler
1036
char * const s = (yyvaluep->sval);
1042
#line 1043 "strres_parser.tab.c"
1044
case 4: /* "QTEXT_T" */
1045
#line 59 "strres_parser.y"
1048
// Force type checking by the compiler
1049
char * const s = (yyvaluep->sval);
1055
#line 1056 "strres_parser.tab.c"
1057
case 11: /* "string" */
1058
#line 59 "strres_parser.y"
1061
// Force type checking by the compiler
1062
char * const s = (yyvaluep->sval);
1068
#line 1069 "strres_parser.tab.c"
1077
/* Prevent warnings from -Wmissing-prototypes. */
1079
#ifdef YYPARSE_PARAM
1080
#if defined __STDC__ || defined __cplusplus
1081
int yyparse (void *YYPARSE_PARAM);
1085
#else /* ! YYPARSE_PARAM */
1086
#if defined __STDC__ || defined __cplusplus
1091
#endif /* ! YYPARSE_PARAM */
1095
/* The look-ahead symbol. */
1098
/* The semantic value of the look-ahead symbol. */
1101
/* Number of syntax errors so far. */
1110
#ifdef YYPARSE_PARAM
1111
#if (defined __STDC__ || defined __C99__FUNC__ \
1112
|| defined __cplusplus || defined _MSC_VER)
1114
yyparse (void *YYPARSE_PARAM)
1117
yyparse (YYPARSE_PARAM)
1118
void *YYPARSE_PARAM;
1120
#else /* ! YYPARSE_PARAM */
1121
#if (defined __STDC__ || defined __C99__FUNC__ \
1122
|| defined __cplusplus || defined _MSC_VER)
1136
/* Number of tokens to shift before error messages enabled. */
1138
/* Look-ahead token as an internal (translated) token number. */
1141
/* Buffer for error messages, and its allocated size. */
1143
char *yymsg = yymsgbuf;
1144
YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
1147
/* Three stacks and their tools:
1148
`yyss': related to states,
1149
`yyvs': related to semantic values,
1150
`yyls': related to locations.
1152
Refer to the stacks thru separate pointers, to allow yyoverflow
1153
to reallocate them elsewhere. */
1155
/* The state stack. */
1156
yytype_int16 yyssa[YYINITDEPTH];
1157
yytype_int16 *yyss = yyssa;
1158
yytype_int16 *yyssp;
1160
/* The semantic value stack. */
1161
YYSTYPE yyvsa[YYINITDEPTH];
1162
YYSTYPE *yyvs = yyvsa;
1167
#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
1169
YYSIZE_T yystacksize = YYINITDEPTH;
1171
/* The variables used to return semantic value and location from the
1176
/* The number of symbols on the RHS of the reduced rule.
1177
Keep to zero when no symbol should be popped. */
1180
YYDPRINTF ((stderr, "Starting parse\n"));
1185
yychar = YYEMPTY; /* Cause a token to be read. */
1187
/* Initialize stack pointers.
1188
Waste one element of value and location stack
1189
so that they stay on the same level as the state stack.
1190
The wasted elements are never initialized. */
1197
/*------------------------------------------------------------.
1198
| yynewstate -- Push a new state, which is found in yystate. |
1199
`------------------------------------------------------------*/
1201
/* In all cases, when you get here, the value and location stacks
1202
have just been pushed. So pushing a state here evens the stacks. */
1208
if (yyss + yystacksize - 1 <= yyssp)
1210
/* Get the current used size of the three stacks, in elements. */
1211
YYSIZE_T yysize = yyssp - yyss + 1;
1215
/* Give user a chance to reallocate the stack. Use copies of
1216
these so that the &'s don't force the real ones into
1218
YYSTYPE *yyvs1 = yyvs;
1219
yytype_int16 *yyss1 = yyss;
1222
/* Each stack pointer address is followed by the size of the
1223
data in use in that stack, in bytes. This used to be a
1224
conditional around just the two extra args, but that might
1225
be undefined if yyoverflow is a macro. */
1226
yyoverflow (YY_("memory exhausted"),
1227
&yyss1, yysize * sizeof (*yyssp),
1228
&yyvs1, yysize * sizeof (*yyvsp),
1235
#else /* no yyoverflow */
1236
# ifndef YYSTACK_RELOCATE
1237
goto yyexhaustedlab;
1239
/* Extend the stack our own way. */
1240
if (YYMAXDEPTH <= yystacksize)
1241
goto yyexhaustedlab;
1243
if (YYMAXDEPTH < yystacksize)
1244
yystacksize = YYMAXDEPTH;
1247
yytype_int16 *yyss1 = yyss;
1248
union yyalloc *yyptr =
1249
(union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
1251
goto yyexhaustedlab;
1252
YYSTACK_RELOCATE (yyss);
1253
YYSTACK_RELOCATE (yyvs);
1255
# undef YYSTACK_RELOCATE
1257
YYSTACK_FREE (yyss1);
1260
#endif /* no yyoverflow */
1262
yyssp = yyss + yysize - 1;
1263
yyvsp = yyvs + yysize - 1;
1266
YYDPRINTF ((stderr, "Stack size increased to %lu\n",
1267
(unsigned long int) yystacksize));
1269
if (yyss + yystacksize - 1 <= yyssp)
1273
YYDPRINTF ((stderr, "Entering state %d\n", yystate));
1282
/* Do appropriate processing given the current state. Read a
1283
look-ahead token if we need one and don't already have one. */
1285
/* First try to decide what to do without reference to look-ahead token. */
1286
yyn = yypact[yystate];
1287
if (yyn == YYPACT_NINF)
1290
/* Not known => get a look-ahead token if don't already have one. */
1292
/* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */
1293
if (yychar == YYEMPTY)
1295
YYDPRINTF ((stderr, "Reading a token: "));
1299
if (yychar <= YYEOF)
1301
yychar = yytoken = YYEOF;
1302
YYDPRINTF ((stderr, "Now at end of input.\n"));
1306
yytoken = YYTRANSLATE (yychar);
1307
YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
1310
/* If the proper action on seeing token YYTOKEN is to reduce or to
1311
detect an error, take that action. */
1313
if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
1318
if (yyn == 0 || yyn == YYTABLE_NINF)
1327
/* Count tokens shifted since error; after three, turn off error
1332
/* Shift the look-ahead token. */
1333
YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
1335
/* Discard the shifted token unless it is eof. */
1336
if (yychar != YYEOF)
1345
/*-----------------------------------------------------------.
1346
| yydefault -- do the default action for the current state. |
1347
`-----------------------------------------------------------*/
1349
yyn = yydefact[yystate];
1355
/*-----------------------------.
1356
| yyreduce -- Do a reduction. |
1357
`-----------------------------*/
1359
/* yyn is the number of a rule to reduce with. */
1362
/* If YYLEN is nonzero, implement the default value of the action:
1365
Otherwise, the following line sets YYVAL to garbage.
1366
This behavior is undocumented and Bison
1367
users should not rely upon it. Assigning to YYVAL
1368
unconditionally makes the parser a bit smaller, and it avoids a
1369
GCC warning that YYVAL may be used uninitialized. */
1370
yyval = yyvsp[1-yylen];
1373
YY_REDUCE_PRINT (yyn);
1377
#line 76 "strres_parser.y"
1379
/* Pass the text string to the string manager */
1380
const bool success = strresStoreString((struct STR_RES*)psStrRes, (yyvsp[(1) - (2)].sval), (yyvsp[(2) - (2)].sval));
1382
// Clean up our tokens
1383
free((yyvsp[(1) - (2)].sval));
1384
free((yyvsp[(2) - (2)].sval));
1394
#line 93 "strres_parser.y"
1396
(yyval.sval) = strdup(gettext((yyvsp[(3) - (4)].sval)));
1397
free((yyvsp[(3) - (4)].sval));
1402
/* Line 1267 of yacc.c. */
1403
#line 1404 "strres_parser.tab.c"
1406
YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
1410
YY_STACK_PRINT (yyss, yyssp);
1415
/* Now `shift' the result of the reduction. Determine what state
1416
that goes to, based on the state we popped back to and the rule
1417
number reduced by. */
1421
yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
1422
if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
1423
yystate = yytable[yystate];
1425
yystate = yydefgoto[yyn - YYNTOKENS];
1430
/*------------------------------------.
1431
| yyerrlab -- here on detecting error |
1432
`------------------------------------*/
1434
/* If not already recovering from an error, report this error. */
1438
#if ! YYERROR_VERBOSE
1439
yyerror (YY_("syntax error"));
1442
YYSIZE_T yysize = yysyntax_error (0, yystate, yychar);
1443
if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM)
1445
YYSIZE_T yyalloc = 2 * yysize;
1446
if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM))
1447
yyalloc = YYSTACK_ALLOC_MAXIMUM;
1448
if (yymsg != yymsgbuf)
1449
YYSTACK_FREE (yymsg);
1450
yymsg = (char *) YYSTACK_ALLOC (yyalloc);
1452
yymsg_alloc = yyalloc;
1456
yymsg_alloc = sizeof yymsgbuf;
1460
if (0 < yysize && yysize <= yymsg_alloc)
1462
(void) yysyntax_error (yymsg, yystate, yychar);
1467
yyerror (YY_("syntax error"));
1469
goto yyexhaustedlab;
1477
if (yyerrstatus == 3)
1479
/* If just tried and failed to reuse look-ahead token after an
1480
error, discard it. */
1482
if (yychar <= YYEOF)
1484
/* Return failure if at end of input. */
1485
if (yychar == YYEOF)
1490
yydestruct ("Error: discarding",
1496
/* Else will try to reuse look-ahead token after shifting the error
1501
/*---------------------------------------------------.
1502
| yyerrorlab -- error raised explicitly by YYERROR. |
1503
`---------------------------------------------------*/
1506
/* Pacify compilers like GCC when the user code never invokes
1507
YYERROR and the label yyerrorlab therefore never appears in user
1509
if (/*CONSTCOND*/ 0)
1512
/* Do not reclaim the symbols of the rule which action triggered
1516
YY_STACK_PRINT (yyss, yyssp);
1521
/*-------------------------------------------------------------.
1522
| yyerrlab1 -- common code for both syntax error and YYERROR. |
1523
`-------------------------------------------------------------*/
1525
yyerrstatus = 3; /* Each real token shifted decrements this. */
1529
yyn = yypact[yystate];
1530
if (yyn != YYPACT_NINF)
1533
if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
1541
/* Pop the current state because it cannot handle the error token. */
1546
yydestruct ("Error: popping",
1547
yystos[yystate], yyvsp);
1550
YY_STACK_PRINT (yyss, yyssp);
1559
/* Shift the error token. */
1560
YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
1566
/*-------------------------------------.
1567
| yyacceptlab -- YYACCEPT comes here. |
1568
`-------------------------------------*/
1573
/*-----------------------------------.
1574
| yyabortlab -- YYABORT comes here. |
1575
`-----------------------------------*/
1581
/*-------------------------------------------------.
1582
| yyexhaustedlab -- memory exhaustion comes here. |
1583
`-------------------------------------------------*/
1585
yyerror (YY_("memory exhausted"));
1591
if (yychar != YYEOF && yychar != YYEMPTY)
1592
yydestruct ("Cleanup: discarding lookahead",
1594
/* Do not reclaim the symbols of the rule which action triggered
1595
this YYABORT or YYACCEPT. */
1597
YY_STACK_PRINT (yyss, yyssp);
1598
while (yyssp != yyss)
1600
yydestruct ("Cleanup: popping",
1601
yystos[*yyssp], yyvsp);
1606
YYSTACK_FREE (yyss);
1609
if (yymsg != yymsgbuf)
1610
YYSTACK_FREE (yymsg);
1612
/* Make sure YYID is used. */
1613
return YYID (yyresult);