update for win32 compatibility
[libfirm] / ir / libcore / lc_config_parser.c
1
2 /* A Bison parser, made by GNU Bison 2.4.1.  */
3
4 /* Skeleton implementation for Bison's Yacc-like parsers in C
5
6       Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
7    Free Software Foundation, Inc.
8
9    This program is free software: you can redistribute it and/or modify
10    it under the terms of the GNU General Public License as published by
11    the Free Software Foundation, either version 3 of the License, or
12    (at your option) any later version.
13
14    This program is distributed in the hope that it will be useful,
15    but WITHOUT ANY WARRANTY; without even the implied warranty of
16    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17    GNU General Public License for more details.
18
19    You should have received a copy of the GNU General Public License
20    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
21
22 /* As a special exception, you may create a larger work that contains
23    part or all of the Bison parser skeleton and distribute that work
24    under terms of your choice, so long as that work isn't itself a
25    parser generator using the skeleton or a modified version thereof
26    as a parser skeleton.  Alternatively, if you modify or redistribute
27    the parser skeleton itself, you may (at your option) remove this
28    special exception, which will cause the skeleton and the resulting
29    Bison output files to be licensed under the GNU General Public
30    License without this special exception.
31
32    This special exception was added by the Free Software Foundation in
33    version 2.2 of Bison.  */
34
35 /* C LALR(1) parser skeleton written by Richard Stallman, by
36    simplifying the original so-called "semantic" parser.  */
37
38 /* All symbols defined below should begin with yy or YY, to avoid
39    infringing on user name space.  This should be done even for local
40    variables, as they might otherwise be expanded by user macros.
41    There are some unavoidable exceptions within include files to
42    define necessary library symbols; they are noted "INFRINGES ON
43    USER NAME SPACE" below.  */
44
45 /* Identify Bison output.  */
46 #define YYBISON 1
47
48 /* Bison version.  */
49 #define YYBISON_VERSION "2.4.1"
50
51 /* Skeleton name.  */
52 #define YYSKELETON_NAME "yacc.c"
53
54 /* Pure parsers.  */
55 #define YYPURE 0
56
57 /* Push parsers.  */
58 #define YYPUSH 0
59
60 /* Pull parsers.  */
61 #define YYPULL 1
62
63 /* Using locations.  */
64 #define YYLSP_NEEDED 0
65
66 /* Substitute the variable and function names.  */
67 #define yyparse         _lc_opt_parse
68 #define yylex           _lc_opt_lex
69 #define yyerror         _lc_opt_error
70 #define yylval          _lc_opt_lval
71 #define yychar          _lc_opt_char
72 #define yydebug         _lc_opt_debug
73 #define yynerrs         _lc_opt_nerrs
74
75
76 /* Copy the first part of user declarations.  */
77
78
79
80 /*
81   libcore: library for basic data structures and algorithms.
82   Copyright (C) 2005  IPD Goos, Universit"at Karlsruhe, Germany
83
84   This library is free software; you can redistribute it and/or
85   modify it under the terms of the GNU Lesser General Public
86   License as published by the Free Software Foundation; either
87   version 2.1 of the License, or (at your option) any later version.
88
89   This library is distributed in the hope that it will be useful,
90   but WITHOUT ANY WARRANTY; without even the implied warranty of
91   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
92   Lesser General Public License for more details.
93
94   You should have received a copy of the GNU Lesser General Public
95   License along with this library; if not, write to the Free Software
96   Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
97 */
98 #ifdef HAVE_CONFIG_H
99 #include "config.h"
100 #endif
101
102 #include <string.h>
103
104 #include "lc_opts_t.h"
105 #include "lc_parser_t.h"
106
107 static void group_open(void);
108 static void group_close(void);
109 static void lc_opt_set(void);
110 static void path_push(text_t text);
111
112 void PMANGLE(error)(const char *str);
113 int PMANGLE(linenr);
114
115
116
117
118 /* Enabling traces.  */
119 #ifndef YYDEBUG
120 # define YYDEBUG 0
121 #endif
122
123 /* Enabling verbose error messages.  */
124 #ifdef YYERROR_VERBOSE
125 # undef YYERROR_VERBOSE
126 # define YYERROR_VERBOSE 1
127 #else
128 # define YYERROR_VERBOSE 0
129 #endif
130
131 /* Enabling the token table.  */
132 #ifndef YYTOKEN_TABLE
133 # define YYTOKEN_TABLE 0
134 #endif
135
136
137 /* Tokens.  */
138 #ifndef YYTOKENTYPE
139 # define YYTOKENTYPE
140    /* Put the tokens into the symbol table, so that GDB and other debuggers
141       know about them.  */
142    enum yytokentype {
143      SEP = 258,
144      DATA = 259,
145      IDENT = 260
146    };
147 #endif
148
149
150
151 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
152 typedef union YYSTYPE
153 {
154
155
156         text_t text;
157         int num;
158
159
160
161 } YYSTYPE;
162 # define YYSTYPE_IS_TRIVIAL 1
163 # define yystype YYSTYPE /* obsolescent; will be withdrawn */
164 # define YYSTYPE_IS_DECLARED 1
165 #endif
166
167
168 /* Copy the second part of user declarations.  */
169
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 yyi)
246 #else
247 static int
248 YYID (yyi)
249     int yyi;
250 #endif
251 {
252   return yyi;
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_alloc;
334   YYSTYPE yyvs_alloc;
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_alloc, Stack)                           \
370     do                                                                  \
371       {                                                                 \
372         YYSIZE_T yynewbytes;                                            \
373         YYCOPY (&yyptr->Stack_alloc, Stack, yysize);                    \
374         Stack = &yyptr->Stack_alloc;                                    \
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 *yybottom, yytype_int16 *yytop)
731 #else
732 static void
733 yy_stack_print (yybottom, yytop)
734     yytype_int16 *yybottom;
735     yytype_int16 *yytop;
736 #endif
737 {
738   YYFPRINTF (stderr, "Stack now");
739   for (; yybottom <= yytop; yybottom++)
740     {
741       int yybot = *yybottom;
742       YYFPRINTF (stderr, " %d", yybot);
743     }
744   YYFPRINTF (stderr, "\n");
745 }
746
747 # define YY_STACK_PRINT(Bottom, Top)                            \
748 do {                                                            \
749   if (yydebug)                                                  \
750     yy_stack_print ((Bottom), (Top));                           \
751 } while (YYID (0))
752
753
754 /*------------------------------------------------.
755 | Report that the YYRULE is going to be reduced.  |
756 `------------------------------------------------*/
757
758 #if (defined __STDC__ || defined __C99__FUNC__ \
759      || defined __cplusplus || defined _MSC_VER)
760 static void
761 yy_reduce_print (YYSTYPE *yyvsp, int yyrule)
762 #else
763 static void
764 yy_reduce_print (yyvsp, yyrule)
765     YYSTYPE *yyvsp;
766     int yyrule;
767 #endif
768 {
769   int yynrhs = yyr2[yyrule];
770   int yyi;
771   unsigned long int yylno = yyrline[yyrule];
772   YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
773              yyrule - 1, yylno);
774   /* The symbols being reduced.  */
775   for (yyi = 0; yyi < yynrhs; yyi++)
776     {
777       YYFPRINTF (stderr, "   $%d = ", yyi + 1);
778       yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi],
779                        &(yyvsp[(yyi + 1) - (yynrhs)])
780                                        );
781       YYFPRINTF (stderr, "\n");
782     }
783 }
784
785 # define YY_REDUCE_PRINT(Rule)          \
786 do {                                    \
787   if (yydebug)                          \
788     yy_reduce_print (yyvsp, Rule); \
789 } while (YYID (0))
790
791 /* Nonzero means print parse trace.  It is left uninitialized so that
792    multiple parsers can coexist.  */
793 int yydebug;
794 #else /* !YYDEBUG */
795 # define YYDPRINTF(Args)
796 # define YY_SYMBOL_PRINT(Title, Type, Value, Location)
797 # define YY_STACK_PRINT(Bottom, Top)
798 # define YY_REDUCE_PRINT(Rule)
799 #endif /* !YYDEBUG */
800
801
802 /* YYINITDEPTH -- initial size of the parser's stacks.  */
803 #ifndef YYINITDEPTH
804 # define YYINITDEPTH 200
805 #endif
806
807 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
808    if the built-in stack extension method is used).
809
810    Do not make this value too large; the results are undefined if
811    YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
812    evaluated with infinite-precision integer arithmetic.  */
813
814 #ifndef YYMAXDEPTH
815 # define YYMAXDEPTH 10000
816 #endif
817
818 \f
819
820 #if YYERROR_VERBOSE
821
822 # ifndef yystrlen
823 #  if defined __GLIBC__ && defined _STRING_H
824 #   define yystrlen strlen
825 #  else
826 /* Return the length of YYSTR.  */
827 #if (defined __STDC__ || defined __C99__FUNC__ \
828      || defined __cplusplus || defined _MSC_VER)
829 static YYSIZE_T
830 yystrlen (const char *yystr)
831 #else
832 static YYSIZE_T
833 yystrlen (yystr)
834     const char *yystr;
835 #endif
836 {
837   YYSIZE_T yylen;
838   for (yylen = 0; yystr[yylen]; yylen++)
839     continue;
840   return yylen;
841 }
842 #  endif
843 # endif
844
845 # ifndef yystpcpy
846 #  if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
847 #   define yystpcpy stpcpy
848 #  else
849 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
850    YYDEST.  */
851 #if (defined __STDC__ || defined __C99__FUNC__ \
852      || defined __cplusplus || defined _MSC_VER)
853 static char *
854 yystpcpy (char *yydest, const char *yysrc)
855 #else
856 static char *
857 yystpcpy (yydest, yysrc)
858     char *yydest;
859     const char *yysrc;
860 #endif
861 {
862   char *yyd = yydest;
863   const char *yys = yysrc;
864
865   while ((*yyd++ = *yys++) != '\0')
866     continue;
867
868   return yyd - 1;
869 }
870 #  endif
871 # endif
872
873 # ifndef yytnamerr
874 /* Copy to YYRES the contents of YYSTR after stripping away unnecessary
875    quotes and backslashes, so that it's suitable for yyerror.  The
876    heuristic is that double-quoting is unnecessary unless the string
877    contains an apostrophe, a comma, or backslash (other than
878    backslash-backslash).  YYSTR is taken from yytname.  If YYRES is
879    null, do not copy; instead, return the length of what the result
880    would have been.  */
881 static YYSIZE_T
882 yytnamerr (char *yyres, const char *yystr)
883 {
884   if (*yystr == '"')
885     {
886       YYSIZE_T yyn = 0;
887       char const *yyp = yystr;
888
889       for (;;)
890         switch (*++yyp)
891           {
892           case '\'':
893           case ',':
894             goto do_not_strip_quotes;
895
896           case '\\':
897             if (*++yyp != '\\')
898               goto do_not_strip_quotes;
899             /* Fall through.  */
900           default:
901             if (yyres)
902               yyres[yyn] = *yyp;
903             yyn++;
904             break;
905
906           case '"':
907             if (yyres)
908               yyres[yyn] = '\0';
909             return yyn;
910           }
911     do_not_strip_quotes: ;
912     }
913
914   if (! yyres)
915     return yystrlen (yystr);
916
917   return yystpcpy (yyres, yystr) - yyres;
918 }
919 # endif
920
921 /* Copy into YYRESULT an error message about the unexpected token
922    YYCHAR while in state YYSTATE.  Return the number of bytes copied,
923    including the terminating null byte.  If YYRESULT is null, do not
924    copy anything; just return the number of bytes that would be
925    copied.  As a special case, return 0 if an ordinary "syntax error"
926    message will do.  Return YYSIZE_MAXIMUM if overflow occurs during
927    size calculation.  */
928 static YYSIZE_T
929 yysyntax_error (char *yyresult, int yystate, int yychar)
930 {
931   int yyn = yypact[yystate];
932
933   if (! (YYPACT_NINF < yyn && yyn <= YYLAST))
934     return 0;
935   else
936     {
937       int yytype = YYTRANSLATE (yychar);
938       YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]);
939       YYSIZE_T yysize = yysize0;
940       YYSIZE_T yysize1;
941       int yysize_overflow = 0;
942       enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
943       char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
944       int yyx;
945
946 # if 0
947       /* This is so xgettext sees the translatable formats that are
948          constructed on the fly.  */
949       YY_("syntax error, unexpected %s");
950       YY_("syntax error, unexpected %s, expecting %s");
951       YY_("syntax error, unexpected %s, expecting %s or %s");
952       YY_("syntax error, unexpected %s, expecting %s or %s or %s");
953       YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s");
954 # endif
955       char *yyfmt;
956       char const *yyf;
957       static char const yyunexpected[] = "syntax error, unexpected %s";
958       static char const yyexpecting[] = ", expecting %s";
959       static char const yyor[] = " or %s";
960       char yyformat[sizeof yyunexpected
961                     + sizeof yyexpecting - 1
962                     + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2)
963                        * (sizeof yyor - 1))];
964       char const *yyprefix = yyexpecting;
965
966       /* Start YYX at -YYN if negative to avoid negative indexes in
967          YYCHECK.  */
968       int yyxbegin = yyn < 0 ? -yyn : 0;
969
970       /* Stay within bounds of both yycheck and yytname.  */
971       int yychecklim = YYLAST - yyn + 1;
972       int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
973       int yycount = 1;
974
975       yyarg[0] = yytname[yytype];
976       yyfmt = yystpcpy (yyformat, yyunexpected);
977
978       for (yyx = yyxbegin; yyx < yyxend; ++yyx)
979         if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
980           {
981             if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
982               {
983                 yycount = 1;
984                 yysize = yysize0;
985                 yyformat[sizeof yyunexpected - 1] = '\0';
986                 break;
987               }
988             yyarg[yycount++] = yytname[yyx];
989             yysize1 = yysize + yytnamerr (0, yytname[yyx]);
990             yysize_overflow |= (yysize1 < yysize);
991             yysize = yysize1;
992             yyfmt = yystpcpy (yyfmt, yyprefix);
993             yyprefix = yyor;
994           }
995
996       yyf = YY_(yyformat);
997       yysize1 = yysize + yystrlen (yyf);
998       yysize_overflow |= (yysize1 < yysize);
999       yysize = yysize1;
1000
1001       if (yysize_overflow)
1002         return YYSIZE_MAXIMUM;
1003
1004       if (yyresult)
1005         {
1006           /* Avoid sprintf, as that infringes on the user's name space.
1007              Don't have undefined behavior even if the translation
1008              produced a string with the wrong number of "%s"s.  */
1009           char *yyp = yyresult;
1010           int yyi = 0;
1011           while ((*yyp = *yyf) != '\0')
1012             {
1013               if (*yyp == '%' && yyf[1] == 's' && yyi < yycount)
1014                 {
1015                   yyp += yytnamerr (yyp, yyarg[yyi++]);
1016                   yyf += 2;
1017                 }
1018               else
1019                 {
1020                   yyp++;
1021                   yyf++;
1022                 }
1023             }
1024         }
1025       return yysize;
1026     }
1027 }
1028 #endif /* YYERROR_VERBOSE */
1029 \f
1030
1031 /*-----------------------------------------------.
1032 | Release the memory associated to this symbol.  |
1033 `-----------------------------------------------*/
1034
1035 /*ARGSUSED*/
1036 #if (defined __STDC__ || defined __C99__FUNC__ \
1037      || defined __cplusplus || defined _MSC_VER)
1038 static void
1039 yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep)
1040 #else
1041 static void
1042 yydestruct (yymsg, yytype, yyvaluep)
1043     const char *yymsg;
1044     int yytype;
1045     YYSTYPE *yyvaluep;
1046 #endif
1047 {
1048   YYUSE (yyvaluep);
1049
1050   if (!yymsg)
1051     yymsg = "Deleting";
1052   YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
1053
1054   switch (yytype)
1055     {
1056
1057       default:
1058         break;
1059     }
1060 }
1061
1062 /* Prevent warnings from -Wmissing-prototypes.  */
1063 #ifdef YYPARSE_PARAM
1064 #if defined __STDC__ || defined __cplusplus
1065 int yyparse (void *YYPARSE_PARAM);
1066 #else
1067 int yyparse ();
1068 #endif
1069 #else /* ! YYPARSE_PARAM */
1070 #if defined __STDC__ || defined __cplusplus
1071 int yyparse (void);
1072 #else
1073 int yyparse ();
1074 #endif
1075 #endif /* ! YYPARSE_PARAM */
1076
1077
1078 /* The lookahead symbol.  */
1079 int yychar;
1080
1081 /* The semantic value of the lookahead symbol.  */
1082 YYSTYPE yylval;
1083
1084 /* Number of syntax errors so far.  */
1085 int yynerrs;
1086
1087
1088
1089 /*-------------------------.
1090 | yyparse or yypush_parse.  |
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
1117     int yystate;
1118     /* Number of tokens to shift before error messages enabled.  */
1119     int yyerrstatus;
1120
1121     /* The stacks and their tools:
1122        `yyss': related to states.
1123        `yyvs': related to semantic values.
1124
1125        Refer to the stacks thru separate pointers, to allow yyoverflow
1126        to reallocate them elsewhere.  */
1127
1128     /* The state stack.  */
1129     yytype_int16 yyssa[YYINITDEPTH];
1130     yytype_int16 *yyss;
1131     yytype_int16 *yyssp;
1132
1133     /* The semantic value stack.  */
1134     YYSTYPE yyvsa[YYINITDEPTH];
1135     YYSTYPE *yyvs;
1136     YYSTYPE *yyvsp;
1137
1138     YYSIZE_T yystacksize;
1139
1140   int yyn;
1141   int yyresult;
1142   /* Lookahead token as an internal (translated) token number.  */
1143   int yytoken;
1144   /* The variables used to return semantic value and location from the
1145      action routines.  */
1146   YYSTYPE yyval;
1147
1148 #if YYERROR_VERBOSE
1149   /* Buffer for error messages, and its allocated size.  */
1150   char yymsgbuf[128];
1151   char *yymsg = yymsgbuf;
1152   YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
1153 #endif
1154
1155 #define YYPOPSTACK(N)   (yyvsp -= (N), yyssp -= (N))
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   yytoken = 0;
1162   yyss = yyssa;
1163   yyvs = yyvsa;
1164   yystacksize = YYINITDEPTH;
1165
1166   YYDPRINTF ((stderr, "Starting parse\n"));
1167
1168   yystate = 0;
1169   yyerrstatus = 0;
1170   yynerrs = 0;
1171   yychar = YYEMPTY; /* Cause a token to be read.  */
1172
1173   /* Initialize stack pointers.
1174      Waste one element of value and location stack
1175      so that they stay on the same level as the state stack.
1176      The wasted elements are never initialized.  */
1177   yyssp = yyss;
1178   yyvsp = yyvs;
1179
1180   goto yysetstate;
1181
1182 /*------------------------------------------------------------.
1183 | yynewstate -- Push a new state, which is found in yystate.  |
1184 `------------------------------------------------------------*/
1185  yynewstate:
1186   /* In all cases, when you get here, the value and location stacks
1187      have just been pushed.  So pushing a state here evens the stacks.  */
1188   yyssp++;
1189
1190  yysetstate:
1191   *yyssp = yystate;
1192
1193   if (yyss + yystacksize - 1 <= yyssp)
1194     {
1195       /* Get the current used size of the three stacks, in elements.  */
1196       YYSIZE_T yysize = yyssp - yyss + 1;
1197
1198 #ifdef yyoverflow
1199       {
1200         /* Give user a chance to reallocate the stack.  Use copies of
1201            these so that the &'s don't force the real ones into
1202            memory.  */
1203         YYSTYPE *yyvs1 = yyvs;
1204         yytype_int16 *yyss1 = yyss;
1205
1206         /* Each stack pointer address is followed by the size of the
1207            data in use in that stack, in bytes.  This used to be a
1208            conditional around just the two extra args, but that might
1209            be undefined if yyoverflow is a macro.  */
1210         yyoverflow (YY_("memory exhausted"),
1211                     &yyss1, yysize * sizeof (*yyssp),
1212                     &yyvs1, yysize * sizeof (*yyvsp),
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_alloc, yyss);
1236         YYSTACK_RELOCATE (yyvs_alloc, yyvs);
1237 #  undef YYSTACK_RELOCATE
1238         if (yyss1 != yyssa)
1239           YYSTACK_FREE (yyss1);
1240       }
1241 # endif
1242 #endif /* no yyoverflow */
1243
1244       yyssp = yyss + yysize - 1;
1245       yyvsp = yyvs + yysize - 1;
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   if (yystate == YYFINAL)
1257     YYACCEPT;
1258
1259   goto yybackup;
1260
1261 /*-----------.
1262 | yybackup.  |
1263 `-----------*/
1264 yybackup:
1265
1266   /* Do appropriate processing given the current state.  Read a
1267      lookahead token if we need one and don't already have one.  */
1268
1269   /* First try to decide what to do without reference to lookahead token.  */
1270   yyn = yypact[yystate];
1271   if (yyn == YYPACT_NINF)
1272     goto yydefault;
1273
1274   /* Not known => get a lookahead token if don't already have one.  */
1275
1276   /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol.  */
1277   if (yychar == YYEMPTY)
1278     {
1279       YYDPRINTF ((stderr, "Reading a token: "));
1280       yychar = YYLEX;
1281     }
1282
1283   if (yychar <= YYEOF)
1284     {
1285       yychar = yytoken = YYEOF;
1286       YYDPRINTF ((stderr, "Now at end of input.\n"));
1287     }
1288   else
1289     {
1290       yytoken = YYTRANSLATE (yychar);
1291       YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
1292     }
1293
1294   /* If the proper action on seeing token YYTOKEN is to reduce or to
1295      detect an error, take that action.  */
1296   yyn += yytoken;
1297   if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
1298     goto yydefault;
1299   yyn = yytable[yyn];
1300   if (yyn <= 0)
1301     {
1302       if (yyn == 0 || yyn == YYTABLE_NINF)
1303         goto yyerrlab;
1304       yyn = -yyn;
1305       goto yyreduce;
1306     }
1307
1308   /* Count tokens shifted since error; after three, turn off error
1309      status.  */
1310   if (yyerrstatus)
1311     yyerrstatus--;
1312
1313   /* Shift the lookahead token.  */
1314   YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
1315
1316   /* Discard the shifted token.  */
1317   yychar = YYEMPTY;
1318
1319   yystate = yyn;
1320   *++yyvsp = yylval;
1321
1322   goto yynewstate;
1323
1324
1325 /*-----------------------------------------------------------.
1326 | yydefault -- do the default action for the current state.  |
1327 `-----------------------------------------------------------*/
1328 yydefault:
1329   yyn = yydefact[yystate];
1330   if (yyn == 0)
1331     goto yyerrlab;
1332   goto yyreduce;
1333
1334
1335 /*-----------------------------.
1336 | yyreduce -- Do a reduction.  |
1337 `-----------------------------*/
1338 yyreduce:
1339   /* yyn is the number of a rule to reduce with.  */
1340   yylen = yyr2[yyn];
1341
1342   /* If YYLEN is nonzero, implement the default value of the action:
1343      `$$ = $1'.
1344
1345      Otherwise, the following line sets YYVAL to garbage.
1346      This behavior is undocumented and Bison
1347      users should not rely upon it.  Assigning to YYVAL
1348      unconditionally makes the parser a bit smaller, and it avoids a
1349      GCC warning that YYVAL may be used uninitialized.  */
1350   yyval = yyvsp[1-yylen];
1351
1352
1353   YY_REDUCE_PRINT (yyn);
1354   switch (yyn)
1355     {
1356         case 9:
1357
1358     { group_open(); ;}
1359     break;
1360
1361   case 10:
1362
1363     { group_close(); ;}
1364     break;
1365
1366   case 11:
1367
1368     { lc_opt_set(); ;}
1369     break;
1370
1371   case 12:
1372
1373     { path_push((yyvsp[(3) - (3)].text)); ;}
1374     break;
1375
1376   case 13:
1377
1378     { path_push((yyvsp[(1) - (1)].text)); ;}
1379     break;
1380
1381
1382
1383       default: break;
1384     }
1385   YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
1386
1387   YYPOPSTACK (yylen);
1388   yylen = 0;
1389   YY_STACK_PRINT (yyss, yyssp);
1390
1391   *++yyvsp = yyval;
1392
1393   /* Now `shift' the result of the reduction.  Determine what state
1394      that goes to, based on the state we popped back to and the rule
1395      number reduced by.  */
1396
1397   yyn = yyr1[yyn];
1398
1399   yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
1400   if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
1401     yystate = yytable[yystate];
1402   else
1403     yystate = yydefgoto[yyn - YYNTOKENS];
1404
1405   goto yynewstate;
1406
1407
1408 /*------------------------------------.
1409 | yyerrlab -- here on detecting error |
1410 `------------------------------------*/
1411 yyerrlab:
1412   /* If not already recovering from an error, report this error.  */
1413   if (!yyerrstatus)
1414     {
1415       ++yynerrs;
1416 #if ! YYERROR_VERBOSE
1417       yyerror (YY_("syntax error"));
1418 #else
1419       {
1420         YYSIZE_T yysize = yysyntax_error (0, yystate, yychar);
1421         if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM)
1422           {
1423             YYSIZE_T yyalloc = 2 * yysize;
1424             if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM))
1425               yyalloc = YYSTACK_ALLOC_MAXIMUM;
1426             if (yymsg != yymsgbuf)
1427               YYSTACK_FREE (yymsg);
1428             yymsg = (char *) YYSTACK_ALLOC (yyalloc);
1429             if (yymsg)
1430               yymsg_alloc = yyalloc;
1431             else
1432               {
1433                 yymsg = yymsgbuf;
1434                 yymsg_alloc = sizeof yymsgbuf;
1435               }
1436           }
1437
1438         if (0 < yysize && yysize <= yymsg_alloc)
1439           {
1440             (void) yysyntax_error (yymsg, yystate, yychar);
1441             yyerror (yymsg);
1442           }
1443         else
1444           {
1445             yyerror (YY_("syntax error"));
1446             if (yysize != 0)
1447               goto yyexhaustedlab;
1448           }
1449       }
1450 #endif
1451     }
1452
1453
1454
1455   if (yyerrstatus == 3)
1456     {
1457       /* If just tried and failed to reuse lookahead token after an
1458          error, discard it.  */
1459
1460       if (yychar <= YYEOF)
1461         {
1462           /* Return failure if at end of input.  */
1463           if (yychar == YYEOF)
1464             YYABORT;
1465         }
1466       else
1467         {
1468           yydestruct ("Error: discarding",
1469                       yytoken, &yylval);
1470           yychar = YYEMPTY;
1471         }
1472     }
1473
1474   /* Else will try to reuse lookahead token after shifting the error
1475      token.  */
1476   goto yyerrlab1;
1477
1478
1479 /*---------------------------------------------------.
1480 | yyerrorlab -- error raised explicitly by YYERROR.  |
1481 `---------------------------------------------------*/
1482 yyerrorlab:
1483
1484   /* Pacify compilers like GCC when the user code never invokes
1485      YYERROR and the label yyerrorlab therefore never appears in user
1486      code.  */
1487   if (/*CONSTCOND*/ 0)
1488      goto yyerrorlab;
1489
1490   /* Do not reclaim the symbols of the rule which action triggered
1491      this YYERROR.  */
1492   YYPOPSTACK (yylen);
1493   yylen = 0;
1494   YY_STACK_PRINT (yyss, yyssp);
1495   yystate = *yyssp;
1496   goto yyerrlab1;
1497
1498
1499 /*-------------------------------------------------------------.
1500 | yyerrlab1 -- common code for both syntax error and YYERROR.  |
1501 `-------------------------------------------------------------*/
1502 yyerrlab1:
1503   yyerrstatus = 3;      /* Each real token shifted decrements this.  */
1504
1505   for (;;)
1506     {
1507       yyn = yypact[yystate];
1508       if (yyn != YYPACT_NINF)
1509         {
1510           yyn += YYTERROR;
1511           if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
1512             {
1513               yyn = yytable[yyn];
1514               if (0 < yyn)
1515                 break;
1516             }
1517         }
1518
1519       /* Pop the current state because it cannot handle the error token.  */
1520       if (yyssp == yyss)
1521         YYABORT;
1522
1523
1524       yydestruct ("Error: popping",
1525                   yystos[yystate], yyvsp);
1526       YYPOPSTACK (1);
1527       yystate = *yyssp;
1528       YY_STACK_PRINT (yyss, yyssp);
1529     }
1530
1531   *++yyvsp = yylval;
1532
1533
1534   /* Shift the error token.  */
1535   YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
1536
1537   yystate = yyn;
1538   goto yynewstate;
1539
1540
1541 /*-------------------------------------.
1542 | yyacceptlab -- YYACCEPT comes here.  |
1543 `-------------------------------------*/
1544 yyacceptlab:
1545   yyresult = 0;
1546   goto yyreturn;
1547
1548 /*-----------------------------------.
1549 | yyabortlab -- YYABORT comes here.  |
1550 `-----------------------------------*/
1551 yyabortlab:
1552   yyresult = 1;
1553   goto yyreturn;
1554
1555 #if !defined(yyoverflow) || YYERROR_VERBOSE
1556 /*-------------------------------------------------.
1557 | yyexhaustedlab -- memory exhaustion comes here.  |
1558 `-------------------------------------------------*/
1559 yyexhaustedlab:
1560   yyerror (YY_("memory exhausted"));
1561   yyresult = 2;
1562   /* Fall through.  */
1563 #endif
1564
1565 yyreturn:
1566   if (yychar != YYEMPTY)
1567      yydestruct ("Cleanup: discarding lookahead",
1568                  yytoken, &yylval);
1569   /* Do not reclaim the symbols of the rule which action triggered
1570      this YYABORT or YYACCEPT.  */
1571   YYPOPSTACK (yylen);
1572   YY_STACK_PRINT (yyss, yyssp);
1573   while (yyssp != yyss)
1574     {
1575       yydestruct ("Cleanup: popping",
1576                   yystos[*yyssp], yyvsp);
1577       YYPOPSTACK (1);
1578     }
1579 #ifndef yyoverflow
1580   if (yyss != yyssa)
1581     YYSTACK_FREE (yyss);
1582 #endif
1583 #if YYERROR_VERBOSE
1584   if (yymsg != yymsgbuf)
1585     YYSTACK_FREE (yymsg);
1586 #endif
1587   /* Make sure YYID is used.  */
1588   return YYID (yyresult);
1589 }
1590
1591
1592
1593
1594
1595 static lc_opt_error_handler_t *handler;
1596 static struct obstack obst;
1597 const char *optfilename = "";
1598
1599 void PMANGLE(error)(const char *str)
1600 {
1601         fprintf(stderr, "At line %d: %s\n", PMANGLE(linenr), str);
1602 }
1603
1604 static const char *path_stack[128];
1605 static int path_sp = 0;
1606
1607 static lc_opt_entry_t *grp_stack[128];
1608 static int grp_sp = 0;
1609 #define CURR_GRP (grp_stack[grp_sp - 1])
1610
1611 void lc_opt_init_parser(const char *filename, lc_opt_error_handler_t *err_handler)
1612 {
1613         PMANGLE(linenr) = 1;
1614         obstack_init(&obst);
1615         handler = err_handler;
1616         optfilename = filename;
1617         grp_stack[grp_sp++] = lc_opt_root_grp();
1618 }
1619
1620 void _lc_opt_add_to_data_char(char c)
1621 {
1622         obstack_1grow(&obst, c);
1623 }
1624
1625 static void path_push(text_t text)
1626 {
1627         obstack_grow0(&obst, text.str, text.len);
1628         path_stack[path_sp++] = obstack_finish(&obst);
1629 }
1630
1631 static void path_free(void)
1632 {
1633         obstack_free(&obst, (void *) path_stack[0]);
1634         path_sp = 0;
1635 }
1636
1637 static void group_open(void)
1638 {
1639         lc_opt_err_info_t err;
1640         lc_opt_entry_t *grp = lc_opt_resolve_grp(CURR_GRP, path_stack, path_sp, &err);
1641
1642         path_free();
1643
1644         grp_stack[grp_sp++] = grp;
1645 }
1646
1647 static void group_close(void)
1648 {
1649         grp_sp--;
1650 }
1651
1652 static void lc_opt_set(void)
1653 {
1654         char *str = obstack_finish(&obst);
1655
1656         lc_opt_err_info_t err;
1657         lc_opt_entry_t *opt = lc_opt_resolve_opt(CURR_GRP, path_stack, path_sp, &err);
1658         lc_opt_raise_error(&err, handler, "At %s(%d): ", optfilename, PMANGLE(linenr));
1659
1660         lc_opt_occurs(opt, str, &err);
1661         lc_opt_raise_error(&err, handler, "At %s(%d): ", optfilename, PMANGLE(linenr));
1662
1663         obstack_free(&obst, str);
1664         path_free();
1665 }