root/branches/libffado-2.0/external/libconfig/grammar.c

Revision 1304, 50.7 kB (checked in by ppalmers, 16 years ago)

more forgotten files

Line 
1 /* A Bison parser, made by GNU Bison 2.3.  */
2
3 /* Skeleton implementation for Bison's Yacc-like parsers in C
4
5    Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
6    Free Software Foundation, Inc.
7
8    This program is free software; you can redistribute it and/or modify
9    it under the terms of the GNU General Public License as published by
10    the Free Software Foundation; either version 2, or (at your option)
11    any later version.
12
13    This program is distributed in the hope that it will be useful,
14    but WITHOUT ANY WARRANTY; without even the implied warranty of
15    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16    GNU General Public License for more details.
17
18    You should have received a copy of the GNU General Public License
19    along with this program; if not, write to the Free Software
20    Foundation, Inc., 51 Franklin Street, Fifth Floor,
21    Boston, MA 02110-1301, USA.  */
22
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.
32
33    This special exception was added by the Free Software Foundation in
34    version 2.2 of Bison.  */
35
36 /* C LALR(1) parser skeleton written by Richard Stallman, by
37    simplifying the original so-called "semantic" parser.  */
38
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.  */
45
46 /* Identify Bison output.  */
47 #define YYBISON 1
48
49 /* Bison version.  */
50 #define YYBISON_VERSION "2.3"
51
52 /* Skeleton name.  */
53 #define YYSKELETON_NAME "yacc.c"
54
55 /* Pure parsers.  */
56 #define YYPURE 1
57
58 /* Using locations.  */
59 #define YYLSP_NEEDED 0
60
61 /* Substitute the variable and function names.  */
62 #define yyparse libconfig_yyparse
63 #define yylex   libconfig_yylex
64 #define yyerror libconfig_yyerror
65 #define yylval  libconfig_yylval
66 #define yychar  libconfig_yychar
67 #define yydebug libconfig_yydebug
68 #define yynerrs libconfig_yynerrs
69
70
71 /* Tokens.  */
72 #ifndef YYTOKENTYPE
73 # define YYTOKENTYPE
74    /* Put the tokens into the symbol table, so that GDB and other debuggers
75       know about them.  */
76    enum yytokentype {
77      TOK_BOOLEAN = 258,
78      TOK_INTEGER = 259,
79      TOK_HEX = 260,
80      TOK_INTEGER64 = 261,
81      TOK_HEX64 = 262,
82      TOK_FLOAT = 263,
83      TOK_STRING = 264,
84      TOK_NAME = 265,
85      TOK_EQUALS = 266,
86      TOK_NEWLINE = 267,
87      TOK_ARRAY_START = 268,
88      TOK_ARRAY_END = 269,
89      TOK_LIST_START = 270,
90      TOK_LIST_END = 271,
91      TOK_COMMA = 272,
92      TOK_GROUP_START = 273,
93      TOK_GROUP_END = 274,
94      TOK_END = 275,
95      TOK_GARBAGE = 276
96    };
97 #endif
98 /* Tokens.  */
99 #define TOK_BOOLEAN 258
100 #define TOK_INTEGER 259
101 #define TOK_HEX 260
102 #define TOK_INTEGER64 261
103 #define TOK_HEX64 262
104 #define TOK_FLOAT 263
105 #define TOK_STRING 264
106 #define TOK_NAME 265
107 #define TOK_EQUALS 266
108 #define TOK_NEWLINE 267
109 #define TOK_ARRAY_START 268
110 #define TOK_ARRAY_END 269
111 #define TOK_LIST_START 270
112 #define TOK_LIST_END 271
113 #define TOK_COMMA 272
114 #define TOK_GROUP_START 273
115 #define TOK_GROUP_END 274
116 #define TOK_END 275
117 #define TOK_GARBAGE 276
118
119
120
121
122 /* Copy the first part of user declarations.  */
123 #line 31 "grammar.y"
124
125 #include <string.h>
126 #include <stdlib.h>
127 #include "libconfig.h"
128 #ifdef WIN32
129 #include "wincompat.h"
130
131 /* prevent warnings about redefined malloc/free in generated code: */
132 #ifndef _STDLIB_H
133 #define _STDLIB_H
134 #endif
135  
136 #include <malloc.h>
137 #endif
138 #include "private.h"
139
140 /* these delcarations are provided to suppress compiler warnings */
141 extern int libconfig_yylex();
142 extern int libconfig_yyget_lineno();
143  
144 static const char *err_array_elem_type = "mismatched element type in array";
145 static const char *err_duplicate_setting = "duplicate setting name";
146
147 #define IN_ARRAY() \
148   (ctx->parent && (ctx->parent->type == CONFIG_TYPE_ARRAY))
149
150 #define IN_LIST() \
151   (ctx->parent && (ctx->parent->type == CONFIG_TYPE_LIST))
152
153 #define CAPTURE_PARSE_POS(S)                                    \
154   (S)->line = (unsigned int)libconfig_yyget_lineno(scanner)
155
156 void libconfig_yyerror(void *scanner, struct parse_context *ctx,
157                       char const *s)
158 {
159   ctx->config->error_line = libconfig_yyget_lineno(scanner);
160   ctx->config->error_text = s;
161 }
162
163
164
165 /* Enabling traces.  */
166 #ifndef YYDEBUG
167 # define YYDEBUG 0
168 #endif
169
170 /* Enabling verbose error messages.  */
171 #ifdef YYERROR_VERBOSE
172 # undef YYERROR_VERBOSE
173 # define YYERROR_VERBOSE 1
174 #else
175 # define YYERROR_VERBOSE 0
176 #endif
177
178 /* Enabling the token table.  */
179 #ifndef YYTOKEN_TABLE
180 # define YYTOKEN_TABLE 0
181 #endif
182
183 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
184 typedef union YYSTYPE
185 #line 73 "grammar.y"
186 {
187   long ival;
188   long long llval;
189   double fval;
190   char *sval;
191 }
192 /* Line 187 of yacc.c.  */
193 #line 194 "grammar.c"
194         YYSTYPE;
195 # define yystype YYSTYPE /* obsolescent; will be withdrawn */
196 # define YYSTYPE_IS_DECLARED 1
197 # define YYSTYPE_IS_TRIVIAL 1
198 #endif
199
200
201
202 /* Copy the second part of user declarations.  */
203
204
205 /* Line 216 of yacc.c.  */
206 #line 207 "grammar.c"
207
208 #ifdef short
209 # undef short
210 #endif
211
212 #ifdef YYTYPE_UINT8
213 typedef YYTYPE_UINT8 yytype_uint8;
214 #else
215 typedef unsigned char yytype_uint8;
216 #endif
217
218 #ifdef YYTYPE_INT8
219 typedef YYTYPE_INT8 yytype_int8;
220 #elif (defined __STDC__ || defined __C99__FUNC__ \
221      || defined __cplusplus || defined _MSC_VER)
222 typedef signed char yytype_int8;
223 #else
224 typedef short int yytype_int8;
225 #endif
226
227 #ifdef YYTYPE_UINT16
228 typedef YYTYPE_UINT16 yytype_uint16;
229 #else
230 typedef unsigned short int yytype_uint16;
231 #endif
232
233 #ifdef YYTYPE_INT16
234 typedef YYTYPE_INT16 yytype_int16;
235 #else
236 typedef short int yytype_int16;
237 #endif
238
239 #ifndef YYSIZE_T
240 # ifdef __SIZE_TYPE__
241 #  define YYSIZE_T __SIZE_TYPE__
242 # elif defined size_t
243 #  define YYSIZE_T size_t
244 # elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \
245      || defined __cplusplus || defined _MSC_VER)
246 #  include <stddef.h> /* INFRINGES ON USER NAME SPACE */
247 #  define YYSIZE_T size_t
248 # else
249 #  define YYSIZE_T unsigned int
250 # endif
251 #endif
252
253 #define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
254
255 #ifndef YY_
256 # if YYENABLE_NLS
257 #  if ENABLE_NLS
258 #   include <libintl.h> /* INFRINGES ON USER NAME SPACE */
259 #   define YY_(msgid) dgettext ("bison-runtime", msgid)
260 #  endif
261 # endif
262 # ifndef YY_
263 #  define YY_(msgid) msgid
264 # endif
265 #endif
266
267 /* Suppress unused-variable warnings by "using" E.  */
268 #if ! defined lint || defined __GNUC__
269 # define YYUSE(e) ((void) (e))
270 #else
271 # define YYUSE(e) /* empty */
272 #endif
273
274 /* Identity function, used to suppress warnings about constant conditions.  */
275 #ifndef lint
276 # define YYID(n) (n)
277 #else
278 #if (defined __STDC__ || defined __C99__FUNC__ \
279      || defined __cplusplus || defined _MSC_VER)
280 static int
281 YYID (int i)
282 #else
283 static int
284 YYID (i)
285     int i;
286 #endif
287 {
288   return i;
289 }
290 #endif
291
292 #if ! defined yyoverflow || YYERROR_VERBOSE
293
294 /* The parser invokes alloca or malloc; define the necessary symbols.  */
295
296 # ifdef YYSTACK_USE_ALLOCA
297 #  if YYSTACK_USE_ALLOCA
298 #   ifdef __GNUC__
299 #    define YYSTACK_ALLOC __builtin_alloca
300 #   elif defined __BUILTIN_VA_ARG_INCR
301 #    include <alloca.h> /* INFRINGES ON USER NAME SPACE */
302 #   elif defined _AIX
303 #    define YYSTACK_ALLOC __alloca
304 #   elif defined _MSC_VER
305 #    include <malloc.h> /* INFRINGES ON USER NAME SPACE */
306 #    define alloca _alloca
307 #   else
308 #    define YYSTACK_ALLOC alloca
309 #    if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
310      || defined __cplusplus || defined _MSC_VER)
311 #     include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
312 #     ifndef _STDLIB_H
313 #      define _STDLIB_H 1
314 #     endif
315 #    endif
316 #   endif
317 #  endif
318 # endif
319
320 # ifdef YYSTACK_ALLOC
321    /* Pacify GCC's `empty if-body' warning.  */
322 #  define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0))
323 #  ifndef YYSTACK_ALLOC_MAXIMUM
324     /* The OS might guarantee only one guard page at the bottom of the stack,
325        and a page size can be as small as 4096 bytes.  So we cannot safely
326        invoke alloca (N) if N exceeds 4096.  Use a slightly smaller number
327        to allow for a few compiler-allocated temporary stack slots.  */
328 #   define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
329 #  endif
330 # else
331 #  define YYSTACK_ALLOC YYMALLOC
332 #  define YYSTACK_FREE YYFREE
333 #  ifndef YYSTACK_ALLOC_MAXIMUM
334 #   define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
335 #  endif
336 #  if (defined __cplusplus && ! defined _STDLIB_H \
337        && ! ((defined YYMALLOC || defined malloc) \
338              && (defined YYFREE || defined free)))
339 #   include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
340 #   ifndef _STDLIB_H
341 #    define _STDLIB_H 1
342 #   endif
343 #  endif
344 #  ifndef YYMALLOC
345 #   define YYMALLOC malloc
346 #   if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
347      || defined __cplusplus || defined _MSC_VER)
348 void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
349 #   endif
350 #  endif
351 #  ifndef YYFREE
352 #   define YYFREE free
353 #   if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
354      || defined __cplusplus || defined _MSC_VER)
355 void free (void *); /* INFRINGES ON USER NAME SPACE */
356 #   endif
357 #  endif
358 # endif
359 #endif /* ! defined yyoverflow || YYERROR_VERBOSE */
360
361
362 #if (! defined yyoverflow \
363      && (! defined __cplusplus \
364          || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
365
366 /* A type that is properly aligned for any stack member.  */
367 union yyalloc
368 {
369   yytype_int16 yyss;
370   YYSTYPE yyvs;
371   };
372
373 /* The size of the maximum gap between one aligned stack and the next.  */
374 # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
375
376 /* The size of an array large to enough to hold all stacks, each with
377    N elements.  */
378 # define YYSTACK_BYTES(N) \
379      ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
380       + YYSTACK_GAP_MAXIMUM)
381
382 /* Copy COUNT objects from FROM to TO.  The source and destination do
383    not overlap.  */
384 # ifndef YYCOPY
385 #  if defined __GNUC__ && 1 < __GNUC__
386 #   define YYCOPY(To, From, Count) \
387       __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
388 #  else
389 #   define YYCOPY(To, From, Count)              \
390       do                                        \
391         {                                       \
392           YYSIZE_T yyi;                         \
393           for (yyi = 0; yyi < (Count); yyi++)   \
394             (To)[yyi] = (From)[yyi];            \
395         }                                       \
396       while (YYID (0))
397 #  endif
398 # endif
399
400 /* Relocate STACK from its old location to the new one.  The
401    local variables YYSIZE and YYSTACKSIZE give the old and new number of
402    elements in the stack, and YYPTR gives the new location of the
403    stack.  Advance YYPTR to a properly aligned location for the next
404    stack.  */
405 # define YYSTACK_RELOCATE(Stack)                                        \
406     do                                                                  \
407       {                                                                 \
408         YYSIZE_T yynewbytes;                                            \
409         YYCOPY (&yyptr->Stack, Stack, yysize);                          \
410         Stack = &yyptr->Stack;                                          \
411         yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
412         yyptr += yynewbytes / sizeof (*yyptr);                          \
413       }                                                                 \
414     while (YYID (0))
415
416 #endif
417
418 /* YYFINAL -- State number of the termination state.  */
419 #define YYFINAL  6
420 /* YYLAST -- Last index in YYTABLE.  */
421 #define YYLAST   32
422
423 /* YYNTOKENS -- Number of terminals.  */
424 #define YYNTOKENS  22
425 /* YYNNTS -- Number of nonterminals.  */
426 #define YYNNTS  18
427 /* YYNRULES -- Number of rules.  */
428 #define YYNRULES  34
429 /* YYNRULES -- Number of states.  */
430 #define YYNSTATES  43
431
432 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX.  */
433 #define YYUNDEFTOK  2
434 #define YYMAXUTOK   276
435
436 #define YYTRANSLATE(YYX)                                                \
437   ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
438
439 /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX.  */
440 static const yytype_uint8 yytranslate[] =
441 {
442        0,     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,     2,     2,     2,     2,
455        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
456        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
457        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
458        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
459        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
460        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
461        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
462        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
463        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
464        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
465        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
466        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
467        2,     2,     2,     2,     2,     2,     1,     2,     3,     4,
468        5,     6,     7,     8,     9,    10,    11,    12,    13,    14,
469       15,    16,    17,    18,    19,    20,    21
470 };
471
472 #if YYDEBUG
473 /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
474    YYRHS.  */
475 static const yytype_uint8 yyprhs[] =
476 {
477        0,     0,     3,     4,     6,     8,    11,    12,    14,    15,
478       21,    22,    27,    28,    33,    35,    37,    39,    41,    43,
479       45,    47,    49,    51,    53,    55,    57,    61,    62,    64,
480       66,    70,    71,    73,    74
481 };
482
483 /* YYRHS -- A `-1'-separated list of the rules' RHS.  */
484 static const yytype_int8 yyrhs[] =
485 {
486       23,     0,    -1,    -1,    24,    -1,    26,    -1,    24,    26,
487       -1,    -1,    24,    -1,    -1,    10,    27,    11,    32,    20,
488       -1,    -1,    13,    29,    37,    14,    -1,    -1,    15,    31,
489       35,    16,    -1,    33,    -1,    28,    -1,    30,    -1,    38,
490       -1,     3,    -1,     4,    -1,     6,    -1,     5,    -1,     7,
491       -1,     8,    -1,     9,    -1,    32,    -1,    34,    17,    32,
492       -1,    -1,    34,    -1,    33,    -1,    36,    17,    33,    -1,
493       -1,    36,    -1,    -1,    18,    39,    25,    19,    -1
494 };
495
496 /* YYRLINE[YYN] -- source line where rule number YYN was defined.  */
497 static const yytype_uint16 yyrline[] =
498 {
499        0,    88,    88,    90,    94,    95,    98,   100,   105,   104,
500      125,   124,   148,   147,   170,   171,   172,   173,   177,   197,
501      219,   241,   263,   285,   303,   330,   331,   334,   336,   340,
502      341,   344,   346,   351,   350
503 };
504 #endif
505
506 #if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
507 /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
508    First, the terminals, then, starting at YYNTOKENS, nonterminals.  */
509 static const char *const yytname[] =
510 {
511   "$end", "error", "$undefined", "TOK_BOOLEAN", "TOK_INTEGER", "TOK_HEX",
512   "TOK_INTEGER64", "TOK_HEX64", "TOK_FLOAT", "TOK_STRING", "TOK_NAME",
513   "TOK_EQUALS", "TOK_NEWLINE", "TOK_ARRAY_START", "TOK_ARRAY_END",
514   "TOK_LIST_START", "TOK_LIST_END", "TOK_COMMA", "TOK_GROUP_START",
515   "TOK_GROUP_END", "TOK_END", "TOK_GARBAGE", "$accept", "configuration",
516   "setting_list", "setting_list_optional", "setting", "@1", "array", "@2",
517   "list", "@3", "value", "simple_value", "value_list",
518   "value_list_optional", "simple_value_list", "simple_value_list_optional",
519   "group", "@4", 0
520 };
521 #endif
522
523 # ifdef YYPRINT
524 /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
525    token YYLEX-NUM.  */
526 static const yytype_uint16 yytoknum[] =
527 {
528        0,   256,   257,   258,   259,   260,   261,   262,   263,   264,
529      265,   266,   267,   268,   269,   270,   271,   272,   273,   274,
530      275,   276
531 };
532 # endif
533
534 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives.  */
535 static const yytype_uint8 yyr1[] =
536 {
537        0,    22,    23,    23,    24,    24,    25,    25,    27,    26,
538       29,    28,    31,    30,    32,    32,    32,    32,    33,    33,
539       33,    33,    33,    33,    33,    34,    34,    35,    35,    36,
540       36,    37,    37,    39,    38
541 };
542
543 /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN.  */
544 static const yytype_uint8 yyr2[] =
545 {
546        0,     2,     0,     1,     1,     2,     0,     1,     0,     5,
547        0,     4,     0,     4,     1,     1,     1,     1,     1,     1,
548        1,     1,     1,     1,     1,     1,     3,     0,     1,     1,
549        3,     0,     1,     0,     4
550 };
551
552 /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
553    STATE-NUM when YYTABLE doesn't specify something else to do.  Zero
554    means the default is an error.  */
555 static const yytype_uint8 yydefact[] =
556 {
557        2,     8,     0,     3,     4,     0,     1,     5,     0,    18,
558       19,    21,    20,    22,    23,    24,    10,    12,    33,    15,
559       16,     0,    14,    17,    31,    27,     6,     9,    29,    32,
560        0,    25,    28,     0,     7,     0,     0,    11,     0,    13,
561       34,    30,    26
562 };
563
564 /* YYDEFGOTO[NTERM-NUM].  */
565 static const yytype_int8 yydefgoto[] =
566 {
567       -1,     2,     3,    35,     4,     5,    19,    24,    20,    25,
568       21,    22,    32,    33,    29,    30,    23,    26
569 };
570
571 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
572    STATE-NUM.  */
573 #define YYPACT_NINF -18
574 static const yytype_int8 yypact[] =
575 {
576       -1,   -18,    12,    -1,   -18,     3,   -18,   -18,    -2,   -18,
577      -18,   -18,   -18,   -18,   -18,   -18,   -18,   -18,   -18,   -18,
578      -18,    -5,   -18,   -18,    20,    -2,    -1,   -18,   -18,     0,
579        4,   -18,     2,    14,    -1,     1,    20,   -18,    -2,   -18,
580      -18,   -18,   -18
581 };
582
583 /* YYPGOTO[NTERM-NUM].  */
584 static const yytype_int8 yypgoto[] =
585 {
586      -18,   -18,     6,   -18,    -3,   -18,   -18,   -18,   -18,   -18,
587      -17,   -14,   -18,   -18,   -18,   -18,   -18,   -18
588 };
589
590 /* YYTABLE[YYPACT[STATE-NUM]].  What to do in state STATE-NUM.  If
591    positive, shift that token.  If negative, reduce the rule which
592    number is the opposite.  If zero, do what YYDEFACT says.
593    If YYTABLE_NINF, syntax error.  */
594 #define YYTABLE_NINF -1
595 static const yytype_uint8 yytable[] =
596 {
597        7,     9,    10,    11,    12,    13,    14,    15,    31,     1,
598       28,    16,     6,    17,     8,    27,    18,    36,    37,    38,
599       40,    42,    41,     9,    10,    11,    12,    13,    14,    15,
600       39,     7,    34
601 };
602
603 static const yytype_uint8 yycheck[] =
604 {
605        3,     3,     4,     5,     6,     7,     8,     9,    25,    10,
606       24,    13,     0,    15,    11,    20,    18,    17,    14,    17,
607       19,    38,    36,     3,     4,     5,     6,     7,     8,     9,
608       16,    34,    26
609 };
610
611 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
612    symbol of state STATE-NUM.  */
613 static const yytype_uint8 yystos[] =
614 {
615        0,    10,    23,    24,    26,    27,     0,    26,    11,     3,
616        4,     5,     6,     7,     8,     9,    13,    15,    18,    28,
617       30,    32,    33,    38,    29,    31,    39,    20,    33,    36,
618       37,    32,    34,    35,    24,    25,    17,    14,    17,    16,
619       19,    33,    32
620 };
621
622 #define yyerrok         (yyerrstatus = 0)
623 #define yyclearin       (yychar = YYEMPTY)
624 #define YYEMPTY         (-2)
625 #define YYEOF           0
626
627 #define YYACCEPT        goto yyacceptlab
628 #define YYABORT         goto yyabortlab
629 #define YYERROR         goto yyerrorlab
630
631
632 /* Like YYERROR except do call yyerror.  This remains here temporarily
633    to ease the transition to the new meaning of YYERROR, for GCC.
634    Once GCC version 2 has supplanted version 1, this can go.  */
635
636 #define YYFAIL          goto yyerrlab
637
638 #define YYRECOVERING()  (!!yyerrstatus)
639
640 #define YYBACKUP(Token, Value)                                  \
641 do                                                              \
642   if (yychar == YYEMPTY && yylen == 1)                          \
643     {                                                           \
644       yychar = (Token);                                         \
645       yylval = (Value);                                         \
646       yytoken = YYTRANSLATE (yychar);                           \
647       YYPOPSTACK (1);                                           \
648       goto yybackup;                                            \
649     }                                                           \
650   else                                                          \
651     {                                                           \
652       yyerror (scanner, ctx, YY_("syntax error: cannot back up")); \
653       YYERROR;                                                  \
654     }                                                           \
655 while (YYID (0))
656
657
658 #define YYTERROR        1
659 #define YYERRCODE       256
660
661
662 /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
663    If N is 0, then set CURRENT to the empty location which ends
664    the previous symbol: RHS[0] (always defined).  */
665
666 #define YYRHSLOC(Rhs, K) ((Rhs)[K])
667 #ifndef YYLLOC_DEFAULT
668 # define YYLLOC_DEFAULT(Current, Rhs, N)                                \
669     do                                                                  \
670       if (YYID (N))                                                    \
671         {                                                               \
672           (Current).first_line   = YYRHSLOC (Rhs, 1).first_line;        \
673           (Current).first_column = YYRHSLOC (Rhs, 1).first_column;      \
674           (Current).last_line    = YYRHSLOC (Rhs, N).last_line;         \
675           (Current).last_column  = YYRHSLOC (Rhs, N).last_column;       \
676         }                                                               \
677       else                                                              \
678         {                                                               \
679           (Current).first_line   = (Current).last_line   =              \
680             YYRHSLOC (Rhs, 0).last_line;                                \
681           (Current).first_column = (Current).last_column =              \
682             YYRHSLOC (Rhs, 0).last_column;                              \
683         }                                                               \
684     while (YYID (0))
685 #endif
686
687
688 /* YY_LOCATION_PRINT -- Print the location on the stream.
689    This macro was not mandated originally: define only if we know
690    we won't break user code: when these are the locations we know.  */
691
692 #ifndef YY_LOCATION_PRINT
693 # if YYLTYPE_IS_TRIVIAL
694 #  define YY_LOCATION_PRINT(File, Loc)                  \
695      fprintf (File, "%d.%d-%d.%d",                      \
696               (Loc).first_line, (Loc).first_column,     \
697               (Loc).last_line,  (Loc).last_column)
698 # else
699 #  define YY_LOCATION_PRINT(File, Loc) ((void) 0)
700 # endif
701 #endif
702
703
704 /* YYLEX -- calling `yylex' with the right arguments.  */
705
706 #ifdef YYLEX_PARAM
707 # define YYLEX yylex (&yylval, YYLEX_PARAM)
708 #else
709 # define YYLEX yylex (&yylval, scanner)
710 #endif
711
712 /* Enable debugging if requested.  */
713 #if YYDEBUG
714
715 # ifndef YYFPRINTF
716 #  include <stdio.h> /* INFRINGES ON USER NAME SPACE */
717 #  define YYFPRINTF fprintf
718 # endif
719
720 # define YYDPRINTF(Args)                        \
721 do {                                            \
722   if (yydebug)                                  \
723     YYFPRINTF Args;                             \
724 } while (YYID (0))
725
726 # define YY_SYMBOL_PRINT(Title, Type, Value, Location)                    \
727 do {                                                                      \
728   if (yydebug)                                                            \
729     {                                                                     \
730       YYFPRINTF (stderr, "%s ", Title);                                   \
731       yy_symbol_print (stderr,                                            \
732                   Type, Value, scanner, ctx); \
733       YYFPRINTF (stderr, "\n");                                           \
734     }                                                                     \
735 } while (YYID (0))
736
737
738 /*--------------------------------.
739 | Print this symbol on YYOUTPUT.  |
740 `--------------------------------*/
741
742 /*ARGSUSED*/
743 #if (defined __STDC__ || defined __C99__FUNC__ \
744      || defined __cplusplus || defined _MSC_VER)
745 static void
746 yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, void *scanner, struct parse_context *ctx)
747 #else
748 static void
749 yy_symbol_value_print (yyoutput, yytype, yyvaluep, scanner, ctx)
750     FILE *yyoutput;
751     int yytype;
752     YYSTYPE const * const yyvaluep;
753     void *scanner;
754     struct parse_context *ctx;
755 #endif
756 {
757   if (!yyvaluep)
758     return;
759   YYUSE (scanner);
760   YYUSE (ctx);
761 # ifdef YYPRINT
762   if (yytype < YYNTOKENS)
763     YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
764 # else
765   YYUSE (yyoutput);
766 # endif
767   switch (yytype)
768     {
769       default:
770         break;
771     }
772 }
773
774
775 /*--------------------------------.
776 | Print this symbol on YYOUTPUT.  |
777 `--------------------------------*/
778
779 #if (defined __STDC__ || defined __C99__FUNC__ \
780      || defined __cplusplus || defined _MSC_VER)
781 static void
782 yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, void *scanner, struct parse_context *ctx)
783 #else
784 static void
785 yy_symbol_print (yyoutput, yytype, yyvaluep, scanner, ctx)
786     FILE *yyoutput;
787     int yytype;
788     YYSTYPE const * const yyvaluep;
789     void *scanner;
790     struct parse_context *ctx;
791 #endif
792 {
793   if (yytype < YYNTOKENS)
794     YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
795   else
796     YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
797
798   yy_symbol_value_print (yyoutput, yytype, yyvaluep, scanner, ctx);
799   YYFPRINTF (yyoutput, ")");
800 }
801
802 /*------------------------------------------------------------------.
803 | yy_stack_print -- Print the state stack from its BOTTOM up to its |
804 | TOP (included).                                                   |
805 `------------------------------------------------------------------*/
806
807 #if (defined __STDC__ || defined __C99__FUNC__ \
808      || defined __cplusplus || defined _MSC_VER)
809 static void
810 yy_stack_print (yytype_int16 *bottom, yytype_int16 *top)
811 #else
812 static void
813 yy_stack_print (bottom, top)
814     yytype_int16 *bottom;
815     yytype_int16 *top;
816 #endif
817 {
818   YYFPRINTF (stderr, "Stack now");
819   for (; bottom <= top; ++bottom)
820     YYFPRINTF (stderr, " %d", *bottom);
821   YYFPRINTF (stderr, "\n");
822 }
823
824 # define YY_STACK_PRINT(Bottom, Top)                            \
825 do {                                                            \
826   if (yydebug)                                                  \
827     yy_stack_print ((Bottom), (Top));                           \
828 } while (YYID (0))
829
830
831 /*------------------------------------------------.
832 | Report that the YYRULE is going to be reduced.  |
833 `------------------------------------------------*/
834
835 #if (defined __STDC__ || defined __C99__FUNC__ \
836      || defined __cplusplus || defined _MSC_VER)
837 static void
838 yy_reduce_print (YYSTYPE *yyvsp, int yyrule, void *scanner, struct parse_context *ctx)
839 #else
840 static void
841 yy_reduce_print (yyvsp, yyrule, scanner, ctx)
842     YYSTYPE *yyvsp;
843     int yyrule;
844     void *scanner;
845     struct parse_context *ctx;
846 #endif
847 {
848   int yynrhs = yyr2[yyrule];
849   int yyi;
850   unsigned long int yylno = yyrline[yyrule];
851   YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
852              yyrule - 1, yylno);
853   /* The symbols being reduced.  */
854   for (yyi = 0; yyi < yynrhs; yyi++)
855     {
856       fprintf (stderr, "   $%d = ", yyi + 1);
857       yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi],
858                        &(yyvsp[(yyi + 1) - (yynrhs)])
859                                        , scanner, ctx);
860       fprintf (stderr, "\n");
861     }
862 }
863
864 # define YY_REDUCE_PRINT(Rule)          \
865 do {                                    \
866   if (yydebug)                          \
867     yy_reduce_print (yyvsp, Rule, scanner, ctx); \
868 } while (YYID (0))
869
870 /* Nonzero means print parse trace.  It is left uninitialized so that
871    multiple parsers can coexist.  */
872 int yydebug;
873 #else /* !YYDEBUG */
874 # define YYDPRINTF(Args)
875 # define YY_SYMBOL_PRINT(Title, Type, Value, Location)
876 # define YY_STACK_PRINT(Bottom, Top)
877 # define YY_REDUCE_PRINT(Rule)
878 #endif /* !YYDEBUG */
879
880
881 /* YYINITDEPTH -- initial size of the parser's stacks.  */
882 #ifndef YYINITDEPTH
883 # define YYINITDEPTH 200
884 #endif
885
886 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
887    if the built-in stack extension method is used).
888
889    Do not make this value too large; the results are undefined if
890    YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
891    evaluated with infinite-precision integer arithmetic.  */
892
893 #ifndef YYMAXDEPTH
894 # define YYMAXDEPTH 10000
895 #endif
896
897
898
899 #if YYERROR_VERBOSE
900
901 # ifndef yystrlen
902 #  if defined __GLIBC__ && defined _STRING_H
903 #   define yystrlen strlen
904 #  else
905 /* Return the length of YYSTR.  */
906 #if (defined __STDC__ || defined __C99__FUNC__ \
907      || defined __cplusplus || defined _MSC_VER)
908 static YYSIZE_T
909 yystrlen (const char *yystr)
910 #else
911 static YYSIZE_T
912 yystrlen (yystr)
913     const char *yystr;
914 #endif
915 {
916   YYSIZE_T yylen;
917   for (yylen = 0; yystr[yylen]; yylen++)
918     continue;
919   return yylen;
920 }
921 #  endif
922 # endif
923
924 # ifndef yystpcpy
925 #  if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
926 #   define yystpcpy stpcpy
927 #  else
928 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
929    YYDEST.  */
930 #if (defined __STDC__ || defined __C99__FUNC__ \
931      || defined __cplusplus || defined _MSC_VER)
932 static char *
933 yystpcpy (char *yydest, const char *yysrc)
934 #else
935 static char *
936 yystpcpy (yydest, yysrc)
937     char *yydest;
938     const char *yysrc;
939 #endif
940 {
941   char *yyd = yydest;
942   const char *yys = yysrc;
943
944   while ((*yyd++ = *yys++) != '\0')
945     continue;
946
947   return yyd - 1;
948 }
949 #  endif
950 # endif
951
952 # ifndef yytnamerr
953 /* Copy to YYRES the contents of YYSTR after stripping away unnecessary
954    quotes and backslashes, so that it's suitable for yyerror.  The
955    heuristic is that double-quoting is unnecessary unless the string
956    contains an apostrophe, a comma, or backslash (other than
957    backslash-backslash).  YYSTR is taken from yytname.  If YYRES is
958    null, do not copy; instead, return the length of what the result
959    would have been.  */
960 static YYSIZE_T
961 yytnamerr (char *yyres, const char *yystr)
962 {
963   if (*yystr == '"')
964     {
965       YYSIZE_T yyn = 0;
966       char const *yyp = yystr;
967
968       for (;;)
969         switch (*++yyp)
970           {
971           case '\'':
972           case ',':
973             goto do_not_strip_quotes;
974
975           case '\\':
976             if (*++yyp != '\\')
977               goto do_not_strip_quotes;
978             /* Fall through.  */
979           default:
980             if (yyres)
981               yyres[yyn] = *yyp;
982             yyn++;
983             break;
984
985           case '"':
986             if (yyres)
987               yyres[yyn] = '\0';
988             return yyn;
989           }
990     do_not_strip_quotes: ;
991     }
992
993   if (! yyres)
994     return yystrlen (yystr);
995
996   return yystpcpy (yyres, yystr) - yyres;
997 }
998 # endif
999
1000 /* Copy into YYRESULT an error message about the unexpected token
1001    YYCHAR while in state YYSTATE.  Return the number of bytes copied,
1002    including the terminating null byte.  If YYRESULT is null, do not
1003    copy anything; just return the number of bytes that would be
1004    copied.  As a special case, return 0 if an ordinary "syntax error"
1005    message will do.  Return YYSIZE_MAXIMUM if overflow occurs during
1006    size calculation.  */
1007 static YYSIZE_T
1008 yysyntax_error (char *yyresult, int yystate, int yychar)
1009 {
1010   int yyn = yypact[yystate];
1011
1012   if (! (YYPACT_NINF < yyn && yyn <= YYLAST))
1013     return 0;
1014   else
1015     {
1016       int yytype = YYTRANSLATE (yychar);
1017       YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]);
1018       YYSIZE_T yysize = yysize0;
1019       YYSIZE_T yysize1;
1020       int yysize_overflow = 0;
1021       enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
1022       char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
1023       int yyx;
1024
1025 # if 0
1026       /* This is so xgettext sees the translatable formats that are
1027          constructed on the fly.  */
1028       YY_("syntax error, unexpected %s");
1029       YY_("syntax error, unexpected %s, expecting %s");
1030       YY_("syntax error, unexpected %s, expecting %s or %s");
1031       YY_("syntax error, unexpected %s, expecting %s or %s or %s");
1032       YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s");
1033 # endif
1034       char *yyfmt;
1035       char const *yyf;
1036       static char const yyunexpected[] = "syntax error, unexpected %s";
1037       static char const yyexpecting[] = ", expecting %s";
1038       static char const yyor[] = " or %s";
1039       char yyformat[sizeof yyunexpected
1040                     + sizeof yyexpecting - 1
1041                     + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2)
1042                        * (sizeof yyor - 1))];
1043       char const *yyprefix = yyexpecting;
1044
1045       /* Start YYX at -YYN if negative to avoid negative indexes in
1046          YYCHECK.  */
1047       int yyxbegin = yyn < 0 ? -yyn : 0;
1048
1049       /* Stay within bounds of both yycheck and yytname.  */
1050       int yychecklim = YYLAST - yyn + 1;
1051       int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
1052       int yycount = 1;
1053
1054       yyarg[0] = yytname[yytype];
1055       yyfmt = yystpcpy (yyformat, yyunexpected);
1056
1057       for (yyx = yyxbegin; yyx < yyxend; ++yyx)
1058         if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
1059           {
1060             if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
1061               {
1062                 yycount = 1;
1063                 yysize = yysize0;
1064                 yyformat[sizeof yyunexpected - 1] = '\0';
1065                 break;
1066               }
1067             yyarg[yycount++] = yytname[yyx];
1068             yysize1 = yysize + yytnamerr (0, yytname[yyx]);
1069             yysize_overflow |= (yysize1 < yysize);
1070             yysize = yysize1;
1071             yyfmt = yystpcpy (yyfmt, yyprefix);
1072             yyprefix = yyor;
1073           }
1074
1075       yyf = YY_(yyformat);
1076       yysize1 = yysize + yystrlen (yyf);
1077       yysize_overflow |= (yysize1 < yysize);
1078       yysize = yysize1;
1079
1080       if (yysize_overflow)
1081         return YYSIZE_MAXIMUM;
1082
1083       if (yyresult)
1084         {
1085           /* Avoid sprintf, as that infringes on the user's name space.
1086              Don't have undefined behavior even if the translation
1087              produced a string with the wrong number of "%s"s.  */
1088           char *yyp = yyresult;
1089           int yyi = 0;
1090           while ((*yyp = *yyf) != '\0')
1091             {
1092               if (*yyp == '%' && yyf[1] == 's' && yyi < yycount)
1093                 {
1094                   yyp += yytnamerr (yyp, yyarg[yyi++]);
1095                   yyf += 2;
1096                 }
1097               else
1098                 {
1099                   yyp++;
1100                   yyf++;
1101                 }
1102             }
1103         }
1104       return yysize;
1105     }
1106 }
1107 #endif /* YYERROR_VERBOSE */
1108
1109
1110 /*-----------------------------------------------.
1111 | Release the memory associated to this symbol.  |
1112 `-----------------------------------------------*/
1113
1114 /*ARGSUSED*/
1115 #if (defined __STDC__ || defined __C99__FUNC__ \
1116      || defined __cplusplus || defined _MSC_VER)
1117 static void
1118 yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep, void *scanner, struct parse_context *ctx)
1119 #else
1120 static void
1121 yydestruct (yymsg, yytype, yyvaluep, scanner, ctx)
1122     const char *yymsg;
1123     int yytype;
1124     YYSTYPE *yyvaluep;
1125     void *scanner;
1126     struct parse_context *ctx;
1127 #endif
1128 {
1129   YYUSE (yyvaluep);
1130   YYUSE (scanner);
1131   YYUSE (ctx);
1132
1133   if (!yymsg)
1134     yymsg = "Deleting";
1135   YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
1136
1137   switch (yytype)
1138     {
1139
1140       default:
1141         break;
1142     }
1143 }
1144
1145
1146 /* Prevent warnings from -Wmissing-prototypes.  */
1147
1148 #ifdef YYPARSE_PARAM
1149 #if defined __STDC__ || defined __cplusplus
1150 int yyparse (void *YYPARSE_PARAM);
1151 #else
1152 int yyparse ();
1153 #endif
1154 #else /* ! YYPARSE_PARAM */
1155 #if defined __STDC__ || defined __cplusplus
1156 int yyparse (void *scanner, struct parse_context *ctx);
1157 #else
1158 int yyparse ();
1159 #endif
1160 #endif /* ! YYPARSE_PARAM */
1161
1162
1163
1164
1165
1166
1167 /*----------.
1168 | yyparse.  |
1169 `----------*/
1170
1171 #ifdef YYPARSE_PARAM
1172 #if (defined __STDC__ || defined __C99__FUNC__ \
1173      || defined __cplusplus || defined _MSC_VER)
1174 int
1175 yyparse (void *YYPARSE_PARAM)
1176 #else
1177 int
1178 yyparse (YYPARSE_PARAM)
1179     void *YYPARSE_PARAM;
1180 #endif
1181 #else /* ! YYPARSE_PARAM */
1182 #if (defined __STDC__ || defined __C99__FUNC__ \
1183      || defined __cplusplus || defined _MSC_VER)
1184 int
1185 yyparse (void *scanner, struct parse_context *ctx)
1186 #else
1187 int
1188 yyparse (scanner, ctx)
1189     void *scanner;
1190     struct parse_context *ctx;
1191 #endif
1192 #endif
1193 {
1194   /* The look-ahead symbol.  */
1195 int yychar;
1196
1197 /* The semantic value of the look-ahead symbol.  */
1198 YYSTYPE yylval;
1199
1200 /* Number of syntax errors so far.  */
1201 int yynerrs;
1202
1203   int yystate;
1204   int yyn;
1205   int yyresult;
1206   /* Number of tokens to shift before error messages enabled.  */
1207   int yyerrstatus;
1208   /* Look-ahead token as an internal (translated) token number.  */
1209   int yytoken = 0;
1210 #if YYERROR_VERBOSE
1211   /* Buffer for error messages, and its allocated size.  */
1212   char yymsgbuf[128];
1213   char *yymsg = yymsgbuf;
1214   YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
1215 #endif
1216
1217   /* Three stacks and their tools:
1218      `yyss': related to states,
1219      `yyvs': related to semantic values,
1220      `yyls': related to locations.
1221
1222      Refer to the stacks thru separate pointers, to allow yyoverflow
1223      to reallocate them elsewhere.  */
1224
1225   /* The state stack.  */
1226   yytype_int16 yyssa[YYINITDEPTH];
1227   yytype_int16 *yyss = yyssa;
1228   yytype_int16 *yyssp;
1229
1230   /* The semantic value stack.  */
1231   YYSTYPE yyvsa[YYINITDEPTH];
1232   YYSTYPE *yyvs = yyvsa;
1233   YYSTYPE *yyvsp;
1234
1235
1236
1237 #define YYPOPSTACK(N)   (yyvsp -= (N), yyssp -= (N))
1238
1239   YYSIZE_T yystacksize = YYINITDEPTH;
1240
1241   /* The variables used to return semantic value and location from the
1242      action routines.  */
1243   YYSTYPE yyval;
1244
1245
1246   /* The number of symbols on the RHS of the reduced rule.
1247      Keep to zero when no symbol should be popped.  */
1248   int yylen = 0;
1249
1250   YYDPRINTF ((stderr, "Starting parse\n"));
1251
1252   yystate = 0;
1253   yyerrstatus = 0;
1254   yynerrs = 0;
1255   yychar = YYEMPTY;             /* Cause a token to be read.  */
1256
1257   /* Initialize stack pointers.
1258      Waste one element of value and location stack
1259      so that they stay on the same level as the state stack.
1260      The wasted elements are never initialized.  */
1261
1262   yyssp = yyss;
1263   yyvsp = yyvs;
1264
1265   goto yysetstate;
1266
1267 /*------------------------------------------------------------.
1268 | yynewstate -- Push a new state, which is found in yystate.  |
1269 `------------------------------------------------------------*/
1270  yynewstate:
1271   /* In all cases, when you get here, the value and location stacks
1272      have just been pushed.  So pushing a state here evens the stacks.  */
1273   yyssp++;
1274
1275  yysetstate:
1276   *yyssp = yystate;
1277
1278   if (yyss + yystacksize - 1 <= yyssp)
1279     {
1280       /* Get the current used size of the three stacks, in elements.  */
1281       YYSIZE_T yysize = yyssp - yyss + 1;
1282
1283 #ifdef yyoverflow
1284       {
1285         /* Give user a chance to reallocate the stack.  Use copies of
1286            these so that the &'s don't force the real ones into
1287            memory.  */
1288         YYSTYPE *yyvs1 = yyvs;
1289         yytype_int16 *yyss1 = yyss;
1290
1291
1292         /* Each stack pointer address is followed by the size of the
1293            data in use in that stack, in bytes.  This used to be a
1294            conditional around just the two extra args, but that might
1295            be undefined if yyoverflow is a macro.  */
1296         yyoverflow (YY_("memory exhausted"),
1297                     &yyss1, yysize * sizeof (*yyssp),
1298                     &yyvs1, yysize * sizeof (*yyvsp),
1299
1300                     &yystacksize);
1301
1302         yyss = yyss1;
1303         yyvs = yyvs1;
1304       }
1305 #else /* no yyoverflow */
1306 # ifndef YYSTACK_RELOCATE
1307       goto yyexhaustedlab;
1308 # else
1309       /* Extend the stack our own way.  */
1310       if (YYMAXDEPTH <= yystacksize)
1311         goto yyexhaustedlab;
1312       yystacksize *= 2;
1313       if (YYMAXDEPTH < yystacksize)
1314         yystacksize = YYMAXDEPTH;
1315
1316       {
1317         yytype_int16 *yyss1 = yyss;
1318         union yyalloc *yyptr =
1319           (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
1320         if (! yyptr)
1321           goto yyexhaustedlab;
1322         YYSTACK_RELOCATE (yyss);
1323         YYSTACK_RELOCATE (yyvs);
1324
1325 #  undef YYSTACK_RELOCATE
1326         if (yyss1 != yyssa)
1327           YYSTACK_FREE (yyss1);
1328       }
1329 # endif
1330 #endif /* no yyoverflow */
1331
1332       yyssp = yyss + yysize - 1;
1333       yyvsp = yyvs + yysize - 1;
1334
1335
1336       YYDPRINTF ((stderr, "Stack size increased to %lu\n",
1337                   (unsigned long int) yystacksize));
1338
1339       if (yyss + yystacksize - 1 <= yyssp)
1340         YYABORT;
1341     }
1342
1343   YYDPRINTF ((stderr, "Entering state %d\n", yystate));
1344
1345   goto yybackup;
1346
1347 /*-----------.
1348 | yybackup.  |
1349 `-----------*/
1350 yybackup:
1351
1352   /* Do appropriate processing given the current state.  Read a
1353      look-ahead token if we need one and don't already have one.  */
1354
1355   /* First try to decide what to do without reference to look-ahead token.  */
1356   yyn = yypact[yystate];
1357   if (yyn == YYPACT_NINF)
1358     goto yydefault;
1359
1360   /* Not known => get a look-ahead token if don't already have one.  */
1361
1362   /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol.  */
1363   if (yychar == YYEMPTY)
1364     {
1365       YYDPRINTF ((stderr, "Reading a token: "));
1366       yychar = YYLEX;
1367     }
1368
1369   if (yychar <= YYEOF)
1370     {
1371       yychar = yytoken = YYEOF;
1372       YYDPRINTF ((stderr, "Now at end of input.\n"));
1373     }
1374   else
1375     {
1376       yytoken = YYTRANSLATE (yychar);
1377       YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
1378     }
1379
1380   /* If the proper action on seeing token YYTOKEN is to reduce or to
1381      detect an error, take that action.  */
1382   yyn += yytoken;
1383   if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
1384     goto yydefault;
1385   yyn = yytable[yyn];
1386   if (yyn <= 0)
1387     {
1388       if (yyn == 0 || yyn == YYTABLE_NINF)
1389         goto yyerrlab;
1390       yyn = -yyn;
1391       goto yyreduce;
1392     }
1393
1394   if (yyn == YYFINAL)
1395     YYACCEPT;
1396
1397   /* Count tokens shifted since error; after three, turn off error
1398      status.  */
1399   if (yyerrstatus)
1400     yyerrstatus--;
1401
1402   /* Shift the look-ahead token.  */
1403   YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
1404
1405   /* Discard the shifted token unless it is eof.  */
1406   if (yychar != YYEOF)
1407     yychar = YYEMPTY;
1408
1409   yystate = yyn;
1410   *++yyvsp = yylval;
1411
1412   goto yynewstate;
1413
1414
1415 /*-----------------------------------------------------------.
1416 | yydefault -- do the default action for the current state.  |
1417 `-----------------------------------------------------------*/
1418 yydefault:
1419   yyn = yydefact[yystate];
1420   if (yyn == 0)
1421     goto yyerrlab;
1422   goto yyreduce;
1423
1424
1425 /*-----------------------------.
1426 | yyreduce -- Do a reduction.  |
1427 `-----------------------------*/
1428 yyreduce:
1429   /* yyn is the number of a rule to reduce with.  */
1430   yylen = yyr2[yyn];
1431
1432   /* If YYLEN is nonzero, implement the default value of the action:
1433      `$$ = $1'.
1434
1435      Otherwise, the following line sets YYVAL to garbage.
1436      This behavior is undocumented and Bison
1437      users should not rely upon it.  Assigning to YYVAL
1438      unconditionally makes the parser a bit smaller, and it avoids a
1439      GCC warning that YYVAL may be used uninitialized.  */
1440   yyval = yyvsp[1-yylen];
1441
1442
1443   YY_REDUCE_PRINT (yyn);
1444   switch (yyn)
1445     {
1446         case 8:
1447 #line 105 "grammar.y"
1448     {
1449     ctx->setting = config_setting_add(ctx->parent, (yyvsp[(1) - (1)].sval), CONFIG_TYPE_NONE);
1450     free((yyvsp[(1) - (1)].sval));
1451  
1452     if(ctx->setting == NULL)
1453     {
1454       libconfig_yyerror(scanner, ctx, err_duplicate_setting);
1455       YYABORT;
1456     }
1457     else
1458     {
1459       CAPTURE_PARSE_POS(ctx->setting);
1460     }
1461   }
1462     break;
1463
1464   case 10:
1465 #line 125 "grammar.y"
1466     {
1467     if(IN_LIST())
1468     {
1469       ctx->parent = config_setting_add(ctx->parent, NULL, CONFIG_TYPE_ARRAY);
1470       CAPTURE_PARSE_POS(ctx->parent);
1471     }
1472     else
1473     {
1474       ctx->setting->type = CONFIG_TYPE_ARRAY;
1475       ctx->parent = ctx->setting;
1476       ctx->setting = NULL;
1477     }
1478   }
1479     break;
1480
1481   case 11:
1482 #line 140 "grammar.y"
1483     {
1484     if(ctx->parent)
1485       ctx->parent = ctx->parent->parent;   
1486   }
1487     break;
1488
1489   case 12:
1490 #line 148 "grammar.y"
1491     {
1492     if(IN_LIST())
1493     {
1494       ctx->parent = config_setting_add(ctx->parent, NULL, CONFIG_TYPE_LIST);
1495       CAPTURE_PARSE_POS(ctx->parent);
1496     }
1497     else
1498     {
1499       ctx->setting->type = CONFIG_TYPE_LIST;
1500       ctx->parent = ctx->setting;
1501       ctx->setting = NULL;
1502     }
1503   }
1504     break;
1505
1506   case 13:
1507 #line 163 "grammar.y"
1508     {
1509     if(ctx->parent)
1510       ctx->parent = ctx->parent->parent;   
1511   }
1512     break;
1513
1514   case 18:
1515 #line 178 "grammar.y"
1516     {
1517     if(IN_ARRAY() || IN_LIST())
1518     {
1519       config_setting_t *e = config_setting_set_bool_elem(ctx->parent, -1,
1520                                                          (int)(yyvsp[(1) - (1)].ival));
1521      
1522       if(! e)
1523       {
1524         libconfig_yyerror(scanner, ctx, err_array_elem_type);
1525         YYABORT;
1526       }
1527       else
1528       {
1529         CAPTURE_PARSE_POS(e);
1530       }
1531     }
1532     else
1533       config_setting_set_bool(ctx->setting, (int)(yyvsp[(1) - (1)].ival));
1534   }
1535     break;
1536
1537   case 19:
1538 #line 198 "grammar.y"
1539     {
1540     if(IN_ARRAY() || IN_LIST())
1541     {
1542       config_setting_t *e = config_setting_set_int_elem(ctx->parent, -1, (yyvsp[(1) - (1)].ival));
1543       if(! e)
1544       {
1545         libconfig_yyerror(scanner, ctx, err_array_elem_type);
1546         YYABORT;
1547       }
1548       else
1549       {
1550         config_setting_set_format(e, CONFIG_FORMAT_DEFAULT);
1551         CAPTURE_PARSE_POS(e);
1552       }
1553     }
1554     else
1555     {
1556       config_setting_set_int(ctx->setting, (yyvsp[(1) - (1)].ival));
1557       config_setting_set_format(ctx->setting, CONFIG_FORMAT_DEFAULT);
1558     }
1559   }
1560     break;
1561
1562   case 20:
1563 #line 220 "grammar.y"
1564     {
1565     if(IN_ARRAY() || IN_LIST())
1566     {
1567       config_setting_t *e = config_setting_set_int64_elem(ctx->parent, -1, (yyvsp[(1) - (1)].llval));
1568       if(! e)
1569       {
1570         libconfig_yyerror(scanner, ctx, err_array_elem_type);
1571         YYABORT;
1572       }
1573       else
1574       {
1575         config_setting_set_format(e, CONFIG_FORMAT_DEFAULT);
1576         CAPTURE_PARSE_POS(e);
1577       }
1578     }
1579     else
1580     {
1581       config_setting_set_int64(ctx->setting, (yyvsp[(1) - (1)].llval));
1582       config_setting_set_format(ctx->setting, CONFIG_FORMAT_DEFAULT);
1583     }
1584   }
1585     break;
1586
1587   case 21:
1588 #line 242 "grammar.y"
1589     {
1590     if(IN_ARRAY() || IN_LIST())
1591     {
1592       config_setting_t *e = config_setting_set_int_elem(ctx->parent, -1, (yyvsp[(1) - (1)].ival));
1593       if(! e)
1594       {
1595         libconfig_yyerror(scanner, ctx, err_array_elem_type);
1596         YYABORT;
1597       }
1598       else
1599       {
1600         config_setting_set_format(e, CONFIG_FORMAT_HEX);
1601         CAPTURE_PARSE_POS(e);
1602       }
1603     }
1604     else
1605     {
1606       config_setting_set_int(ctx->setting, (yyvsp[(1) - (1)].ival));
1607       config_setting_set_format(ctx->setting, CONFIG_FORMAT_HEX);
1608     }
1609   }
1610     break;
1611
1612   case 22:
1613 #line 264 "grammar.y"
1614     {
1615     if(IN_ARRAY() || IN_LIST())
1616     {
1617       config_setting_t *e = config_setting_set_int64_elem(ctx->parent, -1, (yyvsp[(1) - (1)].llval));
1618       if(! e)
1619       {
1620         libconfig_yyerror(scanner, ctx, err_array_elem_type);
1621         YYABORT;
1622       }
1623       else
1624       {
1625         config_setting_set_format(e, CONFIG_FORMAT_HEX);
1626         CAPTURE_PARSE_POS(e);
1627       }
1628     }
1629     else
1630     {
1631       config_setting_set_int64(ctx->setting, (yyvsp[(1) - (1)].llval));
1632       config_setting_set_format(ctx->setting, CONFIG_FORMAT_HEX);
1633     }
1634   }
1635     break;
1636
1637   case 23:
1638 #line 286 "grammar.y"
1639     {
1640     if(IN_ARRAY() || IN_LIST())
1641     {
1642       config_setting_t *e = config_setting_set_float_elem(ctx->parent, -1, (yyvsp[(1) - (1)].fval));
1643       if(! e)
1644       {
1645         libconfig_yyerror(scanner, ctx, err_array_elem_type);
1646         YYABORT;
1647       }
1648       else
1649       {
1650         CAPTURE_PARSE_POS(e);
1651       }
1652     }
1653     else
1654       config_setting_set_float(ctx->setting, (yyvsp[(1) - (1)].fval));
1655   }
1656     break;
1657
1658   case 24:
1659 #line 304 "grammar.y"
1660     {
1661     if(IN_ARRAY() || IN_LIST())
1662     {
1663       config_setting_t *e = config_setting_set_string_elem(ctx->parent, -1,
1664                                                            (yyvsp[(1) - (1)].sval));
1665       free((yyvsp[(1) - (1)].sval));
1666      
1667       if(! e)
1668       {
1669         libconfig_yyerror(scanner, ctx, err_array_elem_type);
1670         YYABORT;
1671       }
1672       else
1673       {
1674         CAPTURE_PARSE_POS(e);
1675       }
1676     }
1677     else
1678     {
1679       config_setting_set_string(ctx->setting, (yyvsp[(1) - (1)].sval));
1680       free((yyvsp[(1) - (1)].sval));
1681     }
1682   }
1683     break;
1684
1685   case 33:
1686 #line 351 "grammar.y"
1687     {
1688     if(IN_LIST())
1689     {
1690       ctx->parent = config_setting_add(ctx->parent, NULL, CONFIG_TYPE_GROUP);
1691       CAPTURE_PARSE_POS(ctx->parent);
1692     }
1693     else
1694     {
1695       ctx->setting->type = CONFIG_TYPE_GROUP;
1696       ctx->parent = ctx->setting;
1697       ctx->setting = NULL;
1698     }
1699   }
1700     break;
1701
1702   case 34:
1703 #line 366 "grammar.y"
1704     {
1705     if(ctx->parent)
1706       ctx->parent = ctx->parent->parent;
1707   }
1708     break;
1709
1710
1711 /* Line 1267 of yacc.c.  */
1712 #line 1713 "grammar.c"
1713       default: break;
1714     }
1715   YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
1716
1717   YYPOPSTACK (yylen);
1718   yylen = 0;
1719   YY_STACK_PRINT (yyss, yyssp);
1720
1721   *++yyvsp = yyval;
1722
1723
1724   /* Now `shift' the result of the reduction.  Determine what state
1725      that goes to, based on the state we popped back to and the rule
1726      number reduced by.  */
1727
1728   yyn = yyr1[yyn];
1729
1730   yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
1731   if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
1732     yystate = yytable[yystate];
1733   else
1734     yystate = yydefgoto[yyn - YYNTOKENS];
1735
1736   goto yynewstate;
1737
1738
1739 /*------------------------------------.
1740 | yyerrlab -- here on detecting error |
1741 `------------------------------------*/
1742 yyerrlab:
1743   /* If not already recovering from an error, report this error.  */
1744   if (!yyerrstatus)
1745     {
1746       ++yynerrs;
1747 #if ! YYERROR_VERBOSE
1748       yyerror (scanner, ctx, YY_("syntax error"));
1749 #else
1750       {
1751         YYSIZE_T yysize = yysyntax_error (0, yystate, yychar);
1752         if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM)
1753           {
1754             YYSIZE_T yyalloc = 2 * yysize;
1755             if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM))
1756               yyalloc = YYSTACK_ALLOC_MAXIMUM;
1757             if (yymsg != yymsgbuf)
1758               YYSTACK_FREE (yymsg);
1759             yymsg = (char *) YYSTACK_ALLOC (yyalloc);
1760             if (yymsg)
1761               yymsg_alloc = yyalloc;
1762             else
1763               {
1764                 yymsg = yymsgbuf;
1765                 yymsg_alloc = sizeof yymsgbuf;
1766               }
1767           }
1768
1769         if (0 < yysize && yysize <= yymsg_alloc)
1770           {
1771             (void) yysyntax_error (yymsg, yystate, yychar);
1772             yyerror (scanner, ctx, yymsg);
1773           }
1774         else
1775           {
1776             yyerror (scanner, ctx, YY_("syntax error"));
1777             if (yysize != 0)
1778               goto yyexhaustedlab;
1779           }
1780       }
1781 #endif
1782     }
1783
1784
1785
1786   if (yyerrstatus == 3)
1787     {
1788       /* If just tried and failed to reuse look-ahead token after an
1789          error, discard it.  */
1790
1791       if (yychar <= YYEOF)
1792         {
1793           /* Return failure if at end of input.  */
1794           if (yychar == YYEOF)
1795             YYABORT;
1796         }
1797       else
1798         {
1799           yydestruct ("Error: discarding",
1800                       yytoken, &yylval, scanner, ctx);
1801           yychar = YYEMPTY;
1802         }
1803     }
1804
1805   /* Else will try to reuse look-ahead token after shifting the error
1806      token.  */
1807   goto yyerrlab1;
1808
1809
1810 /*---------------------------------------------------.
1811 | yyerrorlab -- error raised explicitly by YYERROR.  |
1812 `---------------------------------------------------*/
1813 yyerrorlab:
1814
1815   /* Pacify compilers like GCC when the user code never invokes
1816      YYERROR and the label yyerrorlab therefore never appears in user
1817      code.  */
1818   if (/*CONSTCOND*/ 0)
1819      goto yyerrorlab;
1820
1821   /* Do not reclaim the symbols of the rule which action triggered
1822      this YYERROR.  */
1823   YYPOPSTACK (yylen);
1824   yylen = 0;
1825   YY_STACK_PRINT (yyss, yyssp);
1826   yystate = *yyssp;
1827   goto yyerrlab1;
1828
1829
1830 /*-------------------------------------------------------------.
1831 | yyerrlab1 -- common code for both syntax error and YYERROR.  |
1832 `-------------------------------------------------------------*/
1833 yyerrlab1:
1834   yyerrstatus = 3;      /* Each real token shifted decrements this.  */
1835
1836   for (;;)
1837     {
1838       yyn = yypact[yystate];
1839       if (yyn != YYPACT_NINF)
1840         {
1841           yyn += YYTERROR;
1842           if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
1843             {
1844               yyn = yytable[yyn];
1845               if (0 < yyn)
1846                 break;
1847             }
1848         }
1849
1850       /* Pop the current state because it cannot handle the error token.  */
1851       if (yyssp == yyss)
1852         YYABORT;
1853
1854
1855       yydestruct ("Error: popping",
1856                   yystos[yystate], yyvsp, scanner, ctx);
1857       YYPOPSTACK (1);
1858       yystate = *yyssp;
1859       YY_STACK_PRINT (yyss, yyssp);
1860     }
1861
1862   if (yyn == YYFINAL)
1863     YYACCEPT;
1864
1865   *++yyvsp = yylval;
1866
1867
1868   /* Shift the error token.  */
1869   YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
1870
1871   yystate = yyn;
1872   goto yynewstate;
1873
1874
1875 /*-------------------------------------.
1876 | yyacceptlab -- YYACCEPT comes here.  |
1877 `-------------------------------------*/
1878 yyacceptlab:
1879   yyresult = 0;
1880   goto yyreturn;
1881
1882 /*-----------------------------------.
1883 | yyabortlab -- YYABORT comes here.  |
1884 `-----------------------------------*/
1885 yyabortlab:
1886   yyresult = 1;
1887   goto yyreturn;
1888
1889 #ifndef yyoverflow
1890 /*-------------------------------------------------.
1891 | yyexhaustedlab -- memory exhaustion comes here.  |
1892 `-------------------------------------------------*/
1893 yyexhaustedlab:
1894   yyerror (scanner, ctx, YY_("memory exhausted"));
1895   yyresult = 2;
1896   /* Fall through.  */
1897 #endif
1898
1899 yyreturn:
1900   if (yychar != YYEOF && yychar != YYEMPTY)
1901      yydestruct ("Cleanup: discarding lookahead",
1902                  yytoken, &yylval, scanner, ctx);
1903   /* Do not reclaim the symbols of the rule which action triggered
1904      this YYABORT or YYACCEPT.  */
1905   YYPOPSTACK (yylen);
1906   YY_STACK_PRINT (yyss, yyssp);
1907   while (yyssp != yyss)
1908     {
1909       yydestruct ("Cleanup: popping",
1910                   yystos[*yyssp], yyvsp, scanner, ctx);
1911       YYPOPSTACK (1);
1912     }
1913 #ifndef yyoverflow
1914   if (yyss != yyssa)
1915     YYSTACK_FREE (yyss);
1916 #endif
1917 #if YYERROR_VERBOSE
1918   if (yymsg != yymsgbuf)
1919     YYSTACK_FREE (yymsg);
1920 #endif
1921   /* Make sure YYID is used.  */
1922   return YYID (yyresult);
1923 }
1924
1925
1926 #line 372 "grammar.y"
1927
1928
Note: See TracBrowser for help on using the browser.