1 /*=========================================================================
3 Program: CMake - Cross-Platform Makefile Generator
4 Module: $RCSfile: cmCommandArgumentParser.cxx,v $
6 Date: $Date: 2007-07-27 14:55:24 $
7 Version: $Revision: 1.13 $
9 Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved.
10 See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details.
12 This software is distributed WITHOUT ANY WARRANTY; without even
13 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
14 PURPOSE. See the above copyright notices for more information.
16 =========================================================================*/
17 /* A Bison parser, made by GNU Bison 2.1. */
19 /* Skeleton parser for Yacc-like parsing with Bison, Copyright (C) 1984,
20 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation,
23 This program is free software; you can redistribute it and/or modify
24 it under the terms of the GNU General Public License as published by
25 the Free Software Foundation; either version 2, or (at your option)
28 This program is distributed in the hope that it will be useful,
29 but WITHOUT ANY WARRANTY; without even the implied warranty of
30 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
31 GNU General Public License for more details.
33 You should have received a copy of the GNU General Public License
34 along with this program; if not, write to the Free Software
35 Foundation, Inc., 51 Franklin Street, Fifth Floor,
36 Boston, MA 02110-1301, USA. */
38 /* As a special exception, when this file is copied by Bison into a
39 Bison output file, you may use that output file without restriction.
40 This special exception was added by the Free Software Foundation
41 in version 1.24 of Bison. */
43 /* Written by Richard Stallman by simplifying the original so called
44 ``semantic'' parser. */
46 /* All symbols defined below should begin with yy or YY, to avoid
47 infringing on user name space. This should be done even for local
48 variables, as they might otherwise be expanded by user macros.
49 There are some unavoidable exceptions within include files to
50 define necessary library symbols; they are noted "INFRINGES ON
51 USER NAME SPACE" below. */
53 /* turn off some warning as this is generated code */
55 # pragma warning ( disable : 4702 ) /* unreachable code */
58 /* Identify Bison output. */
62 #define YYBISON_VERSION "2.1"
65 #define YYSKELETON_NAME "yacc.c"
70 /* Using locations. */
71 #define YYLSP_NEEDED 0
73 /* Substitute the variable and function names. */
74 #define yyparse cmCommandArgument_yyparse
75 #define yylex cmCommandArgument_yylex
76 #define yyerror cmCommandArgument_yyerror
77 #define yylval cmCommandArgument_yylval
78 #define yychar cmCommandArgument_yychar
79 #define yydebug cmCommandArgument_yydebug
80 #define yynerrs cmCommandArgument_yynerrs
86 /* Put the tokens into the symbol table, so that GDB and other debuggers
103 #define cal_NCURLY 258
104 #define cal_DCURLY 259
105 #define cal_DOLLAR 260
106 #define cal_LCURLY 261
107 #define cal_RCURLY 262
109 #define cal_BSLASH 264
110 #define cal_SYMBOL 265
112 #define cal_ERROR 267
113 #define cal_ATNAME 268
118 /* Copy the first part of user declarations. */
119 #line 1 "cmCommandArgumentParser.y"
121 /*=========================================================================
123 Program: CMake - Cross-Platform Makefile Generator
124 Module: $RCSfile: cmCommandArgumentParser.cxx,v $
126 Date: $Date: 2007-07-27 14:55:24 $
127 Version: $Revision: 1.13 $
129 Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved.
130 See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details.
132 This software is distributed WITHOUT ANY WARRANTY; without even
133 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
134 PURPOSE. See the above copyright notices for more information.
136 =========================================================================*/
139 This file must be translated to C and modified to build everywhere.
143 bison --yacc --name-prefix=cmCommandArgument_yy
144 --defines=cmCommandArgumentParserTokens.h -ocmCommandArgumentParser.cxx
145 cmCommandArgumentParser.y
147 Modify cmCommandArgumentParser.cxx:
152 #include "cmStandardIncludes.h"
154 /* Configure the parser to use a lexer object. */
155 #define YYPARSE_PARAM yyscanner
156 #define YYLEX_PARAM yyscanner
157 #define YYERROR_VERBOSE 1
158 #define cmCommandArgument_yyerror(x) \
159 cmCommandArgumentError(yyscanner, x)
160 #define yyGetParser (cmCommandArgument_yyget_extra(yyscanner))
162 /* Make sure malloc and free are available on QNX. */
167 /* Make sure the parser uses standard memory allocation. The default
168 generated parser malloc/free declarations do not work on all
171 #define YYMALLOC malloc
174 /*-------------------------------------------------------------------------*/
175 #include "cmCommandArgumentParserHelper.h" /* Interface to parser object. */
176 #include "cmCommandArgumentLexer.h" /* Interface to lexer object. */
177 #include "cmCommandArgumentParserTokens.h" /* Need YYSTYPE for YY_DECL. */
179 /* Forward declare the lexer entry point. */
182 /* Internal utility functions. */
183 static void cmCommandArgumentError(yyscan_t yyscanner
, const char* message
);
186 // Set these high so that
187 #define YYMAXDEPTH 100000
188 #define YYINITDEPTH 10000
191 /* Disable some warnings in the generated code. */
193 # pragma warn -8004 /* Variable assigned a value that is not used. */
194 # pragma warn -8008 /* condition always returns true */
195 # pragma warn -8060 /* possibly incorrect assignment */
196 # pragma warn -8066 /* unreachable code */
199 # pragma warning (disable: 4102) /* Unused goto label. */
200 # pragma warning (disable: 4065) /* Switch statement contains default but no
205 /* Enabling traces. */
210 /* Enabling verbose error messages. */
211 #ifdef YYERROR_VERBOSE
212 # undef YYERROR_VERBOSE
213 # define YYERROR_VERBOSE 1
215 # define YYERROR_VERBOSE 0
218 /* Enabling the token table. */
219 #ifndef YYTOKEN_TABLE
220 # define YYTOKEN_TABLE 0
223 #if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED)
225 # define yystype YYSTYPE /* obsolescent; will be withdrawn */
226 # define YYSTYPE_IS_DECLARED 1
227 # define YYSTYPE_IS_TRIVIAL 1
232 /* Copy the second part of user declarations. */
235 /* Line 219 of yacc.c. */
236 #line 195 "cmCommandArgumentParser.cxx"
238 #if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__)
239 # define YYSIZE_T __SIZE_TYPE__
241 #if ! defined (YYSIZE_T) && defined (size_t)
242 # define YYSIZE_T size_t
244 #if ! defined (YYSIZE_T) && (defined (__STDC__) || defined (__cplusplus))
245 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
246 # define YYSIZE_T size_t
248 #if ! defined (YYSIZE_T)
249 # define YYSIZE_T unsigned int
255 # include <libintl.h> /* INFRINGES ON USER NAME SPACE */
256 # define YY_(msgid) dgettext ("bison-runtime", msgid)
260 # define YY_(msgid) msgid
264 #if ! defined (yyoverflow) || YYERROR_VERBOSE
266 /* The parser invokes alloca or malloc; define the necessary symbols. */
268 # ifdef YYSTACK_USE_ALLOCA
269 # if YYSTACK_USE_ALLOCA
271 # define YYSTACK_ALLOC __builtin_alloca
273 # define YYSTACK_ALLOC alloca
274 # if defined (__STDC__) || defined (__cplusplus)
275 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
276 # define YYINCLUDED_STDLIB_H
282 # ifdef YYSTACK_ALLOC
283 /* Pacify GCC's `empty if-body' warning. */
284 # define YYSTACK_FREE(Ptr) do { /* empty */; } while (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 2005 */
293 # define YYSTACK_ALLOC YYMALLOC
294 # define YYSTACK_FREE YYFREE
295 # ifndef YYSTACK_ALLOC_MAXIMUM
296 # define YYSTACK_ALLOC_MAXIMUM ((YYSIZE_T) -1)
302 # define YYMALLOC malloc
303 # if (! defined (malloc) && ! defined (YYINCLUDED_STDLIB_H) \
304 && (defined (__STDC__) || defined (__cplusplus)))
305 void *malloc (YYSIZE_T
); /* INFRINGES ON USER NAME SPACE */
310 # if (! defined (free) && ! defined (YYINCLUDED_STDLIB_H) \
311 && (defined (__STDC__) || defined (__cplusplus)))
312 void free (void *); /* INFRINGES ON USER NAME SPACE */
319 #endif /* ! defined (yyoverflow) || YYERROR_VERBOSE */
322 #if (! defined (yyoverflow) \
323 && (! defined (__cplusplus) \
324 || (defined (YYSTYPE_IS_TRIVIAL) && YYSTYPE_IS_TRIVIAL)))
326 /* A type that is properly aligned for any stack member. */
333 /* The size of the maximum gap between one aligned stack and the next. */
334 # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
336 /* The size of an array large to enough to hold all stacks, each with
338 # define YYSTACK_BYTES(N) \
339 ((N) * (sizeof (short int) + sizeof (YYSTYPE)) \
340 + YYSTACK_GAP_MAXIMUM)
342 /* Copy COUNT objects from FROM to TO. The source and destination do
345 # if defined (__GNUC__) && 1 < __GNUC__
346 # define YYCOPY(To, From, Count) \
347 __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
349 # define YYCOPY(To, From, Count) \
353 for (yyi = 0; yyi < (Count); yyi++) \
354 (To)[yyi] = (From)[yyi]; \
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
365 # define YYSTACK_RELOCATE(Stack) \
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); \
378 #if defined (__STDC__) || defined (__cplusplus)
379 typedef signed char yysigned_char
;
381 typedef short int yysigned_char
;
384 /* YYFINAL -- State number of the termination state. */
386 /* YYLAST -- Last index in YYTABLE. */
389 /* YYNTOKENS -- Number of terminals. */
391 /* YYNNTS -- Number of nonterminals. */
393 /* YYNRULES -- Number of rules. */
395 /* YYNRULES -- Number of states. */
398 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
400 #define YYMAXUTOK 268
402 #define YYTRANSLATE(YYX) \
403 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
405 /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
406 static const unsigned char yytranslate
[] =
408 0, 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, 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, 2, 2, 2, 2,
430 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
431 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
432 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
433 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
434 5, 6, 7, 8, 9, 10, 11, 12, 13
438 /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
440 static const unsigned char yyprhs
[] =
442 0, 0, 3, 5, 7, 10, 11, 14, 16, 18,
443 20, 22, 24, 26, 28, 30, 34, 38, 40, 41,
447 /* YYRHS -- A `-1'-separated list of the rules' RHS. */
448 static const yysigned_char yyrhs
[] =
450 15, 0, -1, 16, -1, 17, -1, 17, 9, -1,
451 -1, 18, 17, -1, 19, -1, 20, -1, 8, -1,
452 11, -1, 5, -1, 6, -1, 7, -1, 10, -1,
453 3, 21, 7, -1, 4, 21, 7, -1, 13, -1,
454 -1, 22, 21, -1, 8, -1, 20, -1
457 /* YYRLINE[YYN] -- source line where rule number YYN was defined. */
458 static const unsigned char yyrline
[] =
460 0, 95, 95, 102, 107, 113, 117, 123, 128, 134,
461 139, 144, 149, 154, 159, 165, 171, 177, 183, 187,
466 #if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
467 /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
468 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
469 static const char *const yytname
[] =
471 "$end", "error", "$undefined", "cal_NCURLY", "cal_DCURLY", "\"$\"",
472 "\"{\"", "\"}\"", "cal_NAME", "\"\\\\\"", "cal_SYMBOL", "\"@\"",
473 "cal_ERROR", "cal_ATNAME", "$accept", "Start",
474 "GoalWithOptionalBackSlash", "Goal", "String", "OuterText", "Variable",
475 "MultipleIds", "ID", 0
480 /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
482 static const unsigned short int yytoknum
[] =
484 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
489 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
490 static const unsigned char yyr1
[] =
492 0, 14, 15, 16, 16, 17, 17, 18, 18, 19,
493 19, 19, 19, 19, 19, 20, 20, 20, 21, 21,
497 /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
498 static const unsigned char yyr2
[] =
500 0, 2, 1, 1, 2, 0, 2, 1, 1, 1,
501 1, 1, 1, 1, 1, 3, 3, 1, 0, 2,
505 /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
506 STATE-NUM when YYTABLE doesn't specify something else to do. Zero
507 means the default is an error. */
508 static const unsigned char yydefact
[] =
510 5, 18, 18, 11, 12, 13, 9, 14, 10, 17,
511 0, 2, 3, 5, 7, 8, 20, 21, 0, 18,
512 0, 1, 4, 6, 15, 19, 16
515 /* YYDEFGOTO[NTERM-NUM]. */
516 static const yysigned_char yydefgoto
[] =
518 -1, 10, 11, 12, 13, 14, 17, 18, 19
521 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
523 #define YYPACT_NINF -3
524 static const yysigned_char yypact
[] =
526 -1, 12, 12, -3, -3, -3, -3, -3, -3, -3,
527 8, -3, 2, -1, -3, -3, -3, -3, 6, 12,
528 11, -3, -3, -3, -3, -3, -3
531 /* YYPGOTO[NTERM-NUM]. */
532 static const yysigned_char yypgoto
[] =
534 -3, -3, -3, 9, -3, -3, 1, -2, -3
537 /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
538 positive, shift that token. If negative, reduce the rule which
539 number is the opposite. If zero, do what YYDEFACT says.
540 If YYTABLE_NINF, syntax error. */
541 #define YYTABLE_NINF -1
542 static const unsigned char yytable
[] =
544 20, 15, 1, 2, 3, 4, 5, 6, 21, 7,
545 8, 22, 9, 24, 15, 1, 2, 25, 26, 0,
549 static const yysigned_char yycheck
[] =
551 2, 0, 3, 4, 5, 6, 7, 8, 0, 10,
552 11, 9, 13, 7, 13, 3, 4, 19, 7, -1,
553 8, -1, 13, -1, -1, 13
556 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
557 symbol of state STATE-NUM. */
558 static const unsigned char yystos
[] =
560 0, 3, 4, 5, 6, 7, 8, 10, 11, 13,
561 15, 16, 17, 18, 19, 20, 8, 20, 21, 22,
562 21, 0, 9, 17, 7, 21, 7
565 #define yyerrok (yyerrstatus = 0)
566 #define yyclearin (yychar = YYEMPTY)
570 #define YYACCEPT goto yyacceptlab
571 #define YYABORT goto yyabortlab
572 #define YYERROR goto yyerrorlab
575 /* Like YYERROR except do call yyerror. This remains here temporarily
576 to ease the transition to the new meaning of YYERROR, for GCC.
577 Once GCC version 2 has supplanted version 1, this can go. */
579 #define YYFAIL goto yyerrlab
581 #define YYRECOVERING() (!!yyerrstatus)
583 #define YYBACKUP(Token, Value) \
585 if (yychar == YYEMPTY && yylen == 1) \
589 yytoken = YYTRANSLATE (yychar); \
595 yyerror (YY_("syntax error: cannot back up")); \
602 #define YYERRCODE 256
605 /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
606 If N is 0, then set CURRENT to the empty location which ends
607 the previous symbol: RHS[0] (always defined). */
609 #define YYRHSLOC(Rhs, K) ((Rhs)[K])
610 #ifndef YYLLOC_DEFAULT
611 # define YYLLOC_DEFAULT(Current, Rhs, N) \
615 (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \
616 (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \
617 (Current).last_line = YYRHSLOC (Rhs, N).last_line; \
618 (Current).last_column = YYRHSLOC (Rhs, N).last_column; \
622 (Current).first_line = (Current).last_line = \
623 YYRHSLOC (Rhs, 0).last_line; \
624 (Current).first_column = (Current).last_column = \
625 YYRHSLOC (Rhs, 0).last_column; \
631 /* YY_LOCATION_PRINT -- Print the location on the stream.
632 This macro was not mandated originally: define only if we know
633 we won't break user code: when these are the locations we know. */
635 #ifndef YY_LOCATION_PRINT
636 # if YYLTYPE_IS_TRIVIAL
637 # define YY_LOCATION_PRINT(File, Loc) \
638 fprintf (File, "%d.%d-%d.%d", \
639 (Loc).first_line, (Loc).first_column, \
640 (Loc).last_line, (Loc).last_column)
642 # define YY_LOCATION_PRINT(File, Loc) ((void) 0)
647 /* YYLEX -- calling `yylex' with the right arguments. */
650 # define YYLEX yylex (&yylval, YYLEX_PARAM)
652 # define YYLEX yylex (&yylval)
655 /* Enable debugging if requested. */
659 # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
660 # define YYFPRINTF fprintf
663 # define YYDPRINTF(Args) \
669 # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
673 YYFPRINTF (stderr, "%s ", Title); \
674 yysymprint (stderr, \
676 YYFPRINTF (stderr, "\n"); \
680 /*------------------------------------------------------------------.
681 | yy_stack_print -- Print the state stack from its BOTTOM up to its |
683 `------------------------------------------------------------------*/
685 #if defined (__STDC__) || defined (__cplusplus)
687 yy_stack_print (short int *bottom
, short int *top
)
690 yy_stack_print (bottom
, top
)
695 YYFPRINTF (stderr
, "Stack now");
696 for (/* Nothing. */; bottom
<= top
; ++bottom
)
697 YYFPRINTF (stderr
, " %d", *bottom
);
698 YYFPRINTF (stderr
, "\n");
701 # define YY_STACK_PRINT(Bottom, Top) \
704 yy_stack_print ((Bottom), (Top)); \
708 /*------------------------------------------------.
709 | Report that the YYRULE is going to be reduced. |
710 `------------------------------------------------*/
712 #if defined (__STDC__) || defined (__cplusplus)
714 yy_reduce_print (int yyrule
)
717 yy_reduce_print (yyrule
)
722 unsigned long int yylno
= yyrline
[yyrule
];
723 YYFPRINTF (stderr
, "Reducing stack by rule %d (line %lu), ",
725 /* Print the symbols being reduced, and their result. */
726 for (yyi
= yyprhs
[yyrule
]; 0 <= yyrhs
[yyi
]; yyi
++)
727 YYFPRINTF (stderr
, "%s ", yytname
[yyrhs
[yyi
]]);
728 YYFPRINTF (stderr
, "-> %s\n", yytname
[yyr1
[yyrule
]]);
731 # define YY_REDUCE_PRINT(Rule) \
734 yy_reduce_print (Rule); \
737 /* Nonzero means print parse trace. It is left uninitialized so that
738 multiple parsers can coexist. */
741 # define YYDPRINTF(Args)
742 # define YY_SYMBOL_PRINT(Title, Type, Value, Location)
743 # define YY_STACK_PRINT(Bottom, Top)
744 # define YY_REDUCE_PRINT(Rule)
745 #endif /* !YYDEBUG */
748 /* YYINITDEPTH -- initial size of the parser's stacks. */
750 # define YYINITDEPTH 200
753 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
754 if the built-in stack extension method is used).
756 Do not make this value too large; the results are undefined if
757 YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
758 evaluated with infinite-precision integer arithmetic. */
761 # define YYMAXDEPTH 10000
769 # if defined (__GLIBC__) && defined (_STRING_H)
770 # define yystrlen strlen
772 /* Return the length of YYSTR. */
774 # if defined (__STDC__) || defined (__cplusplus)
775 yystrlen (const char *yystr
)
781 const char *yys
= yystr
;
783 while (*yys
++ != '\0')
786 return yys
- yystr
- 1;
792 # if defined (__GLIBC__) && defined (_STRING_H) && defined (_GNU_SOURCE)
793 # define yystpcpy stpcpy
795 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
798 # if defined (__STDC__) || defined (__cplusplus)
799 yystpcpy (char *yydest
, const char *yysrc
)
801 yystpcpy (yydest
, yysrc
)
807 const char *yys
= yysrc
;
809 while ((*yyd
++ = *yys
++) != '\0')
818 /* Copy to YYRES the contents of YYSTR after stripping away unnecessary
819 quotes and backslashes, so that it's suitable for yyerror. The
820 heuristic is that double-quoting is unnecessary unless the string
821 contains an apostrophe, a comma, or backslash (other than
822 backslash-backslash). YYSTR is taken from yytname. If YYRES is
823 null, do not copy; instead, return the length of what the result
826 yytnamerr (char *yyres
, const char *yystr
)
831 char const *yyp
= yystr
;
838 goto do_not_strip_quotes
;
842 goto do_not_strip_quotes
;
855 do_not_strip_quotes
: ;
859 return yystrlen (yystr
);
861 return yystpcpy (yyres
, yystr
) - yyres
;
865 #endif /* YYERROR_VERBOSE */
870 /*--------------------------------.
871 | Print this symbol on YYOUTPUT. |
872 `--------------------------------*/
874 #if defined (__STDC__) || defined (__cplusplus)
876 yysymprint (FILE *yyoutput
, int yytype
, YYSTYPE
*yyvaluep
)
879 yysymprint (yyoutput
, yytype
, yyvaluep
)
885 /* Pacify ``unused variable'' warnings. */
888 if (yytype
< YYNTOKENS
)
889 YYFPRINTF (yyoutput
, "token %s (", yytname
[yytype
]);
891 YYFPRINTF (yyoutput
, "nterm %s (", yytname
[yytype
]);
895 if (yytype
< YYNTOKENS
)
896 YYPRINT (yyoutput
, yytoknum
[yytype
], *yyvaluep
);
903 YYFPRINTF (yyoutput
, ")");
906 #endif /* ! YYDEBUG */
907 /*-----------------------------------------------.
908 | Release the memory associated to this symbol. |
909 `-----------------------------------------------*/
911 #if defined (__STDC__) || defined (__cplusplus)
913 yydestruct (const char *yymsg
, int yytype
, YYSTYPE
*yyvaluep
)
916 yydestruct (yymsg
, yytype
, yyvaluep
)
922 /* Pacify ``unused variable'' warnings. */
927 YY_SYMBOL_PRINT (yymsg
, yytype
, yyvaluep
, yylocationp
);
938 /* Prevent warnings from -Wmissing-prototypes. */
941 # if defined (__STDC__) || defined (__cplusplus)
942 int yyparse (void *YYPARSE_PARAM
);
946 #else /* ! YYPARSE_PARAM */
947 #if defined (__STDC__) || defined (__cplusplus)
952 #endif /* ! YYPARSE_PARAM */
964 # if defined (__STDC__) || defined (__cplusplus)
965 int yyparse (void *YYPARSE_PARAM
)
967 int yyparse (YYPARSE_PARAM
)
970 #else /* ! YYPARSE_PARAM */
971 #if defined (__STDC__) || defined (__cplusplus)
981 /* The look-ahead symbol. */
984 /* The semantic value of the look-ahead symbol. */
987 /* Number of syntax errors so far. */
993 /* Number of tokens to shift before error messages enabled. */
995 /* Look-ahead token as an internal (translated) token number. */
998 /* Three stacks and their tools:
999 `yyss': related to states,
1000 `yyvs': related to semantic values,
1001 `yyls': related to locations.
1003 Refer to the stacks thru separate pointers, to allow yyoverflow
1004 to reallocate them elsewhere. */
1006 /* The state stack. */
1007 short int yyssa
[YYINITDEPTH
];
1008 short int *yyss
= yyssa
;
1011 /* The semantic value stack. */
1012 YYSTYPE yyvsa
[YYINITDEPTH
];
1013 YYSTYPE
*yyvs
= yyvsa
;
1018 #define YYPOPSTACK (yyvsp--, yyssp--)
1020 YYSIZE_T yystacksize
= YYINITDEPTH
;
1022 /* The variables used to return semantic value and location from the
1027 /* When reducing, the number of symbols on the RHS of the reduced
1031 YYDPRINTF ((stderr
, "Starting parse\n"));
1036 yychar
= YYEMPTY
; /* Cause a token to be read. */
1038 /* Initialize stack pointers.
1039 Waste one element of value and location stack
1040 so that they stay on the same level as the state stack.
1041 The wasted elements are never initialized. */
1048 /*------------------------------------------------------------.
1049 | yynewstate -- Push a new state, which is found in yystate. |
1050 `------------------------------------------------------------*/
1052 /* In all cases, when you get here, the value and location stacks
1053 have just been pushed. so pushing a state here evens the stacks.
1060 if (yyss
+ yystacksize
- 1 <= yyssp
)
1062 /* Get the current used size of the three stacks, in elements. */
1063 YYSIZE_T yysize
= yyssp
- yyss
+ 1;
1067 /* Give user a chance to reallocate the stack. Use copies of
1068 these so that the &'s don't force the real ones into
1070 YYSTYPE
*yyvs1
= yyvs
;
1071 short int *yyss1
= yyss
;
1074 /* Each stack pointer address is followed by the size of the
1075 data in use in that stack, in bytes. This used to be a
1076 conditional around just the two extra args, but that might
1077 be undefined if yyoverflow is a macro. */
1078 yyoverflow (YY_("memory exhausted"),
1079 &yyss1
, yysize
* sizeof (*yyssp
),
1080 &yyvs1
, yysize
* sizeof (*yyvsp
),
1087 #else /* no yyoverflow */
1088 # ifndef YYSTACK_RELOCATE
1089 goto yyexhaustedlab
;
1091 /* Extend the stack our own way. */
1092 if (YYMAXDEPTH
<= yystacksize
)
1093 goto yyexhaustedlab
;
1095 if (YYMAXDEPTH
< yystacksize
)
1096 yystacksize
= YYMAXDEPTH
;
1099 short int *yyss1
= yyss
;
1100 union yyalloc
*yyptr
=
1101 (union yyalloc
*) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize
));
1103 goto yyexhaustedlab
;
1104 YYSTACK_RELOCATE (yyss
);
1105 YYSTACK_RELOCATE (yyvs
);
1107 # undef YYSTACK_RELOCATE
1109 YYSTACK_FREE (yyss1
);
1112 #endif /* no yyoverflow */
1114 yyssp
= yyss
+ yysize
- 1;
1115 yyvsp
= yyvs
+ yysize
- 1;
1118 YYDPRINTF ((stderr
, "Stack size increased to %lu\n",
1119 (unsigned long int) yystacksize
));
1121 if (yyss
+ yystacksize
- 1 <= yyssp
)
1125 YYDPRINTF ((stderr
, "Entering state %d\n", yystate
));
1134 /* Do appropriate processing given the current state. */
1135 /* Read a look-ahead token if we need one and don't already have one. */
1138 /* First try to decide what to do without reference to look-ahead token. */
1140 yyn
= yypact
[yystate
];
1141 if (yyn
== YYPACT_NINF
)
1144 /* Not known => get a look-ahead token if don't already have one. */
1146 /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */
1147 if (yychar
== YYEMPTY
)
1149 YYDPRINTF ((stderr
, "Reading a token: "));
1153 if (yychar
<= YYEOF
)
1155 yychar
= yytoken
= YYEOF
;
1156 YYDPRINTF ((stderr
, "Now at end of input.\n"));
1160 yytoken
= YYTRANSLATE (yychar
);
1161 YY_SYMBOL_PRINT ("Next token is", yytoken
, &yylval
, &yylloc
);
1164 /* If the proper action on seeing token YYTOKEN is to reduce or to
1165 detect an error, take that action. */
1167 if (yyn
< 0 || YYLAST
< yyn
|| yycheck
[yyn
] != yytoken
)
1172 if (yyn
== 0 || yyn
== YYTABLE_NINF
)
1181 /* Shift the look-ahead token. */
1182 YY_SYMBOL_PRINT ("Shifting", yytoken
, &yylval
, &yylloc
);
1184 /* Discard the token being shifted unless it is eof. */
1185 if (yychar
!= YYEOF
)
1191 /* Count tokens shifted since error; after three, turn off error
1200 /*-----------------------------------------------------------.
1201 | yydefault -- do the default action for the current state. |
1202 `-----------------------------------------------------------*/
1204 yyn
= yydefact
[yystate
];
1210 /*-----------------------------.
1211 | yyreduce -- Do a reduction. |
1212 `-----------------------------*/
1214 /* yyn is the number of a rule to reduce with. */
1217 /* If YYLEN is nonzero, implement the default value of the action:
1220 Otherwise, the following line sets YYVAL to garbage.
1221 This behavior is undocumented and Bison
1222 users should not rely upon it. Assigning to YYVAL
1223 unconditionally makes the parser a bit smaller, and it avoids a
1224 GCC warning that YYVAL may be used uninitialized. */
1225 yyval
= yyvsp
[1-yylen
];
1228 YY_REDUCE_PRINT (yyn
);
1232 #line 96 "cmCommandArgumentParser.y"
1235 yyGetParser
->SetResult((yyvsp
[0].str
));
1240 #line 103 "cmCommandArgumentParser.y"
1242 (yyval
.str
) = (yyvsp
[0].str
);
1247 #line 108 "cmCommandArgumentParser.y"
1249 (yyval
.str
) = yyGetParser
->CombineUnions((yyvsp
[-1].str
), (yyvsp
[0].str
));
1254 #line 113 "cmCommandArgumentParser.y"
1261 #line 118 "cmCommandArgumentParser.y"
1263 (yyval
.str
) = yyGetParser
->CombineUnions((yyvsp
[-1].str
), (yyvsp
[0].str
));
1268 #line 124 "cmCommandArgumentParser.y"
1270 (yyval
.str
) = (yyvsp
[0].str
);
1275 #line 129 "cmCommandArgumentParser.y"
1277 (yyval
.str
) = (yyvsp
[0].str
);
1282 #line 135 "cmCommandArgumentParser.y"
1284 (yyval
.str
) = (yyvsp
[0].str
);
1289 #line 140 "cmCommandArgumentParser.y"
1291 (yyval
.str
) = (yyvsp
[0].str
);
1296 #line 145 "cmCommandArgumentParser.y"
1298 (yyval
.str
) = (yyvsp
[0].str
);
1303 #line 150 "cmCommandArgumentParser.y"
1305 (yyval
.str
) = (yyvsp
[0].str
);
1310 #line 155 "cmCommandArgumentParser.y"
1312 (yyval
.str
) = (yyvsp
[0].str
);
1317 #line 160 "cmCommandArgumentParser.y"
1319 (yyval
.str
) = (yyvsp
[0].str
);
1324 #line 166 "cmCommandArgumentParser.y"
1327 yyGetParser
->ExpandSpecialVariable((yyvsp
[-2].str
),(yyvsp
[-1].str
));
1328 //std::cerr << __LINE__ << " here: [" << $<str>1 << "] [" << $<str>2 << "]
1329 //[" << $<str>3 << "]" << std::endl;
1334 #line 172 "cmCommandArgumentParser.y"
1336 (yyval
.str
) = yyGetParser
->ExpandVariable((yyvsp
[-1].str
));
1337 //std::cerr << __LINE__ << " here: [" << $<str>1 << "] [" << $<str>2 << "]
1338 //[" << $<str>3 << "]" << std::endl;
1343 #line 178 "cmCommandArgumentParser.y"
1345 (yyval
.str
) = yyGetParser
->ExpandVariableForAt((yyvsp
[0].str
));
1350 #line 183 "cmCommandArgumentParser.y"
1357 #line 188 "cmCommandArgumentParser.y"
1359 (yyval
.str
) = yyGetParser
->CombineUnions((yyvsp
[-1].str
), (yyvsp
[0].str
));
1364 #line 194 "cmCommandArgumentParser.y"
1366 (yyval
.str
) = (yyvsp
[0].str
);
1371 #line 199 "cmCommandArgumentParser.y"
1373 (yyval
.str
) = (yyvsp
[0].str
);
1381 /* Line 1126 of yacc.c. */
1382 #line 1338 "cmCommandArgumentParser.cxx"
1388 YY_STACK_PRINT (yyss
, yyssp
);
1393 /* Now `shift' the result of the reduction. Determine what state
1394 that goes to, based on the state we popped back to and the rule
1395 number reduced by. */
1399 yystate
= yypgoto
[yyn
- YYNTOKENS
] + *yyssp
;
1400 if (0 <= yystate
&& yystate
<= YYLAST
&& yycheck
[yystate
] == *yyssp
)
1401 yystate
= yytable
[yystate
];
1403 yystate
= yydefgoto
[yyn
- YYNTOKENS
];
1408 /*------------------------------------.
1409 | yyerrlab -- here on detecting error |
1410 `------------------------------------*/
1412 /* If not already recovering from an error, report this error. */
1417 yyn
= yypact
[yystate
];
1419 if (YYPACT_NINF
< yyn
&& yyn
< YYLAST
)
1421 int yytype
= YYTRANSLATE (yychar
);
1422 YYSIZE_T yysize0
= yytnamerr (0, yytname
[yytype
]);
1423 YYSIZE_T yysize
= yysize0
;
1425 int yysize_overflow
= 0;
1427 # define YYERROR_VERBOSE_ARGS_MAXIMUM 5
1428 char const *yyarg
[YYERROR_VERBOSE_ARGS_MAXIMUM
];
1432 /* This is so xgettext sees the translatable formats that are
1433 constructed on the fly. */
1434 YY_("syntax error, unexpected %s");
1435 YY_("syntax error, unexpected %s, expecting %s");
1436 YY_("syntax error, unexpected %s, expecting %s or %s");
1437 YY_("syntax error, unexpected %s, expecting %s or %s or %s");
1438 YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s");
1442 static char const yyunexpected
[] = "syntax error, unexpected %s";
1443 static char const yyexpecting
[] = ", expecting %s";
1444 static char const yyor
[] = " or %s";
1445 char yyformat
[sizeof yyunexpected
1446 + sizeof yyexpecting
- 1
1447 + ((YYERROR_VERBOSE_ARGS_MAXIMUM
- 2)
1448 * (sizeof yyor
- 1))];
1449 char const *yyprefix
= yyexpecting
;
1451 /* Start YYX at -YYN if negative to avoid negative indexes in
1453 int yyxbegin
= yyn
< 0 ? -yyn
: 0;
1455 /* Stay within bounds of both yycheck and yytname. */
1456 int yychecklim
= YYLAST
- yyn
;
1457 int yyxend
= yychecklim
< YYNTOKENS
? yychecklim
: YYNTOKENS
;
1460 yyarg
[0] = yytname
[yytype
];
1461 yyfmt
= yystpcpy (yyformat
, yyunexpected
);
1463 for (yyx
= yyxbegin
; yyx
< yyxend
; ++yyx
)
1464 if (yycheck
[yyx
+ yyn
] == yyx
&& yyx
!= YYTERROR
)
1466 if (yycount
== YYERROR_VERBOSE_ARGS_MAXIMUM
)
1470 yyformat
[sizeof yyunexpected
- 1] = '\0';
1473 yyarg
[yycount
++] = yytname
[yyx
];
1474 yysize1
= yysize
+ yytnamerr (0, yytname
[yyx
]);
1475 yysize_overflow
|= yysize1
< yysize
;
1477 yyfmt
= yystpcpy (yyfmt
, yyprefix
);
1481 yyf
= YY_(yyformat
);
1482 yysize1
= yysize
+ yystrlen (yyf
);
1483 yysize_overflow
|= yysize1
< yysize
;
1486 if (!yysize_overflow
&& yysize
<= YYSTACK_ALLOC_MAXIMUM
)
1487 yymsg
= (char *) YYSTACK_ALLOC (yysize
);
1490 /* Avoid sprintf, as that infringes on the user's name space.
1491 Don't have undefined behavior even if the translation
1492 produced a string with the wrong number of "%s"s. */
1495 while ((*yyp
= *yyf
))
1497 if (*yyp
== '%' && yyf
[1] == 's' && yyi
< yycount
)
1499 yyp
+= yytnamerr (yyp
, yyarg
[yyi
++]);
1509 YYSTACK_FREE (yymsg
);
1513 yyerror (YY_("syntax error"));
1514 goto yyexhaustedlab
;
1518 #endif /* YYERROR_VERBOSE */
1519 yyerror (YY_("syntax error"));
1524 if (yyerrstatus
== 3)
1526 /* If just tried and failed to reuse look-ahead token after an
1527 error, discard it. */
1529 if (yychar
<= YYEOF
)
1531 /* Return failure if at end of input. */
1532 if (yychar
== YYEOF
)
1537 yydestruct ("Error: discarding", yytoken
, &yylval
);
1542 /* Else will try to reuse look-ahead token after shifting the error
1547 /*---------------------------------------------------.
1548 | yyerrorlab -- error raised explicitly by YYERROR. |
1549 `---------------------------------------------------*/
1552 /* Pacify compilers like GCC when the user code never invokes
1553 YYERROR and the label yyerrorlab therefore never appears in user
1564 /*-------------------------------------------------------------.
1565 | yyerrlab1 -- common code for both syntax error and YYERROR. |
1566 `-------------------------------------------------------------*/
1568 yyerrstatus
= 3; /* Each real token shifted decrements this. */
1572 yyn
= yypact
[yystate
];
1573 if (yyn
!= YYPACT_NINF
)
1576 if (0 <= yyn
&& yyn
<= YYLAST
&& yycheck
[yyn
] == YYTERROR
)
1584 /* Pop the current state because it cannot handle the error token. */
1589 yydestruct ("Error: popping", yystos
[yystate
], yyvsp
);
1592 YY_STACK_PRINT (yyss
, yyssp
);
1601 /* Shift the error token. */
1602 YY_SYMBOL_PRINT ("Shifting", yystos
[yyn
], yyvsp
, yylsp
);
1608 /*-------------------------------------.
1609 | yyacceptlab -- YYACCEPT comes here. |
1610 `-------------------------------------*/
1615 /*-----------------------------------.
1616 | yyabortlab -- YYABORT comes here. |
1617 `-----------------------------------*/
1623 /*-------------------------------------------------.
1624 | yyexhaustedlab -- memory exhaustion comes here. |
1625 `-------------------------------------------------*/
1627 yyerror (YY_("memory exhausted"));
1633 if (yychar
!= YYEOF
&& yychar
!= YYEMPTY
)
1634 yydestruct ("Cleanup: discarding lookahead",
1636 while (yyssp
!= yyss
)
1638 yydestruct ("Cleanup: popping",
1639 yystos
[*yyssp
], yyvsp
);
1644 YYSTACK_FREE (yyss
);
1650 #line 204 "cmCommandArgumentParser.y"
1652 /* End of grammar */
1654 /*--------------------------------------------------------------------------*/
1655 void cmCommandArgumentError(yyscan_t yyscanner
, const char* message
)
1657 yyGetParser
->Error(message
);