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