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