1 /* A Bison parser, made by GNU Bison 2.3. */
3 /* Skeleton implementation for Bison's Yacc-like parsers in C
5 Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
6 Free Software Foundation, Inc.
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)
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.
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. */
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.
33 This special exception was added by the Free Software Foundation in
34 version 2.2 of Bison. */
36 /* C LALR(1) parser skeleton written by Richard Stallman, by
37 simplifying the original so-called "semantic" parser. */
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. */
46 /* Identify Bison output. */
50 #define YYBISON_VERSION "2.3"
53 #define YYSKELETON_NAME "yacc.c"
58 /* Using locations. */
59 #define YYLSP_NEEDED 0
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
74 /* Put the tokens into the symbol table, so that GDB and other debuggers
90 /* Copy the first part of user declarations. */
95 libcore: library for basic data structures and algorithms.
96 Copyright (C) 2005 IPD Goos, Universit"at Karlsruhe, Germany
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.
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.
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
118 #include "lc_opts_t.h"
119 #include "lc_parser_t.h"
121 static void group_open(void);
122 static void group_close(void);
123 static void lc_opt_set(void);
124 static void path_push(text_t text);
126 void PMANGLE(error)(const char *str);
131 /* Enabling traces. */
136 /* Enabling verbose error messages. */
137 #ifdef YYERROR_VERBOSE
138 # undef YYERROR_VERBOSE
139 # define YYERROR_VERBOSE 1
141 # define YYERROR_VERBOSE 0
144 /* Enabling the token table. */
145 #ifndef YYTOKEN_TABLE
146 # define YYTOKEN_TABLE 0
149 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
150 typedef union YYSTYPE
156 /* Line 187 of yacc.c. */
159 # define yystype YYSTYPE /* obsolescent; will be withdrawn */
160 # define YYSTYPE_IS_DECLARED 1
161 # define YYSTYPE_IS_TRIVIAL 1
166 /* Copy the second part of user declarations. */
169 /* Line 216 of yacc.c. */
177 typedef YYTYPE_UINT8 yytype_uint8;
179 typedef unsigned char yytype_uint8;
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;
188 typedef short int yytype_int8;
192 typedef YYTYPE_UINT16 yytype_uint16;
194 typedef unsigned short int yytype_uint16;
198 typedef YYTYPE_INT16 yytype_int16;
200 typedef short int yytype_int16;
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
213 # define YYSIZE_T unsigned int
217 #define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
222 # include <libintl.h> /* INFRINGES ON USER NAME SPACE */
223 # define YY_(msgid) dgettext ("bison-runtime", msgid)
227 # define YY_(msgid) msgid
231 /* Suppress unused-variable warnings by "using" E. */
232 #if ! defined lint || defined __GNUC__
233 # define YYUSE(e) ((void) (e))
235 # define YYUSE(e) /* empty */
238 /* Identity function, used to suppress warnings about constant conditions. */
242 #if (defined __STDC__ || defined __C99__FUNC__ \
243 || defined __cplusplus || defined _MSC_VER)
256 #if ! defined yyoverflow || YYERROR_VERBOSE
258 /* The parser invokes alloca or malloc; define the necessary symbols. */
260 # ifdef YYSTACK_USE_ALLOCA
261 # if YYSTACK_USE_ALLOCA
263 # define YYSTACK_ALLOC __builtin_alloca
264 # elif defined __BUILTIN_VA_ARG_INCR
265 # include <alloca.h> /* INFRINGES ON USER NAME SPACE */
267 # define YYSTACK_ALLOC __alloca
268 # elif defined _MSC_VER
269 # include <malloc.h> /* INFRINGES ON USER NAME SPACE */
270 # define alloca _alloca
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 */
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 */
295 # define YYSTACK_ALLOC YYMALLOC
296 # define YYSTACK_FREE YYFREE
297 # ifndef YYSTACK_ALLOC_MAXIMUM
298 # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
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 */
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 */
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 */
323 #endif /* ! defined yyoverflow || YYERROR_VERBOSE */
326 #if (! defined yyoverflow \
327 && (! defined __cplusplus \
328 || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
330 /* A type that is properly aligned for any stack member. */
337 /* The size of the maximum gap between one aligned stack and the next. */
338 # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
340 /* The size of an array large to enough to hold all stacks, each with
342 # define YYSTACK_BYTES(N) \
343 ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
344 + YYSTACK_GAP_MAXIMUM)
346 /* Copy COUNT objects from FROM to TO. The source and destination do
349 # if defined __GNUC__ && 1 < __GNUC__
350 # define YYCOPY(To, From, Count) \
351 __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
353 # define YYCOPY(To, From, Count) \
357 for (yyi = 0; yyi < (Count); yyi++) \
358 (To)[yyi] = (From)[yyi]; \
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
369 # define YYSTACK_RELOCATE(Stack) \
372 YYSIZE_T yynewbytes; \
373 YYCOPY (&yyptr->Stack, Stack, yysize); \
374 Stack = &yyptr->Stack; \
375 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
376 yyptr += yynewbytes / sizeof (*yyptr); \
382 /* YYFINAL -- State number of the termination state. */
384 /* YYLAST -- Last index in YYTABLE. */
387 /* YYNTOKENS -- Number of terminals. */
389 /* YYNNTS -- Number of nonterminals. */
391 /* YYNRULES -- Number of rules. */
393 /* YYNRULES -- Number of states. */
396 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
398 #define YYMAXUTOK 260
400 #define YYTRANSLATE(YYX) \
401 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
403 /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
404 static const yytype_uint8 yytranslate[] =
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,
436 /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
438 static const yytype_uint8 yyprhs[] =
440 0, 0, 3, 5, 7, 9, 12, 14, 16, 17,
444 /* YYRHS -- A `-1'-separated list of the rules' RHS. */
445 static const yytype_int8 yyrhs[] =
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,
453 /* YYRLINE[YYN] -- source line where rule number YYN was defined. */
454 static const yytype_uint8 yyrline[] =
456 0, 53, 53, 55, 56, 59, 60, 63, 63, 65,
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[] =
466 "$end", "error", "$undefined", "SEP", "DATA", "IDENT", "'{'", "'}'",
467 "$accept", "main", "decl", "decls", "dseq", "group", "@1", "option",
473 /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
475 static const yytype_uint16 yytoknum[] =
477 0, 256, 257, 258, 259, 260, 123, 125
481 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
482 static const yytype_uint8 yyr1[] =
484 0, 8, 9, 10, 10, 11, 11, 12, 12, 14,
488 /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
489 static const yytype_uint8 yyr2[] =
491 0, 2, 1, 1, 1, 2, 1, 1, 0, 0,
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[] =
500 8, 13, 0, 6, 7, 2, 3, 4, 9, 1,
501 5, 0, 11, 0, 12, 8, 0, 10
504 /* YYDEFGOTO[NTERM-NUM]. */
505 static const yytype_int8 yydefgoto[] =
507 -1, 2, 3, 4, 5, 6, 13, 7, 8
510 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
512 #define YYPACT_NINF -11
513 static const yytype_int8 yypact[] =
515 -2, -11, 2, -11, -2, -11, -11, -11, -3, -11,
516 -11, -1, -11, 0, -11, -2, 1, -11
519 /* YYPGOTO[NTERM-NUM]. */
520 static const yytype_int8 yypgoto[] =
522 -11, -11, 3, -11, -10, -11, -11, -11, -11
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[] =
532 11, 12, 9, 1, 14, 16, 15, 10, 17
535 static const yytype_uint8 yycheck[] =
537 3, 4, 0, 5, 5, 15, 6, 4, 7
540 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
541 symbol of state STATE-NUM. */
542 static const yytype_uint8 yystos[] =
544 0, 5, 9, 10, 11, 12, 13, 15, 16, 0,
545 10, 3, 4, 14, 5, 6, 12, 7
548 #define yyerrok (yyerrstatus = 0)
549 #define yyclearin (yychar = YYEMPTY)
553 #define YYACCEPT goto yyacceptlab
554 #define YYABORT goto yyabortlab
555 #define YYERROR goto yyerrorlab
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. */
562 #define YYFAIL goto yyerrlab
564 #define YYRECOVERING() (!!yyerrstatus)
566 #define YYBACKUP(Token, Value) \
568 if (yychar == YYEMPTY && yylen == 1) \
572 yytoken = YYTRANSLATE (yychar); \
578 yyerror (YY_("syntax error: cannot back up")); \
585 #define YYERRCODE 256
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). */
592 #define YYRHSLOC(Rhs, K) ((Rhs)[K])
593 #ifndef YYLLOC_DEFAULT
594 # define YYLLOC_DEFAULT(Current, Rhs, N) \
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; \
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; \
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. */
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)
625 # define YY_LOCATION_PRINT(File, Loc) ((void) 0)
630 /* YYLEX -- calling `yylex' with the right arguments. */
633 # define YYLEX yylex (YYLEX_PARAM)
635 # define YYLEX yylex ()
638 /* Enable debugging if requested. */
642 # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
643 # define YYFPRINTF fprintf
646 # define YYDPRINTF(Args) \
652 # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
656 YYFPRINTF (stderr, "%s ", Title); \
657 yy_symbol_print (stderr, \
659 YYFPRINTF (stderr, "\n"); \
664 /*--------------------------------.
665 | Print this symbol on YYOUTPUT. |
666 `--------------------------------*/
669 #if (defined __STDC__ || defined __C99__FUNC__ \
670 || defined __cplusplus || defined _MSC_VER)
672 yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
675 yy_symbol_value_print (yyoutput, yytype, yyvaluep)
678 YYSTYPE const * const yyvaluep;
684 if (yytype < YYNTOKENS)
685 YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
697 /*--------------------------------.
698 | Print this symbol on YYOUTPUT. |
699 `--------------------------------*/
701 #if (defined __STDC__ || defined __C99__FUNC__ \
702 || defined __cplusplus || defined _MSC_VER)
704 yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
707 yy_symbol_print (yyoutput, yytype, yyvaluep)
710 YYSTYPE const * const yyvaluep;
713 if (yytype < YYNTOKENS)
714 YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
716 YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
718 yy_symbol_value_print (yyoutput, yytype, yyvaluep);
719 YYFPRINTF (yyoutput, ")");
722 /*------------------------------------------------------------------.
723 | yy_stack_print -- Print the state stack from its BOTTOM up to its |
725 `------------------------------------------------------------------*/
727 #if (defined __STDC__ || defined __C99__FUNC__ \
728 || defined __cplusplus || defined _MSC_VER)
730 yy_stack_print (yytype_int16 *bottom, yytype_int16 *top)
733 yy_stack_print (bottom, top)
734 yytype_int16 *bottom;
738 YYFPRINTF (stderr, "Stack now");
739 for (; bottom <= top; ++bottom)
740 YYFPRINTF (stderr, " %d", *bottom);
741 YYFPRINTF (stderr, "\n");
744 # define YY_STACK_PRINT(Bottom, Top) \
747 yy_stack_print ((Bottom), (Top)); \
751 /*------------------------------------------------.
752 | Report that the YYRULE is going to be reduced. |
753 `------------------------------------------------*/
755 #if (defined __STDC__ || defined __C99__FUNC__ \
756 || defined __cplusplus || defined _MSC_VER)
758 yy_reduce_print (YYSTYPE *yyvsp, int yyrule)
761 yy_reduce_print (yyvsp, yyrule)
766 int yynrhs = yyr2[yyrule];
768 unsigned long int yylno = yyrline[yyrule];
769 YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
771 /* The symbols being reduced. */
772 for (yyi = 0; yyi < yynrhs; yyi++)
774 fprintf (stderr, " $%d = ", yyi + 1);
775 yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi],
776 &(yyvsp[(yyi + 1) - (yynrhs)])
778 fprintf (stderr, "\n");
782 # define YY_REDUCE_PRINT(Rule) \
785 yy_reduce_print (yyvsp, Rule); \
788 /* Nonzero means print parse trace. It is left uninitialized so that
789 multiple parsers can coexist. */
792 # define YYDPRINTF(Args)
793 # define YY_SYMBOL_PRINT(Title, Type, Value, Location)
794 # define YY_STACK_PRINT(Bottom, Top)
795 # define YY_REDUCE_PRINT(Rule)
796 #endif /* !YYDEBUG */
799 /* YYINITDEPTH -- initial size of the parser's stacks. */
801 # define YYINITDEPTH 200
804 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
805 if the built-in stack extension method is used).
807 Do not make this value too large; the results are undefined if
808 YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
809 evaluated with infinite-precision integer arithmetic. */
812 # define YYMAXDEPTH 10000
820 # if defined __GLIBC__ && defined _STRING_H
821 # define yystrlen strlen
823 /* Return the length of YYSTR. */
824 #if (defined __STDC__ || defined __C99__FUNC__ \
825 || defined __cplusplus || defined _MSC_VER)
827 yystrlen (const char *yystr)
835 for (yylen = 0; yystr[yylen]; yylen++)
843 # if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
844 # define yystpcpy stpcpy
846 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
848 #if (defined __STDC__ || defined __C99__FUNC__ \
849 || defined __cplusplus || defined _MSC_VER)
851 yystpcpy (char *yydest, const char *yysrc)
854 yystpcpy (yydest, yysrc)
860 const char *yys = yysrc;
862 while ((*yyd++ = *yys++) != '\0')
871 /* Copy to YYRES the contents of YYSTR after stripping away unnecessary
872 quotes and backslashes, so that it's suitable for yyerror. The
873 heuristic is that double-quoting is unnecessary unless the string
874 contains an apostrophe, a comma, or backslash (other than
875 backslash-backslash). YYSTR is taken from yytname. If YYRES is
876 null, do not copy; instead, return the length of what the result
879 yytnamerr (char *yyres, const char *yystr)
884 char const *yyp = yystr;
891 goto do_not_strip_quotes;
895 goto do_not_strip_quotes;
908 do_not_strip_quotes: ;
912 return yystrlen (yystr);
914 return yystpcpy (yyres, yystr) - yyres;
918 /* Copy into YYRESULT an error message about the unexpected token
919 YYCHAR while in state YYSTATE. Return the number of bytes copied,
920 including the terminating null byte. If YYRESULT is null, do not
921 copy anything; just return the number of bytes that would be
922 copied. As a special case, return 0 if an ordinary "syntax error"
923 message will do. Return YYSIZE_MAXIMUM if overflow occurs during
926 yysyntax_error (char *yyresult, int yystate, int yychar)
928 int yyn = yypact[yystate];
930 if (! (YYPACT_NINF < yyn && yyn <= YYLAST))
934 int yytype = YYTRANSLATE (yychar);
935 YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]);
936 YYSIZE_T yysize = yysize0;
938 int yysize_overflow = 0;
939 enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
940 char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
944 /* This is so xgettext sees the translatable formats that are
945 constructed on the fly. */
946 YY_("syntax error, unexpected %s");
947 YY_("syntax error, unexpected %s, expecting %s");
948 YY_("syntax error, unexpected %s, expecting %s or %s");
949 YY_("syntax error, unexpected %s, expecting %s or %s or %s");
950 YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s");
954 static char const yyunexpected[] = "syntax error, unexpected %s";
955 static char const yyexpecting[] = ", expecting %s";
956 static char const yyor[] = " or %s";
957 char yyformat[sizeof yyunexpected
958 + sizeof yyexpecting - 1
959 + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2)
960 * (sizeof yyor - 1))];
961 char const *yyprefix = yyexpecting;
963 /* Start YYX at -YYN if negative to avoid negative indexes in
965 int yyxbegin = yyn < 0 ? -yyn : 0;
967 /* Stay within bounds of both yycheck and yytname. */
968 int yychecklim = YYLAST - yyn + 1;
969 int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
972 yyarg[0] = yytname[yytype];
973 yyfmt = yystpcpy (yyformat, yyunexpected);
975 for (yyx = yyxbegin; yyx < yyxend; ++yyx)
976 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
978 if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
982 yyformat[sizeof yyunexpected - 1] = '\0';
985 yyarg[yycount++] = yytname[yyx];
986 yysize1 = yysize + yytnamerr (0, yytname[yyx]);
987 yysize_overflow |= (yysize1 < yysize);
989 yyfmt = yystpcpy (yyfmt, yyprefix);
994 yysize1 = yysize + yystrlen (yyf);
995 yysize_overflow |= (yysize1 < yysize);
999 return YYSIZE_MAXIMUM;
1003 /* Avoid sprintf, as that infringes on the user's name space.
1004 Don't have undefined behavior even if the translation
1005 produced a string with the wrong number of "%s"s. */
1006 char *yyp = yyresult;
1008 while ((*yyp = *yyf) != '\0')
1010 if (*yyp == '%' && yyf[1] == 's' && yyi < yycount)
1012 yyp += yytnamerr (yyp, yyarg[yyi++]);
1025 #endif /* YYERROR_VERBOSE */
1028 /*-----------------------------------------------.
1029 | Release the memory associated to this symbol. |
1030 `-----------------------------------------------*/
1033 #if (defined __STDC__ || defined __C99__FUNC__ \
1034 || defined __cplusplus || defined _MSC_VER)
1036 yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep)
1039 yydestruct (yymsg, yytype, yyvaluep)
1049 YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
1060 /* Prevent warnings from -Wmissing-prototypes. */
1062 #ifdef YYPARSE_PARAM
1063 #if defined __STDC__ || defined __cplusplus
1064 int yyparse (void *YYPARSE_PARAM);
1068 #else /* ! YYPARSE_PARAM */
1069 #if defined __STDC__ || defined __cplusplus
1074 #endif /* ! YYPARSE_PARAM */
1078 /* The look-ahead symbol. */
1081 /* The semantic value of the look-ahead symbol. */
1084 /* Number of syntax errors so far. */
1093 #ifdef YYPARSE_PARAM
1094 #if (defined __STDC__ || defined __C99__FUNC__ \
1095 || defined __cplusplus || defined _MSC_VER)
1097 yyparse (void *YYPARSE_PARAM)
1100 yyparse (YYPARSE_PARAM)
1101 void *YYPARSE_PARAM;
1103 #else /* ! YYPARSE_PARAM */
1104 #if (defined __STDC__ || defined __C99__FUNC__ \
1105 || defined __cplusplus || defined _MSC_VER)
1119 /* Number of tokens to shift before error messages enabled. */
1121 /* Look-ahead token as an internal (translated) token number. */
1124 /* Buffer for error messages, and its allocated size. */
1126 char *yymsg = yymsgbuf;
1127 YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
1130 /* Three stacks and their tools:
1131 `yyss': related to states,
1132 `yyvs': related to semantic values,
1133 `yyls': related to locations.
1135 Refer to the stacks thru separate pointers, to allow yyoverflow
1136 to reallocate them elsewhere. */
1138 /* The state stack. */
1139 yytype_int16 yyssa[YYINITDEPTH];
1140 yytype_int16 *yyss = yyssa;
1141 yytype_int16 *yyssp;
1143 /* The semantic value stack. */
1144 YYSTYPE yyvsa[YYINITDEPTH];
1145 YYSTYPE *yyvs = yyvsa;
1150 #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
1152 YYSIZE_T yystacksize = YYINITDEPTH;
1154 /* The variables used to return semantic value and location from the
1159 /* The number of symbols on the RHS of the reduced rule.
1160 Keep to zero when no symbol should be popped. */
1163 YYDPRINTF ((stderr, "Starting parse\n"));
1168 yychar = YYEMPTY; /* Cause a token to be read. */
1170 /* Initialize stack pointers.
1171 Waste one element of value and location stack
1172 so that they stay on the same level as the state stack.
1173 The wasted elements are never initialized. */
1180 /*------------------------------------------------------------.
1181 | yynewstate -- Push a new state, which is found in yystate. |
1182 `------------------------------------------------------------*/
1184 /* In all cases, when you get here, the value and location stacks
1185 have just been pushed. So pushing a state here evens the stacks. */
1191 if (yyss + yystacksize - 1 <= yyssp)
1193 /* Get the current used size of the three stacks, in elements. */
1194 YYSIZE_T yysize = yyssp - yyss + 1;
1198 /* Give user a chance to reallocate the stack. Use copies of
1199 these so that the &'s don't force the real ones into
1201 YYSTYPE *yyvs1 = yyvs;
1202 yytype_int16 *yyss1 = yyss;
1205 /* Each stack pointer address is followed by the size of the
1206 data in use in that stack, in bytes. This used to be a
1207 conditional around just the two extra args, but that might
1208 be undefined if yyoverflow is a macro. */
1209 yyoverflow (YY_("memory exhausted"),
1210 &yyss1, yysize * sizeof (*yyssp),
1211 &yyvs1, yysize * sizeof (*yyvsp),
1218 #else /* no yyoverflow */
1219 # ifndef YYSTACK_RELOCATE
1220 goto yyexhaustedlab;
1222 /* Extend the stack our own way. */
1223 if (YYMAXDEPTH <= yystacksize)
1224 goto yyexhaustedlab;
1226 if (YYMAXDEPTH < yystacksize)
1227 yystacksize = YYMAXDEPTH;
1230 yytype_int16 *yyss1 = yyss;
1231 union yyalloc *yyptr =
1232 (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
1234 goto yyexhaustedlab;
1235 YYSTACK_RELOCATE (yyss);
1236 YYSTACK_RELOCATE (yyvs);
1238 # undef YYSTACK_RELOCATE
1240 YYSTACK_FREE (yyss1);
1243 #endif /* no yyoverflow */
1245 yyssp = yyss + yysize - 1;
1246 yyvsp = yyvs + yysize - 1;
1249 YYDPRINTF ((stderr, "Stack size increased to %lu\n",
1250 (unsigned long int) yystacksize));
1252 if (yyss + yystacksize - 1 <= yyssp)
1256 YYDPRINTF ((stderr, "Entering state %d\n", yystate));
1265 /* Do appropriate processing given the current state. Read a
1266 look-ahead token if we need one and don't already have one. */
1268 /* First try to decide what to do without reference to look-ahead token. */
1269 yyn = yypact[yystate];
1270 if (yyn == YYPACT_NINF)
1273 /* Not known => get a look-ahead token if don't already have one. */
1275 /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */
1276 if (yychar == YYEMPTY)
1278 YYDPRINTF ((stderr, "Reading a token: "));
1282 if (yychar <= YYEOF)
1284 yychar = yytoken = YYEOF;
1285 YYDPRINTF ((stderr, "Now at end of input.\n"));
1289 yytoken = YYTRANSLATE (yychar);
1290 YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
1293 /* If the proper action on seeing token YYTOKEN is to reduce or to
1294 detect an error, take that action. */
1296 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
1301 if (yyn == 0 || yyn == YYTABLE_NINF)
1310 /* Count tokens shifted since error; after three, turn off error
1315 /* Shift the look-ahead token. */
1316 YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
1318 /* Discard the shifted token unless it is eof. */
1319 if (yychar != YYEOF)
1328 /*-----------------------------------------------------------.
1329 | yydefault -- do the default action for the current state. |
1330 `-----------------------------------------------------------*/
1332 yyn = yydefact[yystate];
1338 /*-----------------------------.
1339 | yyreduce -- Do a reduction. |
1340 `-----------------------------*/
1342 /* yyn is the number of a rule to reduce with. */
1345 /* If YYLEN is nonzero, implement the default value of the action:
1348 Otherwise, the following line sets YYVAL to garbage.
1349 This behavior is undocumented and Bison
1350 users should not rely upon it. Assigning to YYVAL
1351 unconditionally makes the parser a bit smaller, and it avoids a
1352 GCC warning that YYVAL may be used uninitialized. */
1353 yyval = yyvsp[1-yylen];
1356 YY_REDUCE_PRINT (yyn);
1376 { path_push((yyvsp[(3) - (3)].text)); ;}
1381 { path_push((yyvsp[(1) - (1)].text)); ;}
1385 /* Line 1267 of yacc.c. */
1389 YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
1393 YY_STACK_PRINT (yyss, yyssp);
1398 /* Now `shift' the result of the reduction. Determine what state
1399 that goes to, based on the state we popped back to and the rule
1400 number reduced by. */
1404 yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
1405 if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
1406 yystate = yytable[yystate];
1408 yystate = yydefgoto[yyn - YYNTOKENS];
1413 /*------------------------------------.
1414 | yyerrlab -- here on detecting error |
1415 `------------------------------------*/
1417 /* If not already recovering from an error, report this error. */
1421 #if ! YYERROR_VERBOSE
1422 yyerror (YY_("syntax error"));
1425 YYSIZE_T yysize = yysyntax_error (0, yystate, yychar);
1426 if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM)
1428 YYSIZE_T yyalloc = 2 * yysize;
1429 if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM))
1430 yyalloc = YYSTACK_ALLOC_MAXIMUM;
1431 if (yymsg != yymsgbuf)
1432 YYSTACK_FREE (yymsg);
1433 yymsg = (char *) YYSTACK_ALLOC (yyalloc);
1435 yymsg_alloc = yyalloc;
1439 yymsg_alloc = sizeof yymsgbuf;
1443 if (0 < yysize && yysize <= yymsg_alloc)
1445 (void) yysyntax_error (yymsg, yystate, yychar);
1450 yyerror (YY_("syntax error"));
1452 goto yyexhaustedlab;
1460 if (yyerrstatus == 3)
1462 /* If just tried and failed to reuse look-ahead token after an
1463 error, discard it. */
1465 if (yychar <= YYEOF)
1467 /* Return failure if at end of input. */
1468 if (yychar == YYEOF)
1473 yydestruct ("Error: discarding",
1479 /* Else will try to reuse look-ahead token after shifting the error
1484 /*---------------------------------------------------.
1485 | yyerrorlab -- error raised explicitly by YYERROR. |
1486 `---------------------------------------------------*/
1489 /* Pacify compilers like GCC when the user code never invokes
1490 YYERROR and the label yyerrorlab therefore never appears in user
1492 if (/*CONSTCOND*/ 0)
1495 /* Do not reclaim the symbols of the rule which action triggered
1499 YY_STACK_PRINT (yyss, yyssp);
1504 /*-------------------------------------------------------------.
1505 | yyerrlab1 -- common code for both syntax error and YYERROR. |
1506 `-------------------------------------------------------------*/
1508 yyerrstatus = 3; /* Each real token shifted decrements this. */
1512 yyn = yypact[yystate];
1513 if (yyn != YYPACT_NINF)
1516 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
1524 /* Pop the current state because it cannot handle the error token. */
1529 yydestruct ("Error: popping",
1530 yystos[yystate], yyvsp);
1533 YY_STACK_PRINT (yyss, yyssp);
1542 /* Shift the error token. */
1543 YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
1549 /*-------------------------------------.
1550 | yyacceptlab -- YYACCEPT comes here. |
1551 `-------------------------------------*/
1556 /*-----------------------------------.
1557 | yyabortlab -- YYABORT comes here. |
1558 `-----------------------------------*/
1564 /*-------------------------------------------------.
1565 | yyexhaustedlab -- memory exhaustion comes here. |
1566 `-------------------------------------------------*/
1568 yyerror (YY_("memory exhausted"));
1574 if (yychar != YYEOF && yychar != YYEMPTY)
1575 yydestruct ("Cleanup: discarding lookahead",
1577 /* Do not reclaim the symbols of the rule which action triggered
1578 this YYABORT or YYACCEPT. */
1580 YY_STACK_PRINT (yyss, yyssp);
1581 while (yyssp != yyss)
1583 yydestruct ("Cleanup: popping",
1584 yystos[*yyssp], yyvsp);
1589 YYSTACK_FREE (yyss);
1592 if (yymsg != yymsgbuf)
1593 YYSTACK_FREE (yymsg);
1595 /* Make sure YYID is used. */
1596 return YYID (yyresult);
1603 static lc_opt_error_handler_t *handler;
1604 static struct obstack obst;
1605 const char *optfilename = "";
1607 void PMANGLE(error)(const char *str)
1609 fprintf(stderr, "At line %d: %s\n", PMANGLE(linenr), str);
1612 static const char *path_stack[128];
1613 static int path_sp = 0;
1615 static lc_opt_entry_t *grp_stack[128];
1616 static int grp_sp = 0;
1617 #define CURR_GRP (grp_stack[grp_sp - 1])
1619 void lc_opt_init_parser(const char *filename, lc_opt_error_handler_t *err_handler)
1621 PMANGLE(linenr) = 1;
1622 obstack_init(&obst);
1623 handler = err_handler;
1624 optfilename = filename;
1625 grp_stack[grp_sp++] = lc_opt_root_grp();
1628 void _lc_opt_add_to_data_char(char c)
1630 obstack_1grow(&obst, c);
1633 static void path_push(text_t text)
1635 obstack_grow0(&obst, text.str, text.len);
1636 path_stack[path_sp++] = obstack_finish(&obst);
1639 static void path_free(void)
1641 obstack_free(&obst, (void *) path_stack[0]);
1645 static void group_open(void)
1647 lc_opt_err_info_t err;
1648 lc_opt_entry_t *grp = lc_opt_resolve_grp(CURR_GRP, path_stack, path_sp, &err);
1652 grp_stack[grp_sp++] = grp;
1655 static void group_close(void)
1660 static void lc_opt_set(void)
1662 char *str = obstack_finish(&obst);
1664 lc_opt_err_info_t err;
1665 lc_opt_entry_t *opt = lc_opt_resolve_opt(CURR_GRP, path_stack, path_sp, &err);
1666 lc_opt_raise_error(&err, handler, "At %s(%d): ", optfilename, PMANGLE(linenr));
1668 lc_opt_occurs(opt, str, &err);
1669 lc_opt_raise_error(&err, handler, "At %s(%d): ", optfilename, PMANGLE(linenr));
1671 obstack_free(&obst, str);