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
116 #include "lc_opts_t.h"
117 #include "lc_parser_t.h"
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);
124 void PMANGLE(error)(const char *str);
129 /* Enabling traces. */
134 /* Enabling verbose error messages. */
135 #ifdef YYERROR_VERBOSE
136 # undef YYERROR_VERBOSE
137 # define YYERROR_VERBOSE 1
139 # define YYERROR_VERBOSE 0
142 /* Enabling the token table. */
143 #ifndef YYTOKEN_TABLE
144 # define YYTOKEN_TABLE 0
147 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
148 typedef union YYSTYPE
154 /* Line 187 of yacc.c. */
157 # define yystype YYSTYPE /* obsolescent; will be withdrawn */
158 # define YYSTYPE_IS_DECLARED 1
159 # define YYSTYPE_IS_TRIVIAL 1
164 /* Copy the second part of user declarations. */
167 /* Line 216 of yacc.c. */
175 typedef YYTYPE_UINT8 yytype_uint8;
177 typedef unsigned char yytype_uint8;
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;
186 typedef short int yytype_int8;
190 typedef YYTYPE_UINT16 yytype_uint16;
192 typedef unsigned short int yytype_uint16;
196 typedef YYTYPE_INT16 yytype_int16;
198 typedef short int yytype_int16;
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
211 # define YYSIZE_T unsigned int
215 #define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
220 # include <libintl.h> /* INFRINGES ON USER NAME SPACE */
221 # define YY_(msgid) dgettext ("bison-runtime", msgid)
225 # define YY_(msgid) msgid
229 /* Suppress unused-variable warnings by "using" E. */
230 #if ! defined lint || defined __GNUC__
231 # define YYUSE(e) ((void) (e))
233 # define YYUSE(e) /* empty */
236 /* Identity function, used to suppress warnings about constant conditions. */
240 #if (defined __STDC__ || defined __C99__FUNC__ \
241 || defined __cplusplus || defined _MSC_VER)
254 #if ! defined yyoverflow || YYERROR_VERBOSE
256 /* The parser invokes alloca or malloc; define the necessary symbols. */
258 # ifdef YYSTACK_USE_ALLOCA
259 # if YYSTACK_USE_ALLOCA
261 # define YYSTACK_ALLOC __builtin_alloca
262 # elif defined __BUILTIN_VA_ARG_INCR
263 # include <alloca.h> /* INFRINGES ON USER NAME SPACE */
265 # define YYSTACK_ALLOC __alloca
266 # elif defined _MSC_VER
267 # include <malloc.h> /* INFRINGES ON USER NAME SPACE */
268 # define alloca _alloca
270 # define YYSTACK_ALLOC alloca
271 # if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
272 || defined __cplusplus || defined _MSC_VER)
273 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
282 # ifdef YYSTACK_ALLOC
283 /* Pacify GCC's `empty if-body' warning. */
284 # define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0))
285 # ifndef YYSTACK_ALLOC_MAXIMUM
286 /* The OS might guarantee only one guard page at the bottom of the stack,
287 and a page size can be as small as 4096 bytes. So we cannot safely
288 invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
289 to allow for a few compiler-allocated temporary stack slots. */
290 # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
293 # define YYSTACK_ALLOC YYMALLOC
294 # define YYSTACK_FREE YYFREE
295 # ifndef YYSTACK_ALLOC_MAXIMUM
296 # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
298 # if (defined __cplusplus && ! defined _STDLIB_H \
299 && ! ((defined YYMALLOC || defined malloc) \
300 && (defined YYFREE || defined free)))
301 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
307 # define YYMALLOC malloc
308 # if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
309 || defined __cplusplus || defined _MSC_VER)
310 void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
315 # if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
316 || defined __cplusplus || defined _MSC_VER)
317 void free (void *); /* INFRINGES ON USER NAME SPACE */
321 #endif /* ! defined yyoverflow || YYERROR_VERBOSE */
324 #if (! defined yyoverflow \
325 && (! defined __cplusplus \
326 || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
328 /* A type that is properly aligned for any stack member. */
335 /* The size of the maximum gap between one aligned stack and the next. */
336 # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
338 /* The size of an array large to enough to hold all stacks, each with
340 # define YYSTACK_BYTES(N) \
341 ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
342 + YYSTACK_GAP_MAXIMUM)
344 /* Copy COUNT objects from FROM to TO. The source and destination do
347 # if defined __GNUC__ && 1 < __GNUC__
348 # define YYCOPY(To, From, Count) \
349 __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
351 # define YYCOPY(To, From, Count) \
355 for (yyi = 0; yyi < (Count); yyi++) \
356 (To)[yyi] = (From)[yyi]; \
362 /* Relocate STACK from its old location to the new one. The
363 local variables YYSIZE and YYSTACKSIZE give the old and new number of
364 elements in the stack, and YYPTR gives the new location of the
365 stack. Advance YYPTR to a properly aligned location for the next
367 # define YYSTACK_RELOCATE(Stack) \
370 YYSIZE_T yynewbytes; \
371 YYCOPY (&yyptr->Stack, Stack, yysize); \
372 Stack = &yyptr->Stack; \
373 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
374 yyptr += yynewbytes / sizeof (*yyptr); \
380 /* YYFINAL -- State number of the termination state. */
382 /* YYLAST -- Last index in YYTABLE. */
385 /* YYNTOKENS -- Number of terminals. */
387 /* YYNNTS -- Number of nonterminals. */
389 /* YYNRULES -- Number of rules. */
391 /* YYNRULES -- Number of states. */
394 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
396 #define YYMAXUTOK 260
398 #define YYTRANSLATE(YYX) \
399 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
401 /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
402 static const yytype_uint8 yytranslate[] =
404 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
405 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
406 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
407 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
408 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
409 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
410 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
411 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
412 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
413 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
414 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
415 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
416 2, 2, 2, 6, 2, 7, 2, 2, 2, 2,
417 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
418 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
419 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
420 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
421 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
422 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
423 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
424 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
425 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
426 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
427 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
428 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
429 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
434 /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
436 static const yytype_uint8 yyprhs[] =
438 0, 0, 3, 5, 7, 9, 12, 14, 16, 17,
442 /* YYRHS -- A `-1'-separated list of the rules' RHS. */
443 static const yytype_int8 yyrhs[] =
445 9, 0, -1, 12, -1, 13, -1, 15, -1, 11,
446 10, -1, 10, -1, 11, -1, -1, -1, 16, 14,
447 6, 12, 7, -1, 16, 4, -1, 16, 3, 5,
451 /* YYRLINE[YYN] -- source line where rule number YYN was defined. */
452 static const yytype_uint8 yyrline[] =
454 0, 53, 53, 55, 56, 59, 60, 63, 63, 65,
459 #if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
460 /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
461 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
462 static const char *const yytname[] =
464 "$end", "error", "$undefined", "SEP", "DATA", "IDENT", "'{'", "'}'",
465 "$accept", "main", "decl", "decls", "dseq", "group", "@1", "option",
471 /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
473 static const yytype_uint16 yytoknum[] =
475 0, 256, 257, 258, 259, 260, 123, 125
479 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
480 static const yytype_uint8 yyr1[] =
482 0, 8, 9, 10, 10, 11, 11, 12, 12, 14,
486 /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
487 static const yytype_uint8 yyr2[] =
489 0, 2, 1, 1, 1, 2, 1, 1, 0, 0,
493 /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
494 STATE-NUM when YYTABLE doesn't specify something else to do. Zero
495 means the default is an error. */
496 static const yytype_uint8 yydefact[] =
498 8, 13, 0, 6, 7, 2, 3, 4, 9, 1,
499 5, 0, 11, 0, 12, 8, 0, 10
502 /* YYDEFGOTO[NTERM-NUM]. */
503 static const yytype_int8 yydefgoto[] =
505 -1, 2, 3, 4, 5, 6, 13, 7, 8
508 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
510 #define YYPACT_NINF -11
511 static const yytype_int8 yypact[] =
513 -2, -11, 2, -11, -2, -11, -11, -11, -3, -11,
514 -11, -1, -11, 0, -11, -2, 1, -11
517 /* YYPGOTO[NTERM-NUM]. */
518 static const yytype_int8 yypgoto[] =
520 -11, -11, 3, -11, -10, -11, -11, -11, -11
523 /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
524 positive, shift that token. If negative, reduce the rule which
525 number is the opposite. If zero, do what YYDEFACT says.
526 If YYTABLE_NINF, syntax error. */
527 #define YYTABLE_NINF -1
528 static const yytype_uint8 yytable[] =
530 11, 12, 9, 1, 14, 16, 15, 10, 17
533 static const yytype_uint8 yycheck[] =
535 3, 4, 0, 5, 5, 15, 6, 4, 7
538 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
539 symbol of state STATE-NUM. */
540 static const yytype_uint8 yystos[] =
542 0, 5, 9, 10, 11, 12, 13, 15, 16, 0,
543 10, 3, 4, 14, 5, 6, 12, 7
546 #define yyerrok (yyerrstatus = 0)
547 #define yyclearin (yychar = YYEMPTY)
551 #define YYACCEPT goto yyacceptlab
552 #define YYABORT goto yyabortlab
553 #define YYERROR goto yyerrorlab
556 /* Like YYERROR except do call yyerror. This remains here temporarily
557 to ease the transition to the new meaning of YYERROR, for GCC.
558 Once GCC version 2 has supplanted version 1, this can go. */
560 #define YYFAIL goto yyerrlab
562 #define YYRECOVERING() (!!yyerrstatus)
564 #define YYBACKUP(Token, Value) \
566 if (yychar == YYEMPTY && yylen == 1) \
570 yytoken = YYTRANSLATE (yychar); \
576 yyerror (YY_("syntax error: cannot back up")); \
583 #define YYERRCODE 256
586 /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
587 If N is 0, then set CURRENT to the empty location which ends
588 the previous symbol: RHS[0] (always defined). */
590 #define YYRHSLOC(Rhs, K) ((Rhs)[K])
591 #ifndef YYLLOC_DEFAULT
592 # define YYLLOC_DEFAULT(Current, Rhs, N) \
596 (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \
597 (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \
598 (Current).last_line = YYRHSLOC (Rhs, N).last_line; \
599 (Current).last_column = YYRHSLOC (Rhs, N).last_column; \
603 (Current).first_line = (Current).last_line = \
604 YYRHSLOC (Rhs, 0).last_line; \
605 (Current).first_column = (Current).last_column = \
606 YYRHSLOC (Rhs, 0).last_column; \
612 /* YY_LOCATION_PRINT -- Print the location on the stream.
613 This macro was not mandated originally: define only if we know
614 we won't break user code: when these are the locations we know. */
616 #ifndef YY_LOCATION_PRINT
617 # if YYLTYPE_IS_TRIVIAL
618 # define YY_LOCATION_PRINT(File, Loc) \
619 fprintf (File, "%d.%d-%d.%d", \
620 (Loc).first_line, (Loc).first_column, \
621 (Loc).last_line, (Loc).last_column)
623 # define YY_LOCATION_PRINT(File, Loc) ((void) 0)
628 /* YYLEX -- calling `yylex' with the right arguments. */
631 # define YYLEX yylex (YYLEX_PARAM)
633 # define YYLEX yylex ()
636 /* Enable debugging if requested. */
640 # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
641 # define YYFPRINTF fprintf
644 # define YYDPRINTF(Args) \
650 # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
654 YYFPRINTF (stderr, "%s ", Title); \
655 yy_symbol_print (stderr, \
657 YYFPRINTF (stderr, "\n"); \
662 /*--------------------------------.
663 | Print this symbol on YYOUTPUT. |
664 `--------------------------------*/
667 #if (defined __STDC__ || defined __C99__FUNC__ \
668 || defined __cplusplus || defined _MSC_VER)
670 yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
673 yy_symbol_value_print (yyoutput, yytype, yyvaluep)
676 YYSTYPE const * const yyvaluep;
682 if (yytype < YYNTOKENS)
683 YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
695 /*--------------------------------.
696 | Print this symbol on YYOUTPUT. |
697 `--------------------------------*/
699 #if (defined __STDC__ || defined __C99__FUNC__ \
700 || defined __cplusplus || defined _MSC_VER)
702 yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
705 yy_symbol_print (yyoutput, yytype, yyvaluep)
708 YYSTYPE const * const yyvaluep;
711 if (yytype < YYNTOKENS)
712 YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
714 YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
716 yy_symbol_value_print (yyoutput, yytype, yyvaluep);
717 YYFPRINTF (yyoutput, ")");
720 /*------------------------------------------------------------------.
721 | yy_stack_print -- Print the state stack from its BOTTOM up to its |
723 `------------------------------------------------------------------*/
725 #if (defined __STDC__ || defined __C99__FUNC__ \
726 || defined __cplusplus || defined _MSC_VER)
728 yy_stack_print (yytype_int16 *bottom, yytype_int16 *top)
731 yy_stack_print (bottom, top)
732 yytype_int16 *bottom;
736 YYFPRINTF (stderr, "Stack now");
737 for (; bottom <= top; ++bottom)
738 YYFPRINTF (stderr, " %d", *bottom);
739 YYFPRINTF (stderr, "\n");
742 # define YY_STACK_PRINT(Bottom, Top) \
745 yy_stack_print ((Bottom), (Top)); \
749 /*------------------------------------------------.
750 | Report that the YYRULE is going to be reduced. |
751 `------------------------------------------------*/
753 #if (defined __STDC__ || defined __C99__FUNC__ \
754 || defined __cplusplus || defined _MSC_VER)
756 yy_reduce_print (YYSTYPE *yyvsp, int yyrule)
759 yy_reduce_print (yyvsp, yyrule)
764 int yynrhs = yyr2[yyrule];
766 unsigned long int yylno = yyrline[yyrule];
767 YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
769 /* The symbols being reduced. */
770 for (yyi = 0; yyi < yynrhs; yyi++)
772 fprintf (stderr, " $%d = ", yyi + 1);
773 yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi],
774 &(yyvsp[(yyi + 1) - (yynrhs)])
776 fprintf (stderr, "\n");
780 # define YY_REDUCE_PRINT(Rule) \
783 yy_reduce_print (yyvsp, Rule); \
786 /* Nonzero means print parse trace. It is left uninitialized so that
787 multiple parsers can coexist. */
790 # define YYDPRINTF(Args)
791 # define YY_SYMBOL_PRINT(Title, Type, Value, Location)
792 # define YY_STACK_PRINT(Bottom, Top)
793 # define YY_REDUCE_PRINT(Rule)
794 #endif /* !YYDEBUG */
797 /* YYINITDEPTH -- initial size of the parser's stacks. */
799 # define YYINITDEPTH 200
802 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
803 if the built-in stack extension method is used).
805 Do not make this value too large; the results are undefined if
806 YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
807 evaluated with infinite-precision integer arithmetic. */
810 # define YYMAXDEPTH 10000
818 # if defined __GLIBC__ && defined _STRING_H
819 # define yystrlen strlen
821 /* Return the length of YYSTR. */
822 #if (defined __STDC__ || defined __C99__FUNC__ \
823 || defined __cplusplus || defined _MSC_VER)
825 yystrlen (const char *yystr)
833 for (yylen = 0; yystr[yylen]; yylen++)
841 # if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
842 # define yystpcpy stpcpy
844 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
846 #if (defined __STDC__ || defined __C99__FUNC__ \
847 || defined __cplusplus || defined _MSC_VER)
849 yystpcpy (char *yydest, const char *yysrc)
852 yystpcpy (yydest, yysrc)
858 const char *yys = yysrc;
860 while ((*yyd++ = *yys++) != '\0')
869 /* Copy to YYRES the contents of YYSTR after stripping away unnecessary
870 quotes and backslashes, so that it's suitable for yyerror. The
871 heuristic is that double-quoting is unnecessary unless the string
872 contains an apostrophe, a comma, or backslash (other than
873 backslash-backslash). YYSTR is taken from yytname. If YYRES is
874 null, do not copy; instead, return the length of what the result
877 yytnamerr (char *yyres, const char *yystr)
882 char const *yyp = yystr;
889 goto do_not_strip_quotes;
893 goto do_not_strip_quotes;
906 do_not_strip_quotes: ;
910 return yystrlen (yystr);
912 return yystpcpy (yyres, yystr) - yyres;
916 /* Copy into YYRESULT an error message about the unexpected token
917 YYCHAR while in state YYSTATE. Return the number of bytes copied,
918 including the terminating null byte. If YYRESULT is null, do not
919 copy anything; just return the number of bytes that would be
920 copied. As a special case, return 0 if an ordinary "syntax error"
921 message will do. Return YYSIZE_MAXIMUM if overflow occurs during
924 yysyntax_error (char *yyresult, int yystate, int yychar)
926 int yyn = yypact[yystate];
928 if (! (YYPACT_NINF < yyn && yyn <= YYLAST))
932 int yytype = YYTRANSLATE (yychar);
933 YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]);
934 YYSIZE_T yysize = yysize0;
936 int yysize_overflow = 0;
937 enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
938 char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
942 /* This is so xgettext sees the translatable formats that are
943 constructed on the fly. */
944 YY_("syntax error, unexpected %s");
945 YY_("syntax error, unexpected %s, expecting %s");
946 YY_("syntax error, unexpected %s, expecting %s or %s");
947 YY_("syntax error, unexpected %s, expecting %s or %s or %s");
948 YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s");
952 static char const yyunexpected[] = "syntax error, unexpected %s";
953 static char const yyexpecting[] = ", expecting %s";
954 static char const yyor[] = " or %s";
955 char yyformat[sizeof yyunexpected
956 + sizeof yyexpecting - 1
957 + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2)
958 * (sizeof yyor - 1))];
959 char const *yyprefix = yyexpecting;
961 /* Start YYX at -YYN if negative to avoid negative indexes in
963 int yyxbegin = yyn < 0 ? -yyn : 0;
965 /* Stay within bounds of both yycheck and yytname. */
966 int yychecklim = YYLAST - yyn + 1;
967 int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
970 yyarg[0] = yytname[yytype];
971 yyfmt = yystpcpy (yyformat, yyunexpected);
973 for (yyx = yyxbegin; yyx < yyxend; ++yyx)
974 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
976 if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
980 yyformat[sizeof yyunexpected - 1] = '\0';
983 yyarg[yycount++] = yytname[yyx];
984 yysize1 = yysize + yytnamerr (0, yytname[yyx]);
985 yysize_overflow |= (yysize1 < yysize);
987 yyfmt = yystpcpy (yyfmt, yyprefix);
992 yysize1 = yysize + yystrlen (yyf);
993 yysize_overflow |= (yysize1 < yysize);
997 return YYSIZE_MAXIMUM;
1001 /* Avoid sprintf, as that infringes on the user's name space.
1002 Don't have undefined behavior even if the translation
1003 produced a string with the wrong number of "%s"s. */
1004 char *yyp = yyresult;
1006 while ((*yyp = *yyf) != '\0')
1008 if (*yyp == '%' && yyf[1] == 's' && yyi < yycount)
1010 yyp += yytnamerr (yyp, yyarg[yyi++]);
1023 #endif /* YYERROR_VERBOSE */
1026 /*-----------------------------------------------.
1027 | Release the memory associated to this symbol. |
1028 `-----------------------------------------------*/
1031 #if (defined __STDC__ || defined __C99__FUNC__ \
1032 || defined __cplusplus || defined _MSC_VER)
1034 yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep)
1037 yydestruct (yymsg, yytype, yyvaluep)
1047 YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
1058 /* Prevent warnings from -Wmissing-prototypes. */
1060 #ifdef YYPARSE_PARAM
1061 #if defined __STDC__ || defined __cplusplus
1062 int yyparse (void *YYPARSE_PARAM);
1066 #else /* ! YYPARSE_PARAM */
1067 #if defined __STDC__ || defined __cplusplus
1072 #endif /* ! YYPARSE_PARAM */
1076 /* The look-ahead symbol. */
1079 /* The semantic value of the look-ahead symbol. */
1082 /* Number of syntax errors so far. */
1091 #ifdef YYPARSE_PARAM
1092 #if (defined __STDC__ || defined __C99__FUNC__ \
1093 || defined __cplusplus || defined _MSC_VER)
1095 yyparse (void *YYPARSE_PARAM)
1098 yyparse (YYPARSE_PARAM)
1099 void *YYPARSE_PARAM;
1101 #else /* ! YYPARSE_PARAM */
1102 #if (defined __STDC__ || defined __C99__FUNC__ \
1103 || defined __cplusplus || defined _MSC_VER)
1117 /* Number of tokens to shift before error messages enabled. */
1119 /* Look-ahead token as an internal (translated) token number. */
1122 /* Buffer for error messages, and its allocated size. */
1124 char *yymsg = yymsgbuf;
1125 YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
1128 /* Three stacks and their tools:
1129 `yyss': related to states,
1130 `yyvs': related to semantic values,
1131 `yyls': related to locations.
1133 Refer to the stacks thru separate pointers, to allow yyoverflow
1134 to reallocate them elsewhere. */
1136 /* The state stack. */
1137 yytype_int16 yyssa[YYINITDEPTH];
1138 yytype_int16 *yyss = yyssa;
1139 yytype_int16 *yyssp;
1141 /* The semantic value stack. */
1142 YYSTYPE yyvsa[YYINITDEPTH];
1143 YYSTYPE *yyvs = yyvsa;
1148 #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
1150 YYSIZE_T yystacksize = YYINITDEPTH;
1152 /* The variables used to return semantic value and location from the
1157 /* The number of symbols on the RHS of the reduced rule.
1158 Keep to zero when no symbol should be popped. */
1161 YYDPRINTF ((stderr, "Starting parse\n"));
1166 yychar = YYEMPTY; /* Cause a token to be read. */
1168 /* Initialize stack pointers.
1169 Waste one element of value and location stack
1170 so that they stay on the same level as the state stack.
1171 The wasted elements are never initialized. */
1178 /*------------------------------------------------------------.
1179 | yynewstate -- Push a new state, which is found in yystate. |
1180 `------------------------------------------------------------*/
1182 /* In all cases, when you get here, the value and location stacks
1183 have just been pushed. So pushing a state here evens the stacks. */
1189 if (yyss + yystacksize - 1 <= yyssp)
1191 /* Get the current used size of the three stacks, in elements. */
1192 YYSIZE_T yysize = yyssp - yyss + 1;
1196 /* Give user a chance to reallocate the stack. Use copies of
1197 these so that the &'s don't force the real ones into
1199 YYSTYPE *yyvs1 = yyvs;
1200 yytype_int16 *yyss1 = yyss;
1203 /* Each stack pointer address is followed by the size of the
1204 data in use in that stack, in bytes. This used to be a
1205 conditional around just the two extra args, but that might
1206 be undefined if yyoverflow is a macro. */
1207 yyoverflow (YY_("memory exhausted"),
1208 &yyss1, yysize * sizeof (*yyssp),
1209 &yyvs1, yysize * sizeof (*yyvsp),
1216 #else /* no yyoverflow */
1217 # ifndef YYSTACK_RELOCATE
1218 goto yyexhaustedlab;
1220 /* Extend the stack our own way. */
1221 if (YYMAXDEPTH <= yystacksize)
1222 goto yyexhaustedlab;
1224 if (YYMAXDEPTH < yystacksize)
1225 yystacksize = YYMAXDEPTH;
1228 yytype_int16 *yyss1 = yyss;
1229 union yyalloc *yyptr =
1230 (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
1232 goto yyexhaustedlab;
1233 YYSTACK_RELOCATE (yyss);
1234 YYSTACK_RELOCATE (yyvs);
1236 # undef YYSTACK_RELOCATE
1238 YYSTACK_FREE (yyss1);
1241 #endif /* no yyoverflow */
1243 yyssp = yyss + yysize - 1;
1244 yyvsp = yyvs + yysize - 1;
1247 YYDPRINTF ((stderr, "Stack size increased to %lu\n",
1248 (unsigned long int) yystacksize));
1250 if (yyss + yystacksize - 1 <= yyssp)
1254 YYDPRINTF ((stderr, "Entering state %d\n", yystate));
1263 /* Do appropriate processing given the current state. Read a
1264 look-ahead token if we need one and don't already have one. */
1266 /* First try to decide what to do without reference to look-ahead token. */
1267 yyn = yypact[yystate];
1268 if (yyn == YYPACT_NINF)
1271 /* Not known => get a look-ahead token if don't already have one. */
1273 /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */
1274 if (yychar == YYEMPTY)
1276 YYDPRINTF ((stderr, "Reading a token: "));
1280 if (yychar <= YYEOF)
1282 yychar = yytoken = YYEOF;
1283 YYDPRINTF ((stderr, "Now at end of input.\n"));
1287 yytoken = YYTRANSLATE (yychar);
1288 YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
1291 /* If the proper action on seeing token YYTOKEN is to reduce or to
1292 detect an error, take that action. */
1294 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
1299 if (yyn == 0 || yyn == YYTABLE_NINF)
1308 /* Count tokens shifted since error; after three, turn off error
1313 /* Shift the look-ahead token. */
1314 YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
1316 /* Discard the shifted token unless it is eof. */
1317 if (yychar != YYEOF)
1326 /*-----------------------------------------------------------.
1327 | yydefault -- do the default action for the current state. |
1328 `-----------------------------------------------------------*/
1330 yyn = yydefact[yystate];
1336 /*-----------------------------.
1337 | yyreduce -- Do a reduction. |
1338 `-----------------------------*/
1340 /* yyn is the number of a rule to reduce with. */
1343 /* If YYLEN is nonzero, implement the default value of the action:
1346 Otherwise, the following line sets YYVAL to garbage.
1347 This behavior is undocumented and Bison
1348 users should not rely upon it. Assigning to YYVAL
1349 unconditionally makes the parser a bit smaller, and it avoids a
1350 GCC warning that YYVAL may be used uninitialized. */
1351 yyval = yyvsp[1-yylen];
1354 YY_REDUCE_PRINT (yyn);
1374 { path_push((yyvsp[(3) - (3)].text)); ;}
1379 { path_push((yyvsp[(1) - (1)].text)); ;}
1383 /* Line 1267 of yacc.c. */
1387 YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
1391 YY_STACK_PRINT (yyss, yyssp);
1396 /* Now `shift' the result of the reduction. Determine what state
1397 that goes to, based on the state we popped back to and the rule
1398 number reduced by. */
1402 yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
1403 if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
1404 yystate = yytable[yystate];
1406 yystate = yydefgoto[yyn - YYNTOKENS];
1411 /*------------------------------------.
1412 | yyerrlab -- here on detecting error |
1413 `------------------------------------*/
1415 /* If not already recovering from an error, report this error. */
1419 #if ! YYERROR_VERBOSE
1420 yyerror (YY_("syntax error"));
1423 YYSIZE_T yysize = yysyntax_error (0, yystate, yychar);
1424 if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM)
1426 YYSIZE_T yyalloc = 2 * yysize;
1427 if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM))
1428 yyalloc = YYSTACK_ALLOC_MAXIMUM;
1429 if (yymsg != yymsgbuf)
1430 YYSTACK_FREE (yymsg);
1431 yymsg = (char *) YYSTACK_ALLOC (yyalloc);
1433 yymsg_alloc = yyalloc;
1437 yymsg_alloc = sizeof yymsgbuf;
1441 if (0 < yysize && yysize <= yymsg_alloc)
1443 (void) yysyntax_error (yymsg, yystate, yychar);
1448 yyerror (YY_("syntax error"));
1450 goto yyexhaustedlab;
1458 if (yyerrstatus == 3)
1460 /* If just tried and failed to reuse look-ahead token after an
1461 error, discard it. */
1463 if (yychar <= YYEOF)
1465 /* Return failure if at end of input. */
1466 if (yychar == YYEOF)
1471 yydestruct ("Error: discarding",
1477 /* Else will try to reuse look-ahead token after shifting the error
1482 /*---------------------------------------------------.
1483 | yyerrorlab -- error raised explicitly by YYERROR. |
1484 `---------------------------------------------------*/
1487 /* Pacify compilers like GCC when the user code never invokes
1488 YYERROR and the label yyerrorlab therefore never appears in user
1490 if (/*CONSTCOND*/ 0)
1493 /* Do not reclaim the symbols of the rule which action triggered
1497 YY_STACK_PRINT (yyss, yyssp);
1502 /*-------------------------------------------------------------.
1503 | yyerrlab1 -- common code for both syntax error and YYERROR. |
1504 `-------------------------------------------------------------*/
1506 yyerrstatus = 3; /* Each real token shifted decrements this. */
1510 yyn = yypact[yystate];
1511 if (yyn != YYPACT_NINF)
1514 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
1522 /* Pop the current state because it cannot handle the error token. */
1527 yydestruct ("Error: popping",
1528 yystos[yystate], yyvsp);
1531 YY_STACK_PRINT (yyss, yyssp);
1540 /* Shift the error token. */
1541 YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
1547 /*-------------------------------------.
1548 | yyacceptlab -- YYACCEPT comes here. |
1549 `-------------------------------------*/
1554 /*-----------------------------------.
1555 | yyabortlab -- YYABORT comes here. |
1556 `-----------------------------------*/
1562 /*-------------------------------------------------.
1563 | yyexhaustedlab -- memory exhaustion comes here. |
1564 `-------------------------------------------------*/
1566 yyerror (YY_("memory exhausted"));
1572 if (yychar != YYEOF && yychar != YYEMPTY)
1573 yydestruct ("Cleanup: discarding lookahead",
1575 /* Do not reclaim the symbols of the rule which action triggered
1576 this YYABORT or YYACCEPT. */
1578 YY_STACK_PRINT (yyss, yyssp);
1579 while (yyssp != yyss)
1581 yydestruct ("Cleanup: popping",
1582 yystos[*yyssp], yyvsp);
1587 YYSTACK_FREE (yyss);
1590 if (yymsg != yymsgbuf)
1591 YYSTACK_FREE (yymsg);
1593 /* Make sure YYID is used. */
1594 return YYID (yyresult);
1601 static lc_opt_error_handler_t *handler;
1602 static struct obstack obst;
1603 const char *optfilename = "";
1605 void PMANGLE(error)(const char *str)
1607 fprintf(stderr, "At line %d: %s\n", PMANGLE(linenr), str);
1610 static const char *path_stack[128];
1611 static int path_sp = 0;
1613 static lc_opt_entry_t *grp_stack[128];
1614 static int grp_sp = 0;
1615 #define CURR_GRP (grp_stack[grp_sp - 1])
1617 void lc_opt_init_parser(const char *filename, lc_opt_error_handler_t *err_handler)
1619 PMANGLE(linenr) = 1;
1620 obstack_init(&obst);
1621 handler = err_handler;
1622 optfilename = filename;
1623 grp_stack[grp_sp++] = lc_opt_root_grp();
1626 void _lc_opt_add_to_data_char(char c)
1628 obstack_1grow(&obst, c);
1631 static void path_push(text_t text)
1633 obstack_grow0(&obst, text.str, text.len);
1634 path_stack[path_sp++] = obstack_finish(&obst);
1637 static void path_free(void)
1639 obstack_free(&obst, (void *) path_stack[0]);
1643 static void group_open(void)
1645 lc_opt_err_info_t err;
1646 lc_opt_entry_t *grp = lc_opt_resolve_grp(CURR_GRP, path_stack, path_sp, &err);
1650 grp_stack[grp_sp++] = grp;
1653 static void group_close(void)
1658 static void lc_opt_set(void)
1660 char *str = obstack_finish(&obst);
1662 lc_opt_err_info_t err;
1663 lc_opt_entry_t *opt = lc_opt_resolve_opt(CURR_GRP, path_stack, path_sp, &err);
1664 lc_opt_raise_error(&err, handler, "At %s(%d): ", optfilename, PMANGLE(linenr));
1666 lc_opt_occurs(opt, str, &err);
1667 lc_opt_raise_error(&err, handler, "At %s(%d): ", optfilename, PMANGLE(linenr));
1669 obstack_free(&obst, str);