add obstack and libcore to libfirm
[libfirm] / ir / libcore / lc_config_parser.c
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 0
57
58 /* Using locations.  */
59 #define YYLSP_NEEDED 0
60
61 /* Substitute the variable and function names.  */
62 #define yyparse _lc_opt_parse
63 #define yylex   _lc_opt_lex
64 #define yyerror _lc_opt_error
65 #define yylval  _lc_opt_lval
66 #define yychar  _lc_opt_char
67 #define yydebug _lc_opt_debug
68 #define yynerrs _lc_opt_nerrs
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      SEP = 258,
78      DATA = 259,
79      IDENT = 260
80    };
81 #endif
82 /* Tokens.  */
83 #define SEP 258
84 #define DATA 259
85 #define IDENT 260
86
87
88
89
90 /* Copy the first part of user declarations.  */
91
92
93
94 /*
95   libcore: library for basic data structures and algorithms.
96   Copyright (C) 2005  IPD Goos, Universit"at Karlsruhe, Germany
97
98   This library is free software; you can redistribute it and/or
99   modify it under the terms of the GNU Lesser General Public
100   License as published by the Free Software Foundation; either
101   version 2.1 of the License, or (at your option) any later version.
102
103   This library is distributed in the hope that it will be useful,
104   but WITHOUT ANY WARRANTY; without even the implied warranty of
105   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
106   Lesser General Public License for more details.
107
108   You should have received a copy of the GNU Lesser General Public
109   License along with this library; if not, write to the Free Software
110   Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
111 */
112
113 #include <string.h>
114
115 #include "lc_opts_t.h"
116 #include "lc_parser_t.h"
117
118 static void group_open(void);
119 static void group_close(void);
120 static void lc_opt_set(void);
121 static void path_push(text_t text);
122
123 void PMANGLE(error)(const char *str);
124 int PMANGLE(linenr);
125
126
127
128 /* Enabling traces.  */
129 #ifndef YYDEBUG
130 # define YYDEBUG 0
131 #endif
132
133 /* Enabling verbose error messages.  */
134 #ifdef YYERROR_VERBOSE
135 # undef YYERROR_VERBOSE
136 # define YYERROR_VERBOSE 1
137 #else
138 # define YYERROR_VERBOSE 0
139 #endif
140
141 /* Enabling the token table.  */
142 #ifndef YYTOKEN_TABLE
143 # define YYTOKEN_TABLE 0
144 #endif
145
146 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
147 typedef union YYSTYPE
148
149 {
150         text_t text;
151         int num;
152 }
153 /* Line 187 of yacc.c.  */
154
155         YYSTYPE;
156 # define yystype YYSTYPE /* obsolescent; will be withdrawn */
157 # define YYSTYPE_IS_DECLARED 1
158 # define YYSTYPE_IS_TRIVIAL 1
159 #endif
160
161
162
163 /* Copy the second part of user declarations.  */
164
165
166 /* Line 216 of yacc.c.  */
167
168
169 #ifdef short
170 # undef short
171 #endif
172
173 #ifdef YYTYPE_UINT8
174 typedef YYTYPE_UINT8 yytype_uint8;
175 #else
176 typedef unsigned char yytype_uint8;
177 #endif
178
179 #ifdef YYTYPE_INT8
180 typedef YYTYPE_INT8 yytype_int8;
181 #elif (defined __STDC__ || defined __C99__FUNC__ \
182      || defined __cplusplus || defined _MSC_VER)
183 typedef signed char yytype_int8;
184 #else
185 typedef short int yytype_int8;
186 #endif
187
188 #ifdef YYTYPE_UINT16
189 typedef YYTYPE_UINT16 yytype_uint16;
190 #else
191 typedef unsigned short int yytype_uint16;
192 #endif
193
194 #ifdef YYTYPE_INT16
195 typedef YYTYPE_INT16 yytype_int16;
196 #else
197 typedef short int yytype_int16;
198 #endif
199
200 #ifndef YYSIZE_T
201 # ifdef __SIZE_TYPE__
202 #  define YYSIZE_T __SIZE_TYPE__
203 # elif defined size_t
204 #  define YYSIZE_T size_t
205 # elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \
206      || defined __cplusplus || defined _MSC_VER)
207 #  include <stddef.h> /* INFRINGES ON USER NAME SPACE */
208 #  define YYSIZE_T size_t
209 # else
210 #  define YYSIZE_T unsigned int
211 # endif
212 #endif
213
214 #define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
215
216 #ifndef YY_
217 # if YYENABLE_NLS
218 #  if ENABLE_NLS
219 #   include <libintl.h> /* INFRINGES ON USER NAME SPACE */
220 #   define YY_(msgid) dgettext ("bison-runtime", msgid)
221 #  endif
222 # endif
223 # ifndef YY_
224 #  define YY_(msgid) msgid
225 # endif
226 #endif
227
228 /* Suppress unused-variable warnings by "using" E.  */
229 #if ! defined lint || defined __GNUC__
230 # define YYUSE(e) ((void) (e))
231 #else
232 # define YYUSE(e) /* empty */
233 #endif
234
235 /* Identity function, used to suppress warnings about constant conditions.  */
236 #ifndef lint
237 # define YYID(n) (n)
238 #else
239 #if (defined __STDC__ || defined __C99__FUNC__ \
240      || defined __cplusplus || defined _MSC_VER)
241 static int
242 YYID (int i)
243 #else
244 static int
245 YYID (i)
246     int i;
247 #endif
248 {
249   return i;
250 }
251 #endif
252
253 #if ! defined yyoverflow || YYERROR_VERBOSE
254
255 /* The parser invokes alloca or malloc; define the necessary symbols.  */
256
257 # ifdef YYSTACK_USE_ALLOCA
258 #  if YYSTACK_USE_ALLOCA
259 #   ifdef __GNUC__
260 #    define YYSTACK_ALLOC __builtin_alloca
261 #   elif defined __BUILTIN_VA_ARG_INCR
262 #    include <alloca.h> /* INFRINGES ON USER NAME SPACE */
263 #   elif defined _AIX
264 #    define YYSTACK_ALLOC __alloca
265 #   elif defined _MSC_VER
266 #    include <malloc.h> /* INFRINGES ON USER NAME SPACE */
267 #    define alloca _alloca
268 #   else
269 #    define YYSTACK_ALLOC alloca
270 #    if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
271      || defined __cplusplus || defined _MSC_VER)
272 #     include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
273 #     ifndef _STDLIB_H
274 #      define _STDLIB_H 1
275 #     endif
276 #    endif
277 #   endif
278 #  endif
279 # endif
280
281 # ifdef YYSTACK_ALLOC
282    /* Pacify GCC's `empty if-body' warning.  */
283 #  define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0))
284 #  ifndef YYSTACK_ALLOC_MAXIMUM
285     /* The OS might guarantee only one guard page at the bottom of the stack,
286        and a page size can be as small as 4096 bytes.  So we cannot safely
287        invoke alloca (N) if N exceeds 4096.  Use a slightly smaller number
288        to allow for a few compiler-allocated temporary stack slots.  */
289 #   define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
290 #  endif
291 # else
292 #  define YYSTACK_ALLOC YYMALLOC
293 #  define YYSTACK_FREE YYFREE
294 #  ifndef YYSTACK_ALLOC_MAXIMUM
295 #   define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
296 #  endif
297 #  if (defined __cplusplus && ! defined _STDLIB_H \
298        && ! ((defined YYMALLOC || defined malloc) \
299              && (defined YYFREE || defined free)))
300 #   include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
301 #   ifndef _STDLIB_H
302 #    define _STDLIB_H 1
303 #   endif
304 #  endif
305 #  ifndef YYMALLOC
306 #   define YYMALLOC malloc
307 #   if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
308      || defined __cplusplus || defined _MSC_VER)
309 void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
310 #   endif
311 #  endif
312 #  ifndef YYFREE
313 #   define YYFREE free
314 #   if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
315      || defined __cplusplus || defined _MSC_VER)
316 void free (void *); /* INFRINGES ON USER NAME SPACE */
317 #   endif
318 #  endif
319 # endif
320 #endif /* ! defined yyoverflow || YYERROR_VERBOSE */
321
322
323 #if (! defined yyoverflow \
324      && (! defined __cplusplus \
325          || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
326
327 /* A type that is properly aligned for any stack member.  */
328 union yyalloc
329 {
330   yytype_int16 yyss;
331   YYSTYPE yyvs;
332   };
333
334 /* The size of the maximum gap between one aligned stack and the next.  */
335 # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
336
337 /* The size of an array large to enough to hold all stacks, each with
338    N elements.  */
339 # define YYSTACK_BYTES(N) \
340      ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
341       + YYSTACK_GAP_MAXIMUM)
342
343 /* Copy COUNT objects from FROM to TO.  The source and destination do
344    not overlap.  */
345 # ifndef YYCOPY
346 #  if defined __GNUC__ && 1 < __GNUC__
347 #   define YYCOPY(To, From, Count) \
348       __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
349 #  else
350 #   define YYCOPY(To, From, Count)              \
351       do                                        \
352         {                                       \
353           YYSIZE_T yyi;                         \
354           for (yyi = 0; yyi < (Count); yyi++)   \
355             (To)[yyi] = (From)[yyi];            \
356         }                                       \
357       while (YYID (0))
358 #  endif
359 # endif
360
361 /* Relocate STACK from its old location to the new one.  The
362    local variables YYSIZE and YYSTACKSIZE give the old and new number of
363    elements in the stack, and YYPTR gives the new location of the
364    stack.  Advance YYPTR to a properly aligned location for the next
365    stack.  */
366 # define YYSTACK_RELOCATE(Stack)                                        \
367     do                                                                  \
368       {                                                                 \
369         YYSIZE_T yynewbytes;                                            \
370         YYCOPY (&yyptr->Stack, Stack, yysize);                          \
371         Stack = &yyptr->Stack;                                          \
372         yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
373         yyptr += yynewbytes / sizeof (*yyptr);                          \
374       }                                                                 \
375     while (YYID (0))
376
377 #endif
378
379 /* YYFINAL -- State number of the termination state.  */
380 #define YYFINAL  9
381 /* YYLAST -- Last index in YYTABLE.  */
382 #define YYLAST   8
383
384 /* YYNTOKENS -- Number of terminals.  */
385 #define YYNTOKENS  8
386 /* YYNNTS -- Number of nonterminals.  */
387 #define YYNNTS  9
388 /* YYNRULES -- Number of rules.  */
389 #define YYNRULES  13
390 /* YYNRULES -- Number of states.  */
391 #define YYNSTATES  18
392
393 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX.  */
394 #define YYUNDEFTOK  2
395 #define YYMAXUTOK   260
396
397 #define YYTRANSLATE(YYX)                                                \
398   ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
399
400 /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX.  */
401 static const yytype_uint8 yytranslate[] =
402 {
403        0,     2,     2,     2,     2,     2,     2,     2,     2,     2,
404        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
405        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
406        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
407        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
408        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
409        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
410        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
411        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
412        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
413        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
414        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
415        2,     2,     2,     6,     2,     7,     2,     2,     2,     2,
416        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
417        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
418        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
419        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
420        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
421        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
422        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
423        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
424        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
425        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
426        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
427        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
428        2,     2,     2,     2,     2,     2,     1,     2,     3,     4,
429        5
430 };
431
432 #if YYDEBUG
433 /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
434    YYRHS.  */
435 static const yytype_uint8 yyprhs[] =
436 {
437        0,     0,     3,     5,     7,     9,    12,    14,    16,    17,
438       18,    24,    27,    31
439 };
440
441 /* YYRHS -- A `-1'-separated list of the rules' RHS.  */
442 static const yytype_int8 yyrhs[] =
443 {
444        9,     0,    -1,    12,    -1,    13,    -1,    15,    -1,    11,
445       10,    -1,    10,    -1,    11,    -1,    -1,    -1,    16,    14,
446        6,    12,     7,    -1,    16,     4,    -1,    16,     3,     5,
447       -1,     5,    -1
448 };
449
450 /* YYRLINE[YYN] -- source line where rule number YYN was defined.  */
451 static const yytype_uint8 yyrline[] =
452 {
453        0,    50,    50,    52,    53,    56,    57,    60,    60,    62,
454       62,    64,    66,    67
455 };
456 #endif
457
458 #if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
459 /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
460    First, the terminals, then, starting at YYNTOKENS, nonterminals.  */
461 static const char *const yytname[] =
462 {
463   "$end", "error", "$undefined", "SEP", "DATA", "IDENT", "'{'", "'}'",
464   "$accept", "main", "decl", "decls", "dseq", "group", "@1", "option",
465   "path", 0
466 };
467 #endif
468
469 # ifdef YYPRINT
470 /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
471    token YYLEX-NUM.  */
472 static const yytype_uint16 yytoknum[] =
473 {
474        0,   256,   257,   258,   259,   260,   123,   125
475 };
476 # endif
477
478 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives.  */
479 static const yytype_uint8 yyr1[] =
480 {
481        0,     8,     9,    10,    10,    11,    11,    12,    12,    14,
482       13,    15,    16,    16
483 };
484
485 /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN.  */
486 static const yytype_uint8 yyr2[] =
487 {
488        0,     2,     1,     1,     1,     2,     1,     1,     0,     0,
489        5,     2,     3,     1
490 };
491
492 /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
493    STATE-NUM when YYTABLE doesn't specify something else to do.  Zero
494    means the default is an error.  */
495 static const yytype_uint8 yydefact[] =
496 {
497        8,    13,     0,     6,     7,     2,     3,     4,     9,     1,
498        5,     0,    11,     0,    12,     8,     0,    10
499 };
500
501 /* YYDEFGOTO[NTERM-NUM].  */
502 static const yytype_int8 yydefgoto[] =
503 {
504       -1,     2,     3,     4,     5,     6,    13,     7,     8
505 };
506
507 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
508    STATE-NUM.  */
509 #define YYPACT_NINF -11
510 static const yytype_int8 yypact[] =
511 {
512       -2,   -11,     2,   -11,    -2,   -11,   -11,   -11,    -3,   -11,
513      -11,    -1,   -11,     0,   -11,    -2,     1,   -11
514 };
515
516 /* YYPGOTO[NTERM-NUM].  */
517 static const yytype_int8 yypgoto[] =
518 {
519      -11,   -11,     3,   -11,   -10,   -11,   -11,   -11,   -11
520 };
521
522 /* YYTABLE[YYPACT[STATE-NUM]].  What to do in state STATE-NUM.  If
523    positive, shift that token.  If negative, reduce the rule which
524    number is the opposite.  If zero, do what YYDEFACT says.
525    If YYTABLE_NINF, syntax error.  */
526 #define YYTABLE_NINF -1
527 static const yytype_uint8 yytable[] =
528 {
529       11,    12,     9,     1,    14,    16,    15,    10,    17
530 };
531
532 static const yytype_uint8 yycheck[] =
533 {
534        3,     4,     0,     5,     5,    15,     6,     4,     7
535 };
536
537 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
538    symbol of state STATE-NUM.  */
539 static const yytype_uint8 yystos[] =
540 {
541        0,     5,     9,    10,    11,    12,    13,    15,    16,     0,
542       10,     3,     4,    14,     5,     6,    12,     7
543 };
544
545 #define yyerrok         (yyerrstatus = 0)
546 #define yyclearin       (yychar = YYEMPTY)
547 #define YYEMPTY         (-2)
548 #define YYEOF           0
549
550 #define YYACCEPT        goto yyacceptlab
551 #define YYABORT         goto yyabortlab
552 #define YYERROR         goto yyerrorlab
553
554
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.  */
558
559 #define YYFAIL          goto yyerrlab
560
561 #define YYRECOVERING()  (!!yyerrstatus)
562
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 (YY_("syntax error: cannot back up")); \
576       YYERROR;                                                  \
577     }                                                           \
578 while (YYID (0))
579
580
581 #define YYTERROR        1
582 #define YYERRCODE       256
583
584
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).  */
588
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
609
610
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.  */
614
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
625
626
627 /* YYLEX -- calling `yylex' with the right arguments.  */
628
629 #ifdef YYLEX_PARAM
630 # define YYLEX yylex (YYLEX_PARAM)
631 #else
632 # define YYLEX yylex ()
633 #endif
634
635 /* Enable debugging if requested.  */
636 #if YYDEBUG
637
638 # ifndef YYFPRINTF
639 #  include <stdio.h> /* INFRINGES ON USER NAME SPACE */
640 #  define YYFPRINTF fprintf
641 # endif
642
643 # define YYDPRINTF(Args)                        \
644 do {                                            \
645   if (yydebug)                                  \
646     YYFPRINTF Args;                             \
647 } while (YYID (0))
648
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); \
656       YYFPRINTF (stderr, "\n");                                           \
657     }                                                                     \
658 } while (YYID (0))
659
660
661 /*--------------------------------.
662 | Print this symbol on YYOUTPUT.  |
663 `--------------------------------*/
664
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)
670 #else
671 static void
672 yy_symbol_value_print (yyoutput, yytype, yyvaluep)
673     FILE *yyoutput;
674     int yytype;
675     YYSTYPE const * const yyvaluep;
676 #endif
677 {
678   if (!yyvaluep)
679     return;
680 # ifdef YYPRINT
681   if (yytype < YYNTOKENS)
682     YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
683 # else
684   YYUSE (yyoutput);
685 # endif
686   switch (yytype)
687     {
688       default:
689         break;
690     }
691 }
692
693
694 /*--------------------------------.
695 | Print this symbol on YYOUTPUT.  |
696 `--------------------------------*/
697
698 #if (defined __STDC__ || defined __C99__FUNC__ \
699      || defined __cplusplus || defined _MSC_VER)
700 static void
701 yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
702 #else
703 static void
704 yy_symbol_print (yyoutput, yytype, yyvaluep)
705     FILE *yyoutput;
706     int yytype;
707     YYSTYPE const * const yyvaluep;
708 #endif
709 {
710   if (yytype < YYNTOKENS)
711     YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
712   else
713     YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
714
715   yy_symbol_value_print (yyoutput, yytype, yyvaluep);
716   YYFPRINTF (yyoutput, ")");
717 }
718
719 /*------------------------------------------------------------------.
720 | yy_stack_print -- Print the state stack from its BOTTOM up to its |
721 | TOP (included).                                                   |
722 `------------------------------------------------------------------*/
723
724 #if (defined __STDC__ || defined __C99__FUNC__ \
725      || defined __cplusplus || defined _MSC_VER)
726 static void
727 yy_stack_print (yytype_int16 *bottom, yytype_int16 *top)
728 #else
729 static void
730 yy_stack_print (bottom, top)
731     yytype_int16 *bottom;
732     yytype_int16 *top;
733 #endif
734 {
735   YYFPRINTF (stderr, "Stack now");
736   for (; bottom <= top; ++bottom)
737     YYFPRINTF (stderr, " %d", *bottom);
738   YYFPRINTF (stderr, "\n");
739 }
740
741 # define YY_STACK_PRINT(Bottom, Top)                            \
742 do {                                                            \
743   if (yydebug)                                                  \
744     yy_stack_print ((Bottom), (Top));                           \
745 } while (YYID (0))
746
747
748 /*------------------------------------------------.
749 | Report that the YYRULE is going to be reduced.  |
750 `------------------------------------------------*/
751
752 #if (defined __STDC__ || defined __C99__FUNC__ \
753      || defined __cplusplus || defined _MSC_VER)
754 static void
755 yy_reduce_print (YYSTYPE *yyvsp, int yyrule)
756 #else
757 static void
758 yy_reduce_print (yyvsp, yyrule)
759     YYSTYPE *yyvsp;
760     int yyrule;
761 #endif
762 {
763   int yynrhs = yyr2[yyrule];
764   int yyi;
765   unsigned long int yylno = yyrline[yyrule];
766   YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
767              yyrule - 1, yylno);
768   /* The symbols being reduced.  */
769   for (yyi = 0; yyi < yynrhs; yyi++)
770     {
771       fprintf (stderr, "   $%d = ", yyi + 1);
772       yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi],
773                        &(yyvsp[(yyi + 1) - (yynrhs)])
774                                        );
775       fprintf (stderr, "\n");
776     }
777 }
778
779 # define YY_REDUCE_PRINT(Rule)          \
780 do {                                    \
781   if (yydebug)                          \
782     yy_reduce_print (yyvsp, Rule); \
783 } while (YYID (0))
784
785 /* Nonzero means print parse trace.  It is left uninitialized so that
786    multiple parsers can coexist.  */
787 int yydebug;
788 #else /* !YYDEBUG */
789 # define YYDPRINTF(Args)
790 # define YY_SYMBOL_PRINT(Title, Type, Value, Location)
791 # define YY_STACK_PRINT(Bottom, Top)
792 # define YY_REDUCE_PRINT(Rule)
793 #endif /* !YYDEBUG */
794
795
796 /* YYINITDEPTH -- initial size of the parser's stacks.  */
797 #ifndef YYINITDEPTH
798 # define YYINITDEPTH 200
799 #endif
800
801 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
802    if the built-in stack extension method is used).
803
804    Do not make this value too large; the results are undefined if
805    YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
806    evaluated with infinite-precision integer arithmetic.  */
807
808 #ifndef YYMAXDEPTH
809 # define YYMAXDEPTH 10000
810 #endif
811
812 \f
813
814 #if YYERROR_VERBOSE
815
816 # ifndef yystrlen
817 #  if defined __GLIBC__ && defined _STRING_H
818 #   define yystrlen strlen
819 #  else
820 /* Return the length of YYSTR.  */
821 #if (defined __STDC__ || defined __C99__FUNC__ \
822      || defined __cplusplus || defined _MSC_VER)
823 static YYSIZE_T
824 yystrlen (const char *yystr)
825 #else
826 static YYSIZE_T
827 yystrlen (yystr)
828     const char *yystr;
829 #endif
830 {
831   YYSIZE_T yylen;
832   for (yylen = 0; yystr[yylen]; yylen++)
833     continue;
834   return yylen;
835 }
836 #  endif
837 # endif
838
839 # ifndef yystpcpy
840 #  if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
841 #   define yystpcpy stpcpy
842 #  else
843 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
844    YYDEST.  */
845 #if (defined __STDC__ || defined __C99__FUNC__ \
846      || defined __cplusplus || defined _MSC_VER)
847 static char *
848 yystpcpy (char *yydest, const char *yysrc)
849 #else
850 static char *
851 yystpcpy (yydest, yysrc)
852     char *yydest;
853     const char *yysrc;
854 #endif
855 {
856   char *yyd = yydest;
857   const char *yys = yysrc;
858
859   while ((*yyd++ = *yys++) != '\0')
860     continue;
861
862   return yyd - 1;
863 }
864 #  endif
865 # endif
866
867 # ifndef yytnamerr
868 /* Copy to YYRES the contents of YYSTR after stripping away unnecessary
869    quotes and backslashes, so that it's suitable for yyerror.  The
870    heuristic is that double-quoting is unnecessary unless the string
871    contains an apostrophe, a comma, or backslash (other than
872    backslash-backslash).  YYSTR is taken from yytname.  If YYRES is
873    null, do not copy; instead, return the length of what the result
874    would have been.  */
875 static YYSIZE_T
876 yytnamerr (char *yyres, const char *yystr)
877 {
878   if (*yystr == '"')
879     {
880       YYSIZE_T yyn = 0;
881       char const *yyp = yystr;
882
883       for (;;)
884         switch (*++yyp)
885           {
886           case '\'':
887           case ',':
888             goto do_not_strip_quotes;
889
890           case '\\':
891             if (*++yyp != '\\')
892               goto do_not_strip_quotes;
893             /* Fall through.  */
894           default:
895             if (yyres)
896               yyres[yyn] = *yyp;
897             yyn++;
898             break;
899
900           case '"':
901             if (yyres)
902               yyres[yyn] = '\0';
903             return yyn;
904           }
905     do_not_strip_quotes: ;
906     }
907
908   if (! yyres)
909     return yystrlen (yystr);
910
911   return yystpcpy (yyres, yystr) - yyres;
912 }
913 # endif
914
915 /* Copy into YYRESULT an error message about the unexpected token
916    YYCHAR while in state YYSTATE.  Return the number of bytes copied,
917    including the terminating null byte.  If YYRESULT is null, do not
918    copy anything; just return the number of bytes that would be
919    copied.  As a special case, return 0 if an ordinary "syntax error"
920    message will do.  Return YYSIZE_MAXIMUM if overflow occurs during
921    size calculation.  */
922 static YYSIZE_T
923 yysyntax_error (char *yyresult, int yystate, int yychar)
924 {
925   int yyn = yypact[yystate];
926
927   if (! (YYPACT_NINF < yyn && yyn <= YYLAST))
928     return 0;
929   else
930     {
931       int yytype = YYTRANSLATE (yychar);
932       YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]);
933       YYSIZE_T yysize = yysize0;
934       YYSIZE_T yysize1;
935       int yysize_overflow = 0;
936       enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
937       char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
938       int yyx;
939
940 # if 0
941       /* This is so xgettext sees the translatable formats that are
942          constructed on the fly.  */
943       YY_("syntax error, unexpected %s");
944       YY_("syntax error, unexpected %s, expecting %s");
945       YY_("syntax error, unexpected %s, expecting %s or %s");
946       YY_("syntax error, unexpected %s, expecting %s or %s or %s");
947       YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s");
948 # endif
949       char *yyfmt;
950       char const *yyf;
951       static char const yyunexpected[] = "syntax error, unexpected %s";
952       static char const yyexpecting[] = ", expecting %s";
953       static char const yyor[] = " or %s";
954       char yyformat[sizeof yyunexpected
955                     + sizeof yyexpecting - 1
956                     + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2)
957                        * (sizeof yyor - 1))];
958       char const *yyprefix = yyexpecting;
959
960       /* Start YYX at -YYN if negative to avoid negative indexes in
961          YYCHECK.  */
962       int yyxbegin = yyn < 0 ? -yyn : 0;
963
964       /* Stay within bounds of both yycheck and yytname.  */
965       int yychecklim = YYLAST - yyn + 1;
966       int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
967       int yycount = 1;
968
969       yyarg[0] = yytname[yytype];
970       yyfmt = yystpcpy (yyformat, yyunexpected);
971
972       for (yyx = yyxbegin; yyx < yyxend; ++yyx)
973         if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
974           {
975             if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
976               {
977                 yycount = 1;
978                 yysize = yysize0;
979                 yyformat[sizeof yyunexpected - 1] = '\0';
980                 break;
981               }
982             yyarg[yycount++] = yytname[yyx];
983             yysize1 = yysize + yytnamerr (0, yytname[yyx]);
984             yysize_overflow |= (yysize1 < yysize);
985             yysize = yysize1;
986             yyfmt = yystpcpy (yyfmt, yyprefix);
987             yyprefix = yyor;
988           }
989
990       yyf = YY_(yyformat);
991       yysize1 = yysize + yystrlen (yyf);
992       yysize_overflow |= (yysize1 < yysize);
993       yysize = yysize1;
994
995       if (yysize_overflow)
996         return YYSIZE_MAXIMUM;
997
998       if (yyresult)
999         {
1000           /* Avoid sprintf, as that infringes on the user's name space.
1001              Don't have undefined behavior even if the translation
1002              produced a string with the wrong number of "%s"s.  */
1003           char *yyp = yyresult;
1004           int yyi = 0;
1005           while ((*yyp = *yyf) != '\0')
1006             {
1007               if (*yyp == '%' && yyf[1] == 's' && yyi < yycount)
1008                 {
1009                   yyp += yytnamerr (yyp, yyarg[yyi++]);
1010                   yyf += 2;
1011                 }
1012               else
1013                 {
1014                   yyp++;
1015                   yyf++;
1016                 }
1017             }
1018         }
1019       return yysize;
1020     }
1021 }
1022 #endif /* YYERROR_VERBOSE */
1023 \f
1024
1025 /*-----------------------------------------------.
1026 | Release the memory associated to this symbol.  |
1027 `-----------------------------------------------*/
1028
1029 /*ARGSUSED*/
1030 #if (defined __STDC__ || defined __C99__FUNC__ \
1031      || defined __cplusplus || defined _MSC_VER)
1032 static void
1033 yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep)
1034 #else
1035 static void
1036 yydestruct (yymsg, yytype, yyvaluep)
1037     const char *yymsg;
1038     int yytype;
1039     YYSTYPE *yyvaluep;
1040 #endif
1041 {
1042   YYUSE (yyvaluep);
1043
1044   if (!yymsg)
1045     yymsg = "Deleting";
1046   YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
1047
1048   switch (yytype)
1049     {
1050
1051       default:
1052         break;
1053     }
1054 }
1055 \f
1056
1057 /* Prevent warnings from -Wmissing-prototypes.  */
1058
1059 #ifdef YYPARSE_PARAM
1060 #if defined __STDC__ || defined __cplusplus
1061 int yyparse (void *YYPARSE_PARAM);
1062 #else
1063 int yyparse ();
1064 #endif
1065 #else /* ! YYPARSE_PARAM */
1066 #if defined __STDC__ || defined __cplusplus
1067 int yyparse (void);
1068 #else
1069 int yyparse ();
1070 #endif
1071 #endif /* ! YYPARSE_PARAM */
1072
1073
1074
1075 /* The look-ahead symbol.  */
1076 int yychar;
1077
1078 /* The semantic value of the look-ahead symbol.  */
1079 YYSTYPE yylval;
1080
1081 /* Number of syntax errors so far.  */
1082 int yynerrs;
1083
1084
1085
1086 /*----------.
1087 | yyparse.  |
1088 `----------*/
1089
1090 #ifdef YYPARSE_PARAM
1091 #if (defined __STDC__ || defined __C99__FUNC__ \
1092      || defined __cplusplus || defined _MSC_VER)
1093 int
1094 yyparse (void *YYPARSE_PARAM)
1095 #else
1096 int
1097 yyparse (YYPARSE_PARAM)
1098     void *YYPARSE_PARAM;
1099 #endif
1100 #else /* ! YYPARSE_PARAM */
1101 #if (defined __STDC__ || defined __C99__FUNC__ \
1102      || defined __cplusplus || defined _MSC_VER)
1103 int
1104 yyparse (void)
1105 #else
1106 int
1107 yyparse ()
1108
1109 #endif
1110 #endif
1111 {
1112
1113   int yystate;
1114   int yyn;
1115   int yyresult;
1116   /* Number of tokens to shift before error messages enabled.  */
1117   int yyerrstatus;
1118   /* Look-ahead token as an internal (translated) token number.  */
1119   int yytoken = 0;
1120 #if YYERROR_VERBOSE
1121   /* Buffer for error messages, and its allocated size.  */
1122   char yymsgbuf[128];
1123   char *yymsg = yymsgbuf;
1124   YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
1125 #endif
1126
1127   /* Three stacks and their tools:
1128      `yyss': related to states,
1129      `yyvs': related to semantic values,
1130      `yyls': related to locations.
1131
1132      Refer to the stacks thru separate pointers, to allow yyoverflow
1133      to reallocate them elsewhere.  */
1134
1135   /* The state stack.  */
1136   yytype_int16 yyssa[YYINITDEPTH];
1137   yytype_int16 *yyss = yyssa;
1138   yytype_int16 *yyssp;
1139
1140   /* The semantic value stack.  */
1141   YYSTYPE yyvsa[YYINITDEPTH];
1142   YYSTYPE *yyvs = yyvsa;
1143   YYSTYPE *yyvsp;
1144
1145
1146
1147 #define YYPOPSTACK(N)   (yyvsp -= (N), yyssp -= (N))
1148
1149   YYSIZE_T yystacksize = YYINITDEPTH;
1150
1151   /* The variables used to return semantic value and location from the
1152      action routines.  */
1153   YYSTYPE yyval;
1154
1155
1156   /* The number of symbols on the RHS of the reduced rule.
1157      Keep to zero when no symbol should be popped.  */
1158   int yylen = 0;
1159
1160   YYDPRINTF ((stderr, "Starting parse\n"));
1161
1162   yystate = 0;
1163   yyerrstatus = 0;
1164   yynerrs = 0;
1165   yychar = YYEMPTY;             /* Cause a token to be read.  */
1166
1167   /* Initialize stack pointers.
1168      Waste one element of value and location stack
1169      so that they stay on the same level as the state stack.
1170      The wasted elements are never initialized.  */
1171
1172   yyssp = yyss;
1173   yyvsp = yyvs;
1174
1175   goto yysetstate;
1176
1177 /*------------------------------------------------------------.
1178 | yynewstate -- Push a new state, which is found in yystate.  |
1179 `------------------------------------------------------------*/
1180  yynewstate:
1181   /* In all cases, when you get here, the value and location stacks
1182      have just been pushed.  So pushing a state here evens the stacks.  */
1183   yyssp++;
1184
1185  yysetstate:
1186   *yyssp = yystate;
1187
1188   if (yyss + yystacksize - 1 <= yyssp)
1189     {
1190       /* Get the current used size of the three stacks, in elements.  */
1191       YYSIZE_T yysize = yyssp - yyss + 1;
1192
1193 #ifdef yyoverflow
1194       {
1195         /* Give user a chance to reallocate the stack.  Use copies of
1196            these so that the &'s don't force the real ones into
1197            memory.  */
1198         YYSTYPE *yyvs1 = yyvs;
1199         yytype_int16 *yyss1 = yyss;
1200
1201
1202         /* Each stack pointer address is followed by the size of the
1203            data in use in that stack, in bytes.  This used to be a
1204            conditional around just the two extra args, but that might
1205            be undefined if yyoverflow is a macro.  */
1206         yyoverflow (YY_("memory exhausted"),
1207                     &yyss1, yysize * sizeof (*yyssp),
1208                     &yyvs1, yysize * sizeof (*yyvsp),
1209
1210                     &yystacksize);
1211
1212         yyss = yyss1;
1213         yyvs = yyvs1;
1214       }
1215 #else /* no yyoverflow */
1216 # ifndef YYSTACK_RELOCATE
1217       goto yyexhaustedlab;
1218 # else
1219       /* Extend the stack our own way.  */
1220       if (YYMAXDEPTH <= yystacksize)
1221         goto yyexhaustedlab;
1222       yystacksize *= 2;
1223       if (YYMAXDEPTH < yystacksize)
1224         yystacksize = YYMAXDEPTH;
1225
1226       {
1227         yytype_int16 *yyss1 = yyss;
1228         union yyalloc *yyptr =
1229           (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
1230         if (! yyptr)
1231           goto yyexhaustedlab;
1232         YYSTACK_RELOCATE (yyss);
1233         YYSTACK_RELOCATE (yyvs);
1234
1235 #  undef YYSTACK_RELOCATE
1236         if (yyss1 != yyssa)
1237           YYSTACK_FREE (yyss1);
1238       }
1239 # endif
1240 #endif /* no yyoverflow */
1241
1242       yyssp = yyss + yysize - 1;
1243       yyvsp = yyvs + yysize - 1;
1244
1245
1246       YYDPRINTF ((stderr, "Stack size increased to %lu\n",
1247                   (unsigned long int) yystacksize));
1248
1249       if (yyss + yystacksize - 1 <= yyssp)
1250         YYABORT;
1251     }
1252
1253   YYDPRINTF ((stderr, "Entering state %d\n", yystate));
1254
1255   goto yybackup;
1256
1257 /*-----------.
1258 | yybackup.  |
1259 `-----------*/
1260 yybackup:
1261
1262   /* Do appropriate processing given the current state.  Read a
1263      look-ahead token if we need one and don't already have one.  */
1264
1265   /* First try to decide what to do without reference to look-ahead token.  */
1266   yyn = yypact[yystate];
1267   if (yyn == YYPACT_NINF)
1268     goto yydefault;
1269
1270   /* Not known => get a look-ahead token if don't already have one.  */
1271
1272   /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol.  */
1273   if (yychar == YYEMPTY)
1274     {
1275       YYDPRINTF ((stderr, "Reading a token: "));
1276       yychar = YYLEX;
1277     }
1278
1279   if (yychar <= YYEOF)
1280     {
1281       yychar = yytoken = YYEOF;
1282       YYDPRINTF ((stderr, "Now at end of input.\n"));
1283     }
1284   else
1285     {
1286       yytoken = YYTRANSLATE (yychar);
1287       YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
1288     }
1289
1290   /* If the proper action on seeing token YYTOKEN is to reduce or to
1291      detect an error, take that action.  */
1292   yyn += yytoken;
1293   if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
1294     goto yydefault;
1295   yyn = yytable[yyn];
1296   if (yyn <= 0)
1297     {
1298       if (yyn == 0 || yyn == YYTABLE_NINF)
1299         goto yyerrlab;
1300       yyn = -yyn;
1301       goto yyreduce;
1302     }
1303
1304   if (yyn == YYFINAL)
1305     YYACCEPT;
1306
1307   /* Count tokens shifted since error; after three, turn off error
1308      status.  */
1309   if (yyerrstatus)
1310     yyerrstatus--;
1311
1312   /* Shift the look-ahead token.  */
1313   YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
1314
1315   /* Discard the shifted token unless it is eof.  */
1316   if (yychar != YYEOF)
1317     yychar = YYEMPTY;
1318
1319   yystate = yyn;
1320   *++yyvsp = yylval;
1321
1322   goto yynewstate;
1323
1324
1325 /*-----------------------------------------------------------.
1326 | yydefault -- do the default action for the current state.  |
1327 `-----------------------------------------------------------*/
1328 yydefault:
1329   yyn = yydefact[yystate];
1330   if (yyn == 0)
1331     goto yyerrlab;
1332   goto yyreduce;
1333
1334
1335 /*-----------------------------.
1336 | yyreduce -- Do a reduction.  |
1337 `-----------------------------*/
1338 yyreduce:
1339   /* yyn is the number of a rule to reduce with.  */
1340   yylen = yyr2[yyn];
1341
1342   /* If YYLEN is nonzero, implement the default value of the action:
1343      `$$ = $1'.
1344
1345      Otherwise, the following line sets YYVAL to garbage.
1346      This behavior is undocumented and Bison
1347      users should not rely upon it.  Assigning to YYVAL
1348      unconditionally makes the parser a bit smaller, and it avoids a
1349      GCC warning that YYVAL may be used uninitialized.  */
1350   yyval = yyvsp[1-yylen];
1351
1352
1353   YY_REDUCE_PRINT (yyn);
1354   switch (yyn)
1355     {
1356         case 9:
1357
1358     { group_open(); ;}
1359     break;
1360
1361   case 10:
1362
1363     { group_close(); ;}
1364     break;
1365
1366   case 11:
1367
1368     { lc_opt_set(); ;}
1369     break;
1370
1371   case 12:
1372
1373     { path_push((yyvsp[(3) - (3)].text)); ;}
1374     break;
1375
1376   case 13:
1377
1378     { path_push((yyvsp[(1) - (1)].text)); ;}
1379     break;
1380
1381
1382 /* Line 1267 of yacc.c.  */
1383
1384       default: break;
1385     }
1386   YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
1387
1388   YYPOPSTACK (yylen);
1389   yylen = 0;
1390   YY_STACK_PRINT (yyss, yyssp);
1391
1392   *++yyvsp = yyval;
1393
1394
1395   /* Now `shift' the result of the reduction.  Determine what state
1396      that goes to, based on the state we popped back to and the rule
1397      number reduced by.  */
1398
1399   yyn = yyr1[yyn];
1400
1401   yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
1402   if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
1403     yystate = yytable[yystate];
1404   else
1405     yystate = yydefgoto[yyn - YYNTOKENS];
1406
1407   goto yynewstate;
1408
1409
1410 /*------------------------------------.
1411 | yyerrlab -- here on detecting error |
1412 `------------------------------------*/
1413 yyerrlab:
1414   /* If not already recovering from an error, report this error.  */
1415   if (!yyerrstatus)
1416     {
1417       ++yynerrs;
1418 #if ! YYERROR_VERBOSE
1419       yyerror (YY_("syntax error"));
1420 #else
1421       {
1422         YYSIZE_T yysize = yysyntax_error (0, yystate, yychar);
1423         if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM)
1424           {
1425             YYSIZE_T yyalloc = 2 * yysize;
1426             if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM))
1427               yyalloc = YYSTACK_ALLOC_MAXIMUM;
1428             if (yymsg != yymsgbuf)
1429               YYSTACK_FREE (yymsg);
1430             yymsg = (char *) YYSTACK_ALLOC (yyalloc);
1431             if (yymsg)
1432               yymsg_alloc = yyalloc;
1433             else
1434               {
1435                 yymsg = yymsgbuf;
1436                 yymsg_alloc = sizeof yymsgbuf;
1437               }
1438           }
1439
1440         if (0 < yysize && yysize <= yymsg_alloc)
1441           {
1442             (void) yysyntax_error (yymsg, yystate, yychar);
1443             yyerror (yymsg);
1444           }
1445         else
1446           {
1447             yyerror (YY_("syntax error"));
1448             if (yysize != 0)
1449               goto yyexhaustedlab;
1450           }
1451       }
1452 #endif
1453     }
1454
1455
1456
1457   if (yyerrstatus == 3)
1458     {
1459       /* If just tried and failed to reuse look-ahead token after an
1460          error, discard it.  */
1461
1462       if (yychar <= YYEOF)
1463         {
1464           /* Return failure if at end of input.  */
1465           if (yychar == YYEOF)
1466             YYABORT;
1467         }
1468       else
1469         {
1470           yydestruct ("Error: discarding",
1471                       yytoken, &yylval);
1472           yychar = YYEMPTY;
1473         }
1474     }
1475
1476   /* Else will try to reuse look-ahead token after shifting the error
1477      token.  */
1478   goto yyerrlab1;
1479
1480
1481 /*---------------------------------------------------.
1482 | yyerrorlab -- error raised explicitly by YYERROR.  |
1483 `---------------------------------------------------*/
1484 yyerrorlab:
1485
1486   /* Pacify compilers like GCC when the user code never invokes
1487      YYERROR and the label yyerrorlab therefore never appears in user
1488      code.  */
1489   if (/*CONSTCOND*/ 0)
1490      goto yyerrorlab;
1491
1492   /* Do not reclaim the symbols of the rule which action triggered
1493      this YYERROR.  */
1494   YYPOPSTACK (yylen);
1495   yylen = 0;
1496   YY_STACK_PRINT (yyss, yyssp);
1497   yystate = *yyssp;
1498   goto yyerrlab1;
1499
1500
1501 /*-------------------------------------------------------------.
1502 | yyerrlab1 -- common code for both syntax error and YYERROR.  |
1503 `-------------------------------------------------------------*/
1504 yyerrlab1:
1505   yyerrstatus = 3;      /* Each real token shifted decrements this.  */
1506
1507   for (;;)
1508     {
1509       yyn = yypact[yystate];
1510       if (yyn != YYPACT_NINF)
1511         {
1512           yyn += YYTERROR;
1513           if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
1514             {
1515               yyn = yytable[yyn];
1516               if (0 < yyn)
1517                 break;
1518             }
1519         }
1520
1521       /* Pop the current state because it cannot handle the error token.  */
1522       if (yyssp == yyss)
1523         YYABORT;
1524
1525
1526       yydestruct ("Error: popping",
1527                   yystos[yystate], yyvsp);
1528       YYPOPSTACK (1);
1529       yystate = *yyssp;
1530       YY_STACK_PRINT (yyss, yyssp);
1531     }
1532
1533   if (yyn == YYFINAL)
1534     YYACCEPT;
1535
1536   *++yyvsp = yylval;
1537
1538
1539   /* Shift the error token.  */
1540   YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
1541
1542   yystate = yyn;
1543   goto yynewstate;
1544
1545
1546 /*-------------------------------------.
1547 | yyacceptlab -- YYACCEPT comes here.  |
1548 `-------------------------------------*/
1549 yyacceptlab:
1550   yyresult = 0;
1551   goto yyreturn;
1552
1553 /*-----------------------------------.
1554 | yyabortlab -- YYABORT comes here.  |
1555 `-----------------------------------*/
1556 yyabortlab:
1557   yyresult = 1;
1558   goto yyreturn;
1559
1560 #ifndef yyoverflow
1561 /*-------------------------------------------------.
1562 | yyexhaustedlab -- memory exhaustion comes here.  |
1563 `-------------------------------------------------*/
1564 yyexhaustedlab:
1565   yyerror (YY_("memory exhausted"));
1566   yyresult = 2;
1567   /* Fall through.  */
1568 #endif
1569
1570 yyreturn:
1571   if (yychar != YYEOF && yychar != YYEMPTY)
1572      yydestruct ("Cleanup: discarding lookahead",
1573                  yytoken, &yylval);
1574   /* Do not reclaim the symbols of the rule which action triggered
1575      this YYABORT or YYACCEPT.  */
1576   YYPOPSTACK (yylen);
1577   YY_STACK_PRINT (yyss, yyssp);
1578   while (yyssp != yyss)
1579     {
1580       yydestruct ("Cleanup: popping",
1581                   yystos[*yyssp], yyvsp);
1582       YYPOPSTACK (1);
1583     }
1584 #ifndef yyoverflow
1585   if (yyss != yyssa)
1586     YYSTACK_FREE (yyss);
1587 #endif
1588 #if YYERROR_VERBOSE
1589   if (yymsg != yymsgbuf)
1590     YYSTACK_FREE (yymsg);
1591 #endif
1592   /* Make sure YYID is used.  */
1593   return YYID (yyresult);
1594 }
1595
1596
1597
1598
1599
1600 static lc_opt_error_handler_t *handler;
1601 static struct obstack obst;
1602 const char *optfilename = "";
1603
1604 void PMANGLE(error)(const char *str)
1605 {
1606         fprintf(stderr, "At line %d: %s\n", PMANGLE(linenr), str);
1607 }
1608
1609 static const char *path_stack[128];
1610 static int path_sp = 0;
1611
1612 static lc_opt_entry_t *grp_stack[128];
1613 static int grp_sp = 0;
1614 #define CURR_GRP (grp_stack[grp_sp - 1])
1615
1616 void lc_opt_init_parser(const char *filename, lc_opt_error_handler_t *err_handler)
1617 {
1618         PMANGLE(linenr) = 1;
1619         obstack_init(&obst);
1620         handler = err_handler;
1621         optfilename = filename;
1622         grp_stack[grp_sp++] = lc_opt_root_grp();
1623 }
1624
1625 void _lc_opt_add_to_data_char(char c)
1626 {
1627         obstack_1grow(&obst, c);
1628 }
1629
1630 static void path_push(text_t text)
1631 {
1632         obstack_grow0(&obst, text.str, text.len);
1633         path_stack[path_sp++] = obstack_finish(&obst);
1634 }
1635
1636 static void path_free(void)
1637 {
1638         obstack_free(&obst, (void *) path_stack[0]);
1639         path_sp = 0;
1640 }
1641
1642 static void group_open(void)
1643 {
1644         lc_opt_err_info_t err;
1645         lc_opt_entry_t *grp = lc_opt_resolve_grp(CURR_GRP, path_stack, path_sp, &err);
1646
1647         path_free();
1648
1649         grp_stack[grp_sp++] = grp;
1650 }
1651
1652 static void group_close(void)
1653 {
1654         grp_sp--;
1655 }
1656
1657 static void lc_opt_set(void)
1658 {
1659         char *str = obstack_finish(&obst);
1660
1661         lc_opt_err_info_t err;
1662         lc_opt_entry_t *opt = lc_opt_resolve_opt(CURR_GRP, path_stack, path_sp, &err);
1663         lc_opt_raise_error(&err, handler, "At %s(%d): ", optfilename, PMANGLE(linenr));
1664
1665         lc_opt_occurs(opt, str, &err);
1666         lc_opt_raise_error(&err, handler, "At %s(%d): ", optfilename, PMANGLE(linenr));
1667
1668         obstack_free(&obst, str);
1669         path_free();
1670 }