2 /*============================================================================
3 CMake - Cross Platform Makefile Generator
4 Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
6 Distributed under the OSI-approved BSD License (the "License");
7 see accompanying file Copyright.txt for details.
9 This software is distributed WITHOUT ANY WARRANTY; without even the
10 implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
11 See the License for more information.
12 ============================================================================*/
15 This file must be translated to C and modified to build everywhere.
19 bison --yacc --name-prefix=cmCommandArgument_yy --defines=cmCommandArgumentParserTokens.h -ocmCommandArgumentParser.cxx cmCommandArgumentParser.y
21 Modify cmCommandArgumentParser.cxx:
23 - remove use of the 'register' storage class specifier
24 - put header block at top of file
28 #include "cmStandardIncludes.h"
30 /* Configure the parser to use a lexer object. */
31 #define YYPARSE_PARAM yyscanner
32 #define YYLEX_PARAM yyscanner
33 #define YYERROR_VERBOSE 1
34 #define cmCommandArgument_yyerror(x) \
35 cmCommandArgumentError(yyscanner, x)
36 #define yyGetParser (cmCommandArgument_yyget_extra(yyscanner))
38 /* Make sure malloc and free are available on QNX. */
43 /* Make sure the parser uses standard memory allocation. The default
44 generated parser malloc/free declarations do not work on all
47 #define YYMALLOC malloc
50 /*-------------------------------------------------------------------------*/
51 #include "cmCommandArgumentParserHelper.h" /* Interface to parser object. */
52 #include "cmCommandArgumentLexer.h" /* Interface to lexer object. */
53 #include "cmCommandArgumentParserTokens.h" /* Need YYSTYPE for YY_DECL. */
55 /* Forward declare the lexer entry point. */
58 /* Internal utility functions. */
59 static void cmCommandArgumentError(yyscan_t yyscanner, const char* message);
62 /* Configure the parser to support large input. */
63 #define YYMAXDEPTH 100000
64 #define YYINITDEPTH 10000
66 /* Disable some warnings in the generated code. */
68 # pragma warn -8004 /* Variable assigned a value that is not used. */
69 # pragma warn -8008 /* condition always returns true */
70 # pragma warn -8060 /* possibly incorrect assignment */
71 # pragma warn -8066 /* unreachable code */
74 # pragma warning (disable: 4102) /* Unused goto label. */
75 # pragma warning (disable: 4065) /* Switch statement contains default but no
77 # pragma warning (disable: 4244) /* loss of precision */
78 # pragma warning (disable: 4702) /* unreachable code */
82 /* Generate a reentrant parser object. */
91 /*-------------------------------------------------------------------------*/
100 %token cal_BSLASH "\\"
106 /*-------------------------------------------------------------------------*/
112 GoalWithOptionalBackSlash
115 yyGetParser->SetResult($<str>1);
118 GoalWithOptionalBackSlash:
126 $<str>$ = yyGetParser->CombineUnions($<str>1, $<str>2);
136 $<str>$ = yyGetParser->CombineUnions($<str>1, $<str>2);
182 cal_ENVCURLY EnvVarName cal_RCURLY
184 $<str>$ = yyGetParser->ExpandSpecialVariable($<str>1,$<str>2);
185 //std::cerr << __LINE__ << " here: [" << $<str>1 << "] [" << $<str>2 << "] [" << $<str>3 << "]" << std::endl;
188 cal_NCURLY MultipleIds cal_RCURLY
190 $<str>$ = yyGetParser->ExpandSpecialVariable($<str>1,$<str>2);
191 //std::cerr << __LINE__ << " here: [" << $<str>1 << "] [" << $<str>2 << "] [" << $<str>3 << "]" << std::endl;
194 cal_DCURLY MultipleIds cal_RCURLY
196 $<str>$ = yyGetParser->ExpandVariable($<str>2);
197 //std::cerr << __LINE__ << " here: [" << $<str>1 << "] [" << $<str>2 << "] [" << $<str>3 << "]" << std::endl;
202 $<str>$ = yyGetParser->ExpandVariableForAt($<str>1);
211 cal_SYMBOL EnvVarName
223 $<str>$ = yyGetParser->CombineUnions($<str>1, $<str>2);
241 /*--------------------------------------------------------------------------*/
242 void cmCommandArgumentError(yyscan_t yyscanner, const char* message)
244 yyGetParser->Error(message);