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