debuggers.hg

view tools/libxl/libxlu_cfg_y.c @ 22855:1d1eec7e1fb4

xl: Perform minimal validation of virtual disk file while parsing config file

This patch performs some very basic validation on the virtual disk
file passed through the config file. This validation ensures that we
don't go too far with the initialization like spawn qemu and more
while there could be some potentially fundamental issues.

[ Patch fixed up to work with PHYSTYPE_EMPTY 22808:6ec61438713a -iwj ]

Signed-off-by: Kamala Narasimhan <kamala.narasimhan@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
author Kamala Narasimhan <kamala.narasimhan@gmail.com>
date Tue Jan 25 18:09:49 2011 +0000 (2011-01-25)
parents 3138b3885999
children
line source
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)
11 any later version.
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. */
47 #define YYBISON 1
49 /* Bison version. */
50 #define YYBISON_VERSION "2.3"
52 /* Skeleton name. */
53 #define YYSKELETON_NAME "yacc.c"
55 /* Pure parsers. */
56 #define YYPURE 1
58 /* Using locations. */
59 #define YYLSP_NEEDED 1
61 /* Substitute the variable and function names. */
62 #define yyparse xlu__cfg_yyparse
63 #define yylex xlu__cfg_yylex
64 #define yyerror xlu__cfg_yyerror
65 #define yylval xlu__cfg_yylval
66 #define yychar xlu__cfg_yychar
67 #define yydebug xlu__cfg_yydebug
68 #define yynerrs xlu__cfg_yynerrs
69 #define yylloc xlu__cfg_yylloc
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 IDENT = 258,
78 STRING = 259,
79 NUMBER = 260,
80 NEWLINE = 261
81 };
82 #endif
83 /* Tokens. */
84 #define IDENT 258
85 #define STRING 259
86 #define NUMBER 260
87 #define NEWLINE 261
92 /* Copy the first part of user declarations. */
93 #line 3 "libxlu_cfg_y.y"
95 #define YYLEX_PARAM ctx->scanner
96 #include "libxlu_cfg_i.h"
97 #include "libxlu_cfg_l.h"
100 /* Enabling traces. */
101 #ifndef YYDEBUG
102 # define YYDEBUG 0
103 #endif
105 /* Enabling verbose error messages. */
106 #ifdef YYERROR_VERBOSE
107 # undef YYERROR_VERBOSE
108 # define YYERROR_VERBOSE 1
109 #else
110 # define YYERROR_VERBOSE 1
111 #endif
113 /* Enabling the token table. */
114 #ifndef YYTOKEN_TABLE
115 # define YYTOKEN_TABLE 0
116 #endif
118 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
119 typedef union YYSTYPE
120 #line 9 "libxlu_cfg_y.y"
121 {
122 char *string;
123 XLU_ConfigSetting *setting;
124 }
125 /* Line 187 of yacc.c. */
126 #line 127 "libxlu_cfg_y.c"
127 YYSTYPE;
128 # define yystype YYSTYPE /* obsolescent; will be withdrawn */
129 # define YYSTYPE_IS_DECLARED 1
130 # define YYSTYPE_IS_TRIVIAL 1
131 #endif
133 #if ! defined YYLTYPE && ! defined YYLTYPE_IS_DECLARED
134 typedef struct YYLTYPE
135 {
136 int first_line;
137 int first_column;
138 int last_line;
139 int last_column;
140 } YYLTYPE;
141 # define yyltype YYLTYPE /* obsolescent; will be withdrawn */
142 # define YYLTYPE_IS_DECLARED 1
143 # define YYLTYPE_IS_TRIVIAL 1
144 #endif
147 /* Copy the second part of user declarations. */
150 /* Line 216 of yacc.c. */
151 #line 152 "libxlu_cfg_y.c"
153 #ifdef short
154 # undef short
155 #endif
157 #ifdef YYTYPE_UINT8
158 typedef YYTYPE_UINT8 yytype_uint8;
159 #else
160 typedef unsigned char yytype_uint8;
161 #endif
163 #ifdef YYTYPE_INT8
164 typedef YYTYPE_INT8 yytype_int8;
165 #elif (defined __STDC__ || defined __C99__FUNC__ \
166 || defined __cplusplus || defined _MSC_VER)
167 typedef signed char yytype_int8;
168 #else
169 typedef short int yytype_int8;
170 #endif
172 #ifdef YYTYPE_UINT16
173 typedef YYTYPE_UINT16 yytype_uint16;
174 #else
175 typedef unsigned short int yytype_uint16;
176 #endif
178 #ifdef YYTYPE_INT16
179 typedef YYTYPE_INT16 yytype_int16;
180 #else
181 typedef short int yytype_int16;
182 #endif
184 #ifndef YYSIZE_T
185 # ifdef __SIZE_TYPE__
186 # define YYSIZE_T __SIZE_TYPE__
187 # elif defined size_t
188 # define YYSIZE_T size_t
189 # elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \
190 || defined __cplusplus || defined _MSC_VER)
191 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
192 # define YYSIZE_T size_t
193 # else
194 # define YYSIZE_T unsigned int
195 # endif
196 #endif
198 #define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
200 #ifndef YY_
201 # if YYENABLE_NLS
202 # if ENABLE_NLS
203 # include <libintl.h> /* INFRINGES ON USER NAME SPACE */
204 # define YY_(msgid) dgettext ("bison-runtime", msgid)
205 # endif
206 # endif
207 # ifndef YY_
208 # define YY_(msgid) msgid
209 # endif
210 #endif
212 /* Suppress unused-variable warnings by "using" E. */
213 #if ! defined lint || defined __GNUC__
214 # define YYUSE(e) ((void) (e))
215 #else
216 # define YYUSE(e) /* empty */
217 #endif
219 /* Identity function, used to suppress warnings about constant conditions. */
220 #ifndef lint
221 # define YYID(n) (n)
222 #else
223 #if (defined __STDC__ || defined __C99__FUNC__ \
224 || defined __cplusplus || defined _MSC_VER)
225 static int
226 YYID (int i)
227 #else
228 static int
229 YYID (i)
230 int i;
231 #endif
232 {
233 return i;
234 }
235 #endif
237 #if ! defined yyoverflow || YYERROR_VERBOSE
239 /* The parser invokes alloca or malloc; define the necessary symbols. */
241 # ifdef YYSTACK_USE_ALLOCA
242 # if YYSTACK_USE_ALLOCA
243 # ifdef __GNUC__
244 # define YYSTACK_ALLOC __builtin_alloca
245 # elif defined __BUILTIN_VA_ARG_INCR
246 # include <alloca.h> /* INFRINGES ON USER NAME SPACE */
247 # elif defined _AIX
248 # define YYSTACK_ALLOC __alloca
249 # elif defined _MSC_VER
250 # include <malloc.h> /* INFRINGES ON USER NAME SPACE */
251 # define alloca _alloca
252 # else
253 # define YYSTACK_ALLOC alloca
254 # if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
255 || defined __cplusplus || defined _MSC_VER)
256 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
257 # ifndef _STDLIB_H
258 # define _STDLIB_H 1
259 # endif
260 # endif
261 # endif
262 # endif
263 # endif
265 # ifdef YYSTACK_ALLOC
266 /* Pacify GCC's `empty if-body' warning. */
267 # define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0))
268 # ifndef YYSTACK_ALLOC_MAXIMUM
269 /* The OS might guarantee only one guard page at the bottom of the stack,
270 and a page size can be as small as 4096 bytes. So we cannot safely
271 invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
272 to allow for a few compiler-allocated temporary stack slots. */
273 # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
274 # endif
275 # else
276 # define YYSTACK_ALLOC YYMALLOC
277 # define YYSTACK_FREE YYFREE
278 # ifndef YYSTACK_ALLOC_MAXIMUM
279 # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
280 # endif
281 # if (defined __cplusplus && ! defined _STDLIB_H \
282 && ! ((defined YYMALLOC || defined malloc) \
283 && (defined YYFREE || defined free)))
284 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
285 # ifndef _STDLIB_H
286 # define _STDLIB_H 1
287 # endif
288 # endif
289 # ifndef YYMALLOC
290 # define YYMALLOC malloc
291 # if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
292 || defined __cplusplus || defined _MSC_VER)
293 void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
294 # endif
295 # endif
296 # ifndef YYFREE
297 # define YYFREE free
298 # if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
299 || defined __cplusplus || defined _MSC_VER)
300 void free (void *); /* INFRINGES ON USER NAME SPACE */
301 # endif
302 # endif
303 # endif
304 #endif /* ! defined yyoverflow || YYERROR_VERBOSE */
307 #if (! defined yyoverflow \
308 && (! defined __cplusplus \
309 || (defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL \
310 && defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
312 /* A type that is properly aligned for any stack member. */
313 union yyalloc
314 {
315 yytype_int16 yyss;
316 YYSTYPE yyvs;
317 YYLTYPE yyls;
318 };
320 /* The size of the maximum gap between one aligned stack and the next. */
321 # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
323 /* The size of an array large to enough to hold all stacks, each with
324 N elements. */
325 # define YYSTACK_BYTES(N) \
326 ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE) + sizeof (YYLTYPE)) \
327 + 2 * YYSTACK_GAP_MAXIMUM)
329 /* Copy COUNT objects from FROM to TO. The source and destination do
330 not overlap. */
331 # ifndef YYCOPY
332 # if defined __GNUC__ && 1 < __GNUC__
333 # define YYCOPY(To, From, Count) \
334 __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
335 # else
336 # define YYCOPY(To, From, Count) \
337 do \
338 { \
339 YYSIZE_T yyi; \
340 for (yyi = 0; yyi < (Count); yyi++) \
341 (To)[yyi] = (From)[yyi]; \
342 } \
343 while (YYID (0))
344 # endif
345 # endif
347 /* Relocate STACK from its old location to the new one. The
348 local variables YYSIZE and YYSTACKSIZE give the old and new number of
349 elements in the stack, and YYPTR gives the new location of the
350 stack. Advance YYPTR to a properly aligned location for the next
351 stack. */
352 # define YYSTACK_RELOCATE(Stack) \
353 do \
354 { \
355 YYSIZE_T yynewbytes; \
356 YYCOPY (&yyptr->Stack, Stack, yysize); \
357 Stack = &yyptr->Stack; \
358 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
359 yyptr += yynewbytes / sizeof (*yyptr); \
360 } \
361 while (YYID (0))
363 #endif
365 /* YYFINAL -- State number of the termination state. */
366 #define YYFINAL 2
367 /* YYLAST -- Last index in YYTABLE. */
368 #define YYLAST 23
370 /* YYNTOKENS -- Number of terminals. */
371 #define YYNTOKENS 12
372 /* YYNNTS -- Number of nonterminals. */
373 #define YYNNTS 10
374 /* YYNRULES -- Number of rules. */
375 #define YYNRULES 20
376 /* YYNRULES -- Number of states. */
377 #define YYNSTATES 29
379 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
380 #define YYUNDEFTOK 2
381 #define YYMAXUTOK 261
383 #define YYTRANSLATE(YYX) \
384 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
386 /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
387 static const yytype_uint8 yytranslate[] =
388 {
389 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
390 2, 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, 11, 2, 2, 2, 2, 2,
394 2, 2, 2, 2, 2, 2, 2, 2, 2, 8,
395 2, 7, 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, 9, 2, 10, 2, 2, 2, 2, 2, 2,
399 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
400 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
401 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
402 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
403 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
404 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
405 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
406 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
407 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
408 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
409 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
410 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
411 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
412 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
413 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
414 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
415 5, 6
416 };
418 #if YYDEBUG
419 /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
420 YYRHS. */
421 static const yytype_uint8 yyprhs[] =
422 {
423 0, 0, 3, 4, 7, 8, 14, 16, 19, 21,
424 23, 25, 30, 32, 34, 35, 37, 41, 44, 50,
425 51
426 };
428 /* YYRHS -- A `-1'-separated list of the rules' RHS. */
429 static const yytype_int8 yyrhs[] =
430 {
431 13, 0, -1, -1, 13, 14, -1, -1, 3, 7,
432 17, 15, 16, -1, 16, -1, 1, 6, -1, 6,
433 -1, 8, -1, 18, -1, 9, 21, 19, 10, -1,
434 4, -1, 5, -1, -1, 20, -1, 20, 11, 21,
435 -1, 18, 21, -1, 20, 11, 21, 18, 21, -1,
436 -1, 21, 6, -1
437 };
439 /* YYRLINE[YYN] -- source line where rule number YYN was defined. */
440 static const yytype_uint8 yyrline[] =
441 {
442 0, 31, 31, 32, 34, 34, 36, 37, 39, 40,
443 42, 43, 45, 46, 48, 49, 50, 52, 53, 55,
444 57
445 };
446 #endif
448 #if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
449 /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
450 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
451 static const char *const yytname[] =
452 {
453 "$end", "error", "$undefined", "IDENT", "STRING", "NUMBER", "NEWLINE",
454 "'='", "';'", "'['", "']'", "','", "$accept", "file", "setting", "@1",
455 "endstmt", "value", "atom", "valuelist", "values", "nlok", 0
456 };
457 #endif
459 # ifdef YYPRINT
460 /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
461 token YYLEX-NUM. */
462 static const yytype_uint16 yytoknum[] =
463 {
464 0, 256, 257, 258, 259, 260, 261, 61, 59, 91,
465 93, 44
466 };
467 # endif
469 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
470 static const yytype_uint8 yyr1[] =
471 {
472 0, 12, 13, 13, 15, 14, 14, 14, 16, 16,
473 17, 17, 18, 18, 19, 19, 19, 20, 20, 21,
474 21
475 };
477 /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
478 static const yytype_uint8 yyr2[] =
479 {
480 0, 2, 0, 2, 0, 5, 1, 2, 1, 1,
481 1, 4, 1, 1, 0, 1, 3, 2, 5, 0,
482 2
483 };
485 /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
486 STATE-NUM when YYTABLE doesn't specify something else to do. Zero
487 means the default is an error. */
488 static const yytype_uint8 yydefact[] =
489 {
490 2, 0, 1, 0, 0, 8, 9, 3, 6, 7,
491 0, 12, 13, 19, 4, 10, 14, 0, 20, 19,
492 0, 15, 5, 17, 11, 19, 16, 19, 18
493 };
495 /* YYDEFGOTO[NTERM-NUM]. */
496 static const yytype_int8 yydefgoto[] =
497 {
498 -1, 1, 7, 17, 8, 14, 15, 20, 21, 16
499 };
501 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
502 STATE-NUM. */
503 #define YYPACT_NINF -17
504 static const yytype_int8 yypact[] =
505 {
506 -17, 1, -17, -3, 5, -17, -17, -17, -17, -17,
507 10, -17, -17, -17, -17, -17, 12, 0, -17, -17,
508 11, 9, -17, 16, -17, -17, 12, -17, 16
509 };
511 /* YYPGOTO[NTERM-NUM]. */
512 static const yytype_int8 yypgoto[] =
513 {
514 -17, -17, -17, -17, 6, -17, -16, -17, -17, -14
515 };
517 /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
518 positive, shift that token. If negative, reduce the rule which
519 number is the opposite. If zero, do what YYDEFACT says.
520 If YYTABLE_NINF, syntax error. */
521 #define YYTABLE_NINF -1
522 static const yytype_uint8 yytable[] =
523 {
524 19, 2, 3, 9, 4, 23, 5, 5, 6, 6,
525 27, 26, 10, 28, 11, 12, 11, 12, 18, 13,
526 25, 24, 18, 22
527 };
529 static const yytype_uint8 yycheck[] =
530 {
531 16, 0, 1, 6, 3, 19, 6, 6, 8, 8,
532 26, 25, 7, 27, 4, 5, 4, 5, 6, 9,
533 11, 10, 6, 17
534 };
536 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
537 symbol of state STATE-NUM. */
538 static const yytype_uint8 yystos[] =
539 {
540 0, 13, 0, 1, 3, 6, 8, 14, 16, 6,
541 7, 4, 5, 9, 17, 18, 21, 15, 6, 18,
542 19, 20, 16, 21, 10, 11, 21, 18, 21
543 };
545 #define yyerrok (yyerrstatus = 0)
546 #define yyclearin (yychar = YYEMPTY)
547 #define YYEMPTY (-2)
548 #define YYEOF 0
550 #define YYACCEPT goto yyacceptlab
551 #define YYABORT goto yyabortlab
552 #define YYERROR goto yyerrorlab
555 /* Like YYERROR except do call yyerror. This remains here temporarily
556 to ease the transition to the new meaning of YYERROR, for GCC.
557 Once GCC version 2 has supplanted version 1, this can go. */
559 #define YYFAIL goto yyerrlab
561 #define YYRECOVERING() (!!yyerrstatus)
563 #define YYBACKUP(Token, Value) \
564 do \
565 if (yychar == YYEMPTY && yylen == 1) \
566 { \
567 yychar = (Token); \
568 yylval = (Value); \
569 yytoken = YYTRANSLATE (yychar); \
570 YYPOPSTACK (1); \
571 goto yybackup; \
572 } \
573 else \
574 { \
575 yyerror (&yylloc, ctx, YY_("syntax error: cannot back up")); \
576 YYERROR; \
577 } \
578 while (YYID (0))
581 #define YYTERROR 1
582 #define YYERRCODE 256
585 /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
586 If N is 0, then set CURRENT to the empty location which ends
587 the previous symbol: RHS[0] (always defined). */
589 #define YYRHSLOC(Rhs, K) ((Rhs)[K])
590 #ifndef YYLLOC_DEFAULT
591 # define YYLLOC_DEFAULT(Current, Rhs, N) \
592 do \
593 if (YYID (N)) \
594 { \
595 (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \
596 (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \
597 (Current).last_line = YYRHSLOC (Rhs, N).last_line; \
598 (Current).last_column = YYRHSLOC (Rhs, N).last_column; \
599 } \
600 else \
601 { \
602 (Current).first_line = (Current).last_line = \
603 YYRHSLOC (Rhs, 0).last_line; \
604 (Current).first_column = (Current).last_column = \
605 YYRHSLOC (Rhs, 0).last_column; \
606 } \
607 while (YYID (0))
608 #endif
611 /* YY_LOCATION_PRINT -- Print the location on the stream.
612 This macro was not mandated originally: define only if we know
613 we won't break user code: when these are the locations we know. */
615 #ifndef YY_LOCATION_PRINT
616 # if YYLTYPE_IS_TRIVIAL
617 # define YY_LOCATION_PRINT(File, Loc) \
618 fprintf (File, "%d.%d-%d.%d", \
619 (Loc).first_line, (Loc).first_column, \
620 (Loc).last_line, (Loc).last_column)
621 # else
622 # define YY_LOCATION_PRINT(File, Loc) ((void) 0)
623 # endif
624 #endif
627 /* YYLEX -- calling `yylex' with the right arguments. */
629 #ifdef YYLEX_PARAM
630 # define YYLEX yylex (&yylval, &yylloc, YYLEX_PARAM)
631 #else
632 # define YYLEX yylex (&yylval, &yylloc, scanner)
633 #endif
635 /* Enable debugging if requested. */
636 #if YYDEBUG
638 # ifndef YYFPRINTF
639 # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
640 # define YYFPRINTF fprintf
641 # endif
643 # define YYDPRINTF(Args) \
644 do { \
645 if (yydebug) \
646 YYFPRINTF Args; \
647 } while (YYID (0))
649 # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
650 do { \
651 if (yydebug) \
652 { \
653 YYFPRINTF (stderr, "%s ", Title); \
654 yy_symbol_print (stderr, \
655 Type, Value, Location, ctx); \
656 YYFPRINTF (stderr, "\n"); \
657 } \
658 } while (YYID (0))
661 /*--------------------------------.
662 | Print this symbol on YYOUTPUT. |
663 `--------------------------------*/
665 /*ARGSUSED*/
666 #if (defined __STDC__ || defined __C99__FUNC__ \
667 || defined __cplusplus || defined _MSC_VER)
668 static void
669 yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, YYLTYPE const * const yylocationp, CfgParseContext *ctx)
670 #else
671 static void
672 yy_symbol_value_print (yyoutput, yytype, yyvaluep, yylocationp, ctx)
673 FILE *yyoutput;
674 int yytype;
675 YYSTYPE const * const yyvaluep;
676 YYLTYPE const * const yylocationp;
677 CfgParseContext *ctx;
678 #endif
679 {
680 if (!yyvaluep)
681 return;
682 YYUSE (yylocationp);
683 YYUSE (ctx);
684 # ifdef YYPRINT
685 if (yytype < YYNTOKENS)
686 YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
687 # else
688 YYUSE (yyoutput);
689 # endif
690 switch (yytype)
691 {
692 default:
693 break;
694 }
695 }
698 /*--------------------------------.
699 | Print this symbol on YYOUTPUT. |
700 `--------------------------------*/
702 #if (defined __STDC__ || defined __C99__FUNC__ \
703 || defined __cplusplus || defined _MSC_VER)
704 static void
705 yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, YYLTYPE const * const yylocationp, CfgParseContext *ctx)
706 #else
707 static void
708 yy_symbol_print (yyoutput, yytype, yyvaluep, yylocationp, ctx)
709 FILE *yyoutput;
710 int yytype;
711 YYSTYPE const * const yyvaluep;
712 YYLTYPE const * const yylocationp;
713 CfgParseContext *ctx;
714 #endif
715 {
716 if (yytype < YYNTOKENS)
717 YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
718 else
719 YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
721 YY_LOCATION_PRINT (yyoutput, *yylocationp);
722 YYFPRINTF (yyoutput, ": ");
723 yy_symbol_value_print (yyoutput, yytype, yyvaluep, yylocationp, ctx);
724 YYFPRINTF (yyoutput, ")");
725 }
727 /*------------------------------------------------------------------.
728 | yy_stack_print -- Print the state stack from its BOTTOM up to its |
729 | TOP (included). |
730 `------------------------------------------------------------------*/
732 #if (defined __STDC__ || defined __C99__FUNC__ \
733 || defined __cplusplus || defined _MSC_VER)
734 static void
735 yy_stack_print (yytype_int16 *bottom, yytype_int16 *top)
736 #else
737 static void
738 yy_stack_print (bottom, top)
739 yytype_int16 *bottom;
740 yytype_int16 *top;
741 #endif
742 {
743 YYFPRINTF (stderr, "Stack now");
744 for (; bottom <= top; ++bottom)
745 YYFPRINTF (stderr, " %d", *bottom);
746 YYFPRINTF (stderr, "\n");
747 }
749 # define YY_STACK_PRINT(Bottom, Top) \
750 do { \
751 if (yydebug) \
752 yy_stack_print ((Bottom), (Top)); \
753 } while (YYID (0))
756 /*------------------------------------------------.
757 | Report that the YYRULE is going to be reduced. |
758 `------------------------------------------------*/
760 #if (defined __STDC__ || defined __C99__FUNC__ \
761 || defined __cplusplus || defined _MSC_VER)
762 static void
763 yy_reduce_print (YYSTYPE *yyvsp, YYLTYPE *yylsp, int yyrule, CfgParseContext *ctx)
764 #else
765 static void
766 yy_reduce_print (yyvsp, yylsp, yyrule, ctx)
767 YYSTYPE *yyvsp;
768 YYLTYPE *yylsp;
769 int yyrule;
770 CfgParseContext *ctx;
771 #endif
772 {
773 int yynrhs = yyr2[yyrule];
774 int yyi;
775 unsigned long int yylno = yyrline[yyrule];
776 YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
777 yyrule - 1, yylno);
778 /* The symbols being reduced. */
779 for (yyi = 0; yyi < yynrhs; yyi++)
780 {
781 fprintf (stderr, " $%d = ", yyi + 1);
782 yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi],
783 &(yyvsp[(yyi + 1) - (yynrhs)])
784 , &(yylsp[(yyi + 1) - (yynrhs)]) , ctx);
785 fprintf (stderr, "\n");
786 }
787 }
789 # define YY_REDUCE_PRINT(Rule) \
790 do { \
791 if (yydebug) \
792 yy_reduce_print (yyvsp, yylsp, Rule, ctx); \
793 } while (YYID (0))
795 /* Nonzero means print parse trace. It is left uninitialized so that
796 multiple parsers can coexist. */
797 int yydebug;
798 #else /* !YYDEBUG */
799 # define YYDPRINTF(Args)
800 # define YY_SYMBOL_PRINT(Title, Type, Value, Location)
801 # define YY_STACK_PRINT(Bottom, Top)
802 # define YY_REDUCE_PRINT(Rule)
803 #endif /* !YYDEBUG */
806 /* YYINITDEPTH -- initial size of the parser's stacks. */
807 #ifndef YYINITDEPTH
808 # define YYINITDEPTH 200
809 #endif
811 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
812 if the built-in stack extension method is used).
814 Do not make this value too large; the results are undefined if
815 YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
816 evaluated with infinite-precision integer arithmetic. */
818 #ifndef YYMAXDEPTH
819 # define YYMAXDEPTH 10000
820 #endif
824 #if YYERROR_VERBOSE
826 # ifndef yystrlen
827 # if defined __GLIBC__ && defined _STRING_H
828 # define yystrlen strlen
829 # else
830 /* Return the length of YYSTR. */
831 #if (defined __STDC__ || defined __C99__FUNC__ \
832 || defined __cplusplus || defined _MSC_VER)
833 static YYSIZE_T
834 yystrlen (const char *yystr)
835 #else
836 static YYSIZE_T
837 yystrlen (yystr)
838 const char *yystr;
839 #endif
840 {
841 YYSIZE_T yylen;
842 for (yylen = 0; yystr[yylen]; yylen++)
843 continue;
844 return yylen;
845 }
846 # endif
847 # endif
849 # ifndef yystpcpy
850 # if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
851 # define yystpcpy stpcpy
852 # else
853 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
854 YYDEST. */
855 #if (defined __STDC__ || defined __C99__FUNC__ \
856 || defined __cplusplus || defined _MSC_VER)
857 static char *
858 yystpcpy (char *yydest, const char *yysrc)
859 #else
860 static char *
861 yystpcpy (yydest, yysrc)
862 char *yydest;
863 const char *yysrc;
864 #endif
865 {
866 char *yyd = yydest;
867 const char *yys = yysrc;
869 while ((*yyd++ = *yys++) != '\0')
870 continue;
872 return yyd - 1;
873 }
874 # endif
875 # endif
877 # ifndef yytnamerr
878 /* Copy to YYRES the contents of YYSTR after stripping away unnecessary
879 quotes and backslashes, so that it's suitable for yyerror. The
880 heuristic is that double-quoting is unnecessary unless the string
881 contains an apostrophe, a comma, or backslash (other than
882 backslash-backslash). YYSTR is taken from yytname. If YYRES is
883 null, do not copy; instead, return the length of what the result
884 would have been. */
885 static YYSIZE_T
886 yytnamerr (char *yyres, const char *yystr)
887 {
888 if (*yystr == '"')
889 {
890 YYSIZE_T yyn = 0;
891 char const *yyp = yystr;
893 for (;;)
894 switch (*++yyp)
895 {
896 case '\'':
897 case ',':
898 goto do_not_strip_quotes;
900 case '\\':
901 if (*++yyp != '\\')
902 goto do_not_strip_quotes;
903 /* Fall through. */
904 default:
905 if (yyres)
906 yyres[yyn] = *yyp;
907 yyn++;
908 break;
910 case '"':
911 if (yyres)
912 yyres[yyn] = '\0';
913 return yyn;
914 }
915 do_not_strip_quotes: ;
916 }
918 if (! yyres)
919 return yystrlen (yystr);
921 return yystpcpy (yyres, yystr) - yyres;
922 }
923 # endif
925 /* Copy into YYRESULT an error message about the unexpected token
926 YYCHAR while in state YYSTATE. Return the number of bytes copied,
927 including the terminating null byte. If YYRESULT is null, do not
928 copy anything; just return the number of bytes that would be
929 copied. As a special case, return 0 if an ordinary "syntax error"
930 message will do. Return YYSIZE_MAXIMUM if overflow occurs during
931 size calculation. */
932 static YYSIZE_T
933 yysyntax_error (char *yyresult, int yystate, int yychar)
934 {
935 int yyn = yypact[yystate];
937 if (! (YYPACT_NINF < yyn && yyn <= YYLAST))
938 return 0;
939 else
940 {
941 int yytype = YYTRANSLATE (yychar);
942 YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]);
943 YYSIZE_T yysize = yysize0;
944 YYSIZE_T yysize1;
945 int yysize_overflow = 0;
946 enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
947 char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
948 int yyx;
950 # if 0
951 /* This is so xgettext sees the translatable formats that are
952 constructed on the fly. */
953 YY_("syntax error, unexpected %s");
954 YY_("syntax error, unexpected %s, expecting %s");
955 YY_("syntax error, unexpected %s, expecting %s or %s");
956 YY_("syntax error, unexpected %s, expecting %s or %s or %s");
957 YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s");
958 # endif
959 char *yyfmt;
960 char const *yyf;
961 static char const yyunexpected[] = "syntax error, unexpected %s";
962 static char const yyexpecting[] = ", expecting %s";
963 static char const yyor[] = " or %s";
964 char yyformat[sizeof yyunexpected
965 + sizeof yyexpecting - 1
966 + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2)
967 * (sizeof yyor - 1))];
968 char const *yyprefix = yyexpecting;
970 /* Start YYX at -YYN if negative to avoid negative indexes in
971 YYCHECK. */
972 int yyxbegin = yyn < 0 ? -yyn : 0;
974 /* Stay within bounds of both yycheck and yytname. */
975 int yychecklim = YYLAST - yyn + 1;
976 int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
977 int yycount = 1;
979 yyarg[0] = yytname[yytype];
980 yyfmt = yystpcpy (yyformat, yyunexpected);
982 for (yyx = yyxbegin; yyx < yyxend; ++yyx)
983 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
984 {
985 if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
986 {
987 yycount = 1;
988 yysize = yysize0;
989 yyformat[sizeof yyunexpected - 1] = '\0';
990 break;
991 }
992 yyarg[yycount++] = yytname[yyx];
993 yysize1 = yysize + yytnamerr (0, yytname[yyx]);
994 yysize_overflow |= (yysize1 < yysize);
995 yysize = yysize1;
996 yyfmt = yystpcpy (yyfmt, yyprefix);
997 yyprefix = yyor;
998 }
1000 yyf = YY_(yyformat);
1001 yysize1 = yysize + yystrlen (yyf);
1002 yysize_overflow |= (yysize1 < yysize);
1003 yysize = yysize1;
1005 if (yysize_overflow)
1006 return YYSIZE_MAXIMUM;
1008 if (yyresult)
1010 /* Avoid sprintf, as that infringes on the user's name space.
1011 Don't have undefined behavior even if the translation
1012 produced a string with the wrong number of "%s"s. */
1013 char *yyp = yyresult;
1014 int yyi = 0;
1015 while ((*yyp = *yyf) != '\0')
1017 if (*yyp == '%' && yyf[1] == 's' && yyi < yycount)
1019 yyp += yytnamerr (yyp, yyarg[yyi++]);
1020 yyf += 2;
1022 else
1024 yyp++;
1025 yyf++;
1029 return yysize;
1032 #endif /* YYERROR_VERBOSE */
1035 /*-----------------------------------------------.
1036 | Release the memory associated to this symbol. |
1037 `-----------------------------------------------*/
1039 /*ARGSUSED*/
1040 #if (defined __STDC__ || defined __C99__FUNC__ \
1041 || defined __cplusplus || defined _MSC_VER)
1042 static void
1043 yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep, YYLTYPE *yylocationp, CfgParseContext *ctx)
1044 #else
1045 static void
1046 yydestruct (yymsg, yytype, yyvaluep, yylocationp, ctx)
1047 const char *yymsg;
1048 int yytype;
1049 YYSTYPE *yyvaluep;
1050 YYLTYPE *yylocationp;
1051 CfgParseContext *ctx;
1052 #endif
1054 YYUSE (yyvaluep);
1055 YYUSE (yylocationp);
1056 YYUSE (ctx);
1058 if (!yymsg)
1059 yymsg = "Deleting";
1060 YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
1062 switch (yytype)
1064 case 3: /* "IDENT" */
1065 #line 24 "libxlu_cfg_y.y"
1066 { free((yyvaluep->string)); };
1067 #line 1068 "libxlu_cfg_y.c"
1068 break;
1069 case 4: /* "STRING" */
1070 #line 24 "libxlu_cfg_y.y"
1071 { free((yyvaluep->string)); };
1072 #line 1073 "libxlu_cfg_y.c"
1073 break;
1074 case 5: /* "NUMBER" */
1075 #line 24 "libxlu_cfg_y.y"
1076 { free((yyvaluep->string)); };
1077 #line 1078 "libxlu_cfg_y.c"
1078 break;
1079 case 17: /* "value" */
1080 #line 27 "libxlu_cfg_y.y"
1081 { xlu__cfg_set_free((yyvaluep->setting)); };
1082 #line 1083 "libxlu_cfg_y.c"
1083 break;
1084 case 18: /* "atom" */
1085 #line 24 "libxlu_cfg_y.y"
1086 { free((yyvaluep->string)); };
1087 #line 1088 "libxlu_cfg_y.c"
1088 break;
1089 case 19: /* "valuelist" */
1090 #line 27 "libxlu_cfg_y.y"
1091 { xlu__cfg_set_free((yyvaluep->setting)); };
1092 #line 1093 "libxlu_cfg_y.c"
1093 break;
1094 case 20: /* "values" */
1095 #line 27 "libxlu_cfg_y.y"
1096 { xlu__cfg_set_free((yyvaluep->setting)); };
1097 #line 1098 "libxlu_cfg_y.c"
1098 break;
1100 default:
1101 break;
1106 /* Prevent warnings from -Wmissing-prototypes. */
1108 #ifdef YYPARSE_PARAM
1109 #if defined __STDC__ || defined __cplusplus
1110 int yyparse (void *YYPARSE_PARAM);
1111 #else
1112 int yyparse ();
1113 #endif
1114 #else /* ! YYPARSE_PARAM */
1115 #if defined __STDC__ || defined __cplusplus
1116 int yyparse (CfgParseContext *ctx);
1117 #else
1118 int yyparse ();
1119 #endif
1120 #endif /* ! YYPARSE_PARAM */
1127 /*----------.
1128 | yyparse. |
1129 `----------*/
1131 #ifdef YYPARSE_PARAM
1132 #if (defined __STDC__ || defined __C99__FUNC__ \
1133 || defined __cplusplus || defined _MSC_VER)
1134 int
1135 yyparse (void *YYPARSE_PARAM)
1136 #else
1137 int
1138 yyparse (YYPARSE_PARAM)
1139 void *YYPARSE_PARAM;
1140 #endif
1141 #else /* ! YYPARSE_PARAM */
1142 #if (defined __STDC__ || defined __C99__FUNC__ \
1143 || defined __cplusplus || defined _MSC_VER)
1144 int
1145 yyparse (CfgParseContext *ctx)
1146 #else
1147 int
1148 yyparse (ctx)
1149 CfgParseContext *ctx;
1150 #endif
1151 #endif
1153 /* The look-ahead symbol. */
1154 int yychar;
1156 /* The semantic value of the look-ahead symbol. */
1157 YYSTYPE yylval;
1159 /* Number of syntax errors so far. */
1160 int yynerrs;
1161 /* Location data for the look-ahead symbol. */
1162 YYLTYPE yylloc;
1164 int yystate;
1165 int yyn;
1166 int yyresult;
1167 /* Number of tokens to shift before error messages enabled. */
1168 int yyerrstatus;
1169 /* Look-ahead token as an internal (translated) token number. */
1170 int yytoken = 0;
1171 #if YYERROR_VERBOSE
1172 /* Buffer for error messages, and its allocated size. */
1173 char yymsgbuf[128];
1174 char *yymsg = yymsgbuf;
1175 YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
1176 #endif
1178 /* Three stacks and their tools:
1179 `yyss': related to states,
1180 `yyvs': related to semantic values,
1181 `yyls': related to locations.
1183 Refer to the stacks thru separate pointers, to allow yyoverflow
1184 to reallocate them elsewhere. */
1186 /* The state stack. */
1187 yytype_int16 yyssa[YYINITDEPTH];
1188 yytype_int16 *yyss = yyssa;
1189 yytype_int16 *yyssp;
1191 /* The semantic value stack. */
1192 YYSTYPE yyvsa[YYINITDEPTH];
1193 YYSTYPE *yyvs = yyvsa;
1194 YYSTYPE *yyvsp;
1196 /* The location stack. */
1197 YYLTYPE yylsa[YYINITDEPTH];
1198 YYLTYPE *yyls = yylsa;
1199 YYLTYPE *yylsp;
1200 /* The locations where the error started and ended. */
1201 YYLTYPE yyerror_range[2];
1203 #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N), yylsp -= (N))
1205 YYSIZE_T yystacksize = YYINITDEPTH;
1207 /* The variables used to return semantic value and location from the
1208 action routines. */
1209 YYSTYPE yyval;
1210 YYLTYPE yyloc;
1212 /* The number of symbols on the RHS of the reduced rule.
1213 Keep to zero when no symbol should be popped. */
1214 int yylen = 0;
1216 YYDPRINTF ((stderr, "Starting parse\n"));
1218 yystate = 0;
1219 yyerrstatus = 0;
1220 yynerrs = 0;
1221 yychar = YYEMPTY; /* Cause a token to be read. */
1223 /* Initialize stack pointers.
1224 Waste one element of value and location stack
1225 so that they stay on the same level as the state stack.
1226 The wasted elements are never initialized. */
1228 yyssp = yyss;
1229 yyvsp = yyvs;
1230 yylsp = yyls;
1231 #if YYLTYPE_IS_TRIVIAL
1232 /* Initialize the default location before parsing starts. */
1233 yylloc.first_line = yylloc.last_line = 1;
1234 yylloc.first_column = yylloc.last_column = 0;
1235 #endif
1237 goto yysetstate;
1239 /*------------------------------------------------------------.
1240 | yynewstate -- Push a new state, which is found in yystate. |
1241 `------------------------------------------------------------*/
1242 yynewstate:
1243 /* In all cases, when you get here, the value and location stacks
1244 have just been pushed. So pushing a state here evens the stacks. */
1245 yyssp++;
1247 yysetstate:
1248 *yyssp = yystate;
1250 if (yyss + yystacksize - 1 <= yyssp)
1252 /* Get the current used size of the three stacks, in elements. */
1253 YYSIZE_T yysize = yyssp - yyss + 1;
1255 #ifdef yyoverflow
1257 /* Give user a chance to reallocate the stack. Use copies of
1258 these so that the &'s don't force the real ones into
1259 memory. */
1260 YYSTYPE *yyvs1 = yyvs;
1261 yytype_int16 *yyss1 = yyss;
1262 YYLTYPE *yyls1 = yyls;
1264 /* Each stack pointer address is followed by the size of the
1265 data in use in that stack, in bytes. This used to be a
1266 conditional around just the two extra args, but that might
1267 be undefined if yyoverflow is a macro. */
1268 yyoverflow (YY_("memory exhausted"),
1269 &yyss1, yysize * sizeof (*yyssp),
1270 &yyvs1, yysize * sizeof (*yyvsp),
1271 &yyls1, yysize * sizeof (*yylsp),
1272 &yystacksize);
1273 yyls = yyls1;
1274 yyss = yyss1;
1275 yyvs = yyvs1;
1277 #else /* no yyoverflow */
1278 # ifndef YYSTACK_RELOCATE
1279 goto yyexhaustedlab;
1280 # else
1281 /* Extend the stack our own way. */
1282 if (YYMAXDEPTH <= yystacksize)
1283 goto yyexhaustedlab;
1284 yystacksize *= 2;
1285 if (YYMAXDEPTH < yystacksize)
1286 yystacksize = YYMAXDEPTH;
1289 yytype_int16 *yyss1 = yyss;
1290 union yyalloc *yyptr =
1291 (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
1292 if (! yyptr)
1293 goto yyexhaustedlab;
1294 YYSTACK_RELOCATE (yyss);
1295 YYSTACK_RELOCATE (yyvs);
1296 YYSTACK_RELOCATE (yyls);
1297 # undef YYSTACK_RELOCATE
1298 if (yyss1 != yyssa)
1299 YYSTACK_FREE (yyss1);
1301 # endif
1302 #endif /* no yyoverflow */
1304 yyssp = yyss + yysize - 1;
1305 yyvsp = yyvs + yysize - 1;
1306 yylsp = yyls + yysize - 1;
1308 YYDPRINTF ((stderr, "Stack size increased to %lu\n",
1309 (unsigned long int) yystacksize));
1311 if (yyss + yystacksize - 1 <= yyssp)
1312 YYABORT;
1315 YYDPRINTF ((stderr, "Entering state %d\n", yystate));
1317 goto yybackup;
1319 /*-----------.
1320 | yybackup. |
1321 `-----------*/
1322 yybackup:
1324 /* Do appropriate processing given the current state. Read a
1325 look-ahead token if we need one and don't already have one. */
1327 /* First try to decide what to do without reference to look-ahead token. */
1328 yyn = yypact[yystate];
1329 if (yyn == YYPACT_NINF)
1330 goto yydefault;
1332 /* Not known => get a look-ahead token if don't already have one. */
1334 /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */
1335 if (yychar == YYEMPTY)
1337 YYDPRINTF ((stderr, "Reading a token: "));
1338 yychar = YYLEX;
1341 if (yychar <= YYEOF)
1343 yychar = yytoken = YYEOF;
1344 YYDPRINTF ((stderr, "Now at end of input.\n"));
1346 else
1348 yytoken = YYTRANSLATE (yychar);
1349 YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
1352 /* If the proper action on seeing token YYTOKEN is to reduce or to
1353 detect an error, take that action. */
1354 yyn += yytoken;
1355 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
1356 goto yydefault;
1357 yyn = yytable[yyn];
1358 if (yyn <= 0)
1360 if (yyn == 0 || yyn == YYTABLE_NINF)
1361 goto yyerrlab;
1362 yyn = -yyn;
1363 goto yyreduce;
1366 if (yyn == YYFINAL)
1367 YYACCEPT;
1369 /* Count tokens shifted since error; after three, turn off error
1370 status. */
1371 if (yyerrstatus)
1372 yyerrstatus--;
1374 /* Shift the look-ahead token. */
1375 YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
1377 /* Discard the shifted token unless it is eof. */
1378 if (yychar != YYEOF)
1379 yychar = YYEMPTY;
1381 yystate = yyn;
1382 *++yyvsp = yylval;
1383 *++yylsp = yylloc;
1384 goto yynewstate;
1387 /*-----------------------------------------------------------.
1388 | yydefault -- do the default action for the current state. |
1389 `-----------------------------------------------------------*/
1390 yydefault:
1391 yyn = yydefact[yystate];
1392 if (yyn == 0)
1393 goto yyerrlab;
1394 goto yyreduce;
1397 /*-----------------------------.
1398 | yyreduce -- Do a reduction. |
1399 `-----------------------------*/
1400 yyreduce:
1401 /* yyn is the number of a rule to reduce with. */
1402 yylen = yyr2[yyn];
1404 /* If YYLEN is nonzero, implement the default value of the action:
1405 `$$ = $1'.
1407 Otherwise, the following line sets YYVAL to garbage.
1408 This behavior is undocumented and Bison
1409 users should not rely upon it. Assigning to YYVAL
1410 unconditionally makes the parser a bit smaller, and it avoids a
1411 GCC warning that YYVAL may be used uninitialized. */
1412 yyval = yyvsp[1-yylen];
1414 /* Default location. */
1415 YYLLOC_DEFAULT (yyloc, (yylsp - yylen), yylen);
1416 YY_REDUCE_PRINT (yyn);
1417 switch (yyn)
1419 case 4:
1420 #line 34 "libxlu_cfg_y.y"
1421 { xlu__cfg_set_store(ctx,(yyvsp[(1) - (3)].string),(yyvsp[(3) - (3)].setting),(yylsp[(3) - (3)]).first_line); ;}
1422 break;
1424 case 10:
1425 #line 42 "libxlu_cfg_y.y"
1426 { (yyval.setting)= xlu__cfg_set_mk(ctx,1,(yyvsp[(1) - (1)].string)); ;}
1427 break;
1429 case 11:
1430 #line 43 "libxlu_cfg_y.y"
1431 { (yyval.setting)= (yyvsp[(3) - (4)].setting); ;}
1432 break;
1434 case 12:
1435 #line 45 "libxlu_cfg_y.y"
1436 { (yyval.string)= (yyvsp[(1) - (1)].string); ;}
1437 break;
1439 case 13:
1440 #line 46 "libxlu_cfg_y.y"
1441 { (yyval.string)= (yyvsp[(1) - (1)].string); ;}
1442 break;
1444 case 14:
1445 #line 48 "libxlu_cfg_y.y"
1446 { (yyval.setting)= xlu__cfg_set_mk(ctx,0,0); ;}
1447 break;
1449 case 15:
1450 #line 49 "libxlu_cfg_y.y"
1451 { (yyval.setting)= (yyvsp[(1) - (1)].setting); ;}
1452 break;
1454 case 16:
1455 #line 50 "libxlu_cfg_y.y"
1456 { (yyval.setting)= (yyvsp[(1) - (3)].setting); ;}
1457 break;
1459 case 17:
1460 #line 52 "libxlu_cfg_y.y"
1461 { (yyval.setting)= xlu__cfg_set_mk(ctx,2,(yyvsp[(1) - (2)].string)); ;}
1462 break;
1464 case 18:
1465 #line 53 "libxlu_cfg_y.y"
1466 { xlu__cfg_set_add(ctx,(yyvsp[(1) - (5)].setting),(yyvsp[(4) - (5)].string)); (yyval.setting)= (yyvsp[(1) - (5)].setting); ;}
1467 break;
1470 /* Line 1267 of yacc.c. */
1471 #line 1472 "libxlu_cfg_y.c"
1472 default: break;
1474 YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
1476 YYPOPSTACK (yylen);
1477 yylen = 0;
1478 YY_STACK_PRINT (yyss, yyssp);
1480 *++yyvsp = yyval;
1481 *++yylsp = yyloc;
1483 /* Now `shift' the result of the reduction. Determine what state
1484 that goes to, based on the state we popped back to and the rule
1485 number reduced by. */
1487 yyn = yyr1[yyn];
1489 yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
1490 if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
1491 yystate = yytable[yystate];
1492 else
1493 yystate = yydefgoto[yyn - YYNTOKENS];
1495 goto yynewstate;
1498 /*------------------------------------.
1499 | yyerrlab -- here on detecting error |
1500 `------------------------------------*/
1501 yyerrlab:
1502 /* If not already recovering from an error, report this error. */
1503 if (!yyerrstatus)
1505 ++yynerrs;
1506 #if ! YYERROR_VERBOSE
1507 yyerror (&yylloc, ctx, YY_("syntax error"));
1508 #else
1510 YYSIZE_T yysize = yysyntax_error (0, yystate, yychar);
1511 if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM)
1513 YYSIZE_T yyalloc = 2 * yysize;
1514 if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM))
1515 yyalloc = YYSTACK_ALLOC_MAXIMUM;
1516 if (yymsg != yymsgbuf)
1517 YYSTACK_FREE (yymsg);
1518 yymsg = (char *) YYSTACK_ALLOC (yyalloc);
1519 if (yymsg)
1520 yymsg_alloc = yyalloc;
1521 else
1523 yymsg = yymsgbuf;
1524 yymsg_alloc = sizeof yymsgbuf;
1528 if (0 < yysize && yysize <= yymsg_alloc)
1530 (void) yysyntax_error (yymsg, yystate, yychar);
1531 yyerror (&yylloc, ctx, yymsg);
1533 else
1535 yyerror (&yylloc, ctx, YY_("syntax error"));
1536 if (yysize != 0)
1537 goto yyexhaustedlab;
1540 #endif
1543 yyerror_range[0] = yylloc;
1545 if (yyerrstatus == 3)
1547 /* If just tried and failed to reuse look-ahead token after an
1548 error, discard it. */
1550 if (yychar <= YYEOF)
1552 /* Return failure if at end of input. */
1553 if (yychar == YYEOF)
1554 YYABORT;
1556 else
1558 yydestruct ("Error: discarding",
1559 yytoken, &yylval, &yylloc, ctx);
1560 yychar = YYEMPTY;
1564 /* Else will try to reuse look-ahead token after shifting the error
1565 token. */
1566 goto yyerrlab1;
1569 /*---------------------------------------------------.
1570 | yyerrorlab -- error raised explicitly by YYERROR. |
1571 `---------------------------------------------------*/
1572 yyerrorlab:
1574 /* Pacify compilers like GCC when the user code never invokes
1575 YYERROR and the label yyerrorlab therefore never appears in user
1576 code. */
1577 if (/*CONSTCOND*/ 0)
1578 goto yyerrorlab;
1580 yyerror_range[0] = yylsp[1-yylen];
1581 /* Do not reclaim the symbols of the rule which action triggered
1582 this YYERROR. */
1583 YYPOPSTACK (yylen);
1584 yylen = 0;
1585 YY_STACK_PRINT (yyss, yyssp);
1586 yystate = *yyssp;
1587 goto yyerrlab1;
1590 /*-------------------------------------------------------------.
1591 | yyerrlab1 -- common code for both syntax error and YYERROR. |
1592 `-------------------------------------------------------------*/
1593 yyerrlab1:
1594 yyerrstatus = 3; /* Each real token shifted decrements this. */
1596 for (;;)
1598 yyn = yypact[yystate];
1599 if (yyn != YYPACT_NINF)
1601 yyn += YYTERROR;
1602 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
1604 yyn = yytable[yyn];
1605 if (0 < yyn)
1606 break;
1610 /* Pop the current state because it cannot handle the error token. */
1611 if (yyssp == yyss)
1612 YYABORT;
1614 yyerror_range[0] = *yylsp;
1615 yydestruct ("Error: popping",
1616 yystos[yystate], yyvsp, yylsp, ctx);
1617 YYPOPSTACK (1);
1618 yystate = *yyssp;
1619 YY_STACK_PRINT (yyss, yyssp);
1622 if (yyn == YYFINAL)
1623 YYACCEPT;
1625 *++yyvsp = yylval;
1627 yyerror_range[1] = yylloc;
1628 /* Using YYLLOC is tempting, but would change the location of
1629 the look-ahead. YYLOC is available though. */
1630 YYLLOC_DEFAULT (yyloc, (yyerror_range - 1), 2);
1631 *++yylsp = yyloc;
1633 /* Shift the error token. */
1634 YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
1636 yystate = yyn;
1637 goto yynewstate;
1640 /*-------------------------------------.
1641 | yyacceptlab -- YYACCEPT comes here. |
1642 `-------------------------------------*/
1643 yyacceptlab:
1644 yyresult = 0;
1645 goto yyreturn;
1647 /*-----------------------------------.
1648 | yyabortlab -- YYABORT comes here. |
1649 `-----------------------------------*/
1650 yyabortlab:
1651 yyresult = 1;
1652 goto yyreturn;
1654 #ifndef yyoverflow
1655 /*-------------------------------------------------.
1656 | yyexhaustedlab -- memory exhaustion comes here. |
1657 `-------------------------------------------------*/
1658 yyexhaustedlab:
1659 yyerror (&yylloc, ctx, YY_("memory exhausted"));
1660 yyresult = 2;
1661 /* Fall through. */
1662 #endif
1664 yyreturn:
1665 if (yychar != YYEOF && yychar != YYEMPTY)
1666 yydestruct ("Cleanup: discarding lookahead",
1667 yytoken, &yylval, &yylloc, ctx);
1668 /* Do not reclaim the symbols of the rule which action triggered
1669 this YYABORT or YYACCEPT. */
1670 YYPOPSTACK (yylen);
1671 YY_STACK_PRINT (yyss, yyssp);
1672 while (yyssp != yyss)
1674 yydestruct ("Cleanup: popping",
1675 yystos[*yyssp], yyvsp, yylsp, ctx);
1676 YYPOPSTACK (1);
1678 #ifndef yyoverflow
1679 if (yyss != yyssa)
1680 YYSTACK_FREE (yyss);
1681 #endif
1682 #if YYERROR_VERBOSE
1683 if (yymsg != yymsgbuf)
1684 YYSTACK_FREE (yymsg);
1685 #endif
1686 /* Make sure YYID is used. */
1687 return YYID (yyresult);