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 - put header block at top of file
27 #include "cmStandardIncludes.h"
29 /* Configure the parser to use a lexer object. */
30 #define YYPARSE_PARAM yyscanner
31 #define YYLEX_PARAM yyscanner
32 #define YYERROR_VERBOSE 1
33 #define cmCommandArgument_yyerror(x) \
34 cmCommandArgumentError(yyscanner, x)
35 #define yyGetParser (cmCommandArgument_yyget_extra(yyscanner))
37 /* Make sure malloc and free are available on QNX. */
42 /* Make sure the parser uses standard memory allocation. The default
43 generated parser malloc/free declarations do not work on all
46 #define YYMALLOC malloc
49 /*-------------------------------------------------------------------------*/
50 #include "cmCommandArgumentParserHelper.h" /* Interface to parser object. */
51 #include "cmCommandArgumentLexer.h" /* Interface to lexer object. */
52 #include "cmCommandArgumentParserTokens.h" /* Need YYSTYPE for YY_DECL. */
54 /* Forward declare the lexer entry point. */
57 /* Internal utility functions. */
58 static void cmCommandArgumentError(yyscan_t yyscanner, const char* message);
61 /* Configure the parser to support large input. */
62 #define YYMAXDEPTH 100000
63 #define YYINITDEPTH 10000
65 /* Disable some warnings in the generated code. */
67 # pragma warn -8004 /* Variable assigned a value that is not used. */
68 # pragma warn -8008 /* condition always returns true */
69 # pragma warn -8060 /* possibly incorrect assignment */
70 # pragma warn -8066 /* unreachable code */
73 # pragma warning (disable: 4102) /* Unused goto label. */
74 # pragma warning (disable: 4065) /* Switch statement contains default but no
76 # pragma warning (disable: 4244) /* loss of precision */
77 # pragma warning (disable: 4702) /* unreachable code */
81 /* Generate a reentrant parser object. */
90 /*-------------------------------------------------------------------------*/
99 %token cal_BSLASH "\\"
105 /*-------------------------------------------------------------------------*/
111 GoalWithOptionalBackSlash
114 yyGetParser->SetResult($<str>1);
117 GoalWithOptionalBackSlash:
125 $<str>$ = yyGetParser->CombineUnions($<str>1, $<str>2);
135 $<str>$ = yyGetParser->CombineUnions($<str>1, $<str>2);
181 cal_ENVCURLY EnvVarName cal_RCURLY
183 $<str>$ = yyGetParser->ExpandSpecialVariable($<str>1,$<str>2);
184 //std::cerr << __LINE__ << " here: [" << $<str>1 << "] [" << $<str>2 << "] [" << $<str>3 << "]" << std::endl;
187 cal_NCURLY MultipleIds cal_RCURLY
189 $<str>$ = yyGetParser->ExpandSpecialVariable($<str>1,$<str>2);
190 //std::cerr << __LINE__ << " here: [" << $<str>1 << "] [" << $<str>2 << "] [" << $<str>3 << "]" << std::endl;
193 cal_DCURLY MultipleIds cal_RCURLY
195 $<str>$ = yyGetParser->ExpandVariable($<str>2);
196 //std::cerr << __LINE__ << " here: [" << $<str>1 << "] [" << $<str>2 << "] [" << $<str>3 << "]" << std::endl;
201 $<str>$ = yyGetParser->ExpandVariableForAt($<str>1);
210 cal_SYMBOL EnvVarName
222 $<str>$ = yyGetParser->CombineUnions($<str>1, $<str>2);
240 /*--------------------------------------------------------------------------*/
241 void cmCommandArgumentError(yyscan_t yyscanner, const char* message)
243 yyGetParser->Error(message);