2 /*=========================================================================
4 Program: CMake - Cross-Platform Makefile Generator
5 Module: $RCSfile: cmCommandArgumentParser.y,v $
7 Date: $Date: 2008-12-18 14:58:01 $
8 Version: $Revision: 1.12 $
10 Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved.
11 See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details.
13 This software is distributed WITHOUT ANY WARRANTY; without even
14 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15 PURPOSE. See the above copyright notices for more information.
17 =========================================================================*/
20 This file must be translated to C and modified to build everywhere.
24 bison --yacc --name-prefix=cmCommandArgument_yy --defines=cmCommandArgumentParserTokens.h -ocmCommandArgumentParser.cxx cmCommandArgumentParser.y
26 Modify cmCommandArgumentParser.cxx:
28 - put header block at top of file
32 #include "cmStandardIncludes.h"
34 /* Configure the parser to use a lexer object. */
35 #define YYPARSE_PARAM yyscanner
36 #define YYLEX_PARAM yyscanner
37 #define YYERROR_VERBOSE 1
38 #define cmCommandArgument_yyerror(x) \
39 cmCommandArgumentError
(yyscanner
, x
)
40 #define yyGetParser (cmCommandArgument_yyget_extra(yyscanner))
42 /* Make sure malloc and free are available on QNX. */
47 /* Make sure the parser uses standard memory allocation. The default
48 generated parser malloc/free declarations do not work on all
51 #define YYMALLOC malloc
54 /*-------------------------------------------------------------------------*/
55 #include "cmCommandArgumentParserHelper.h" /* Interface to parser object. */
56 #include "cmCommandArgumentLexer.h" /* Interface to lexer object. */
57 #include "cmCommandArgumentParserTokens.h" /* Need YYSTYPE for YY_DECL. */
59 /* Forward declare the lexer entry point. */
62 /* Internal utility functions. */
63 static void cmCommandArgumentError
(yyscan_t yyscanner
, const char* message
);
66 /* Configure the parser to support large input. */
67 #define YYMAXDEPTH 100000
68 #define YYINITDEPTH 10000
70 /* Disable some warnings in the generated code. */
72 # pragma warn -8004 /* Variable assigned a value that is not used. */
73 # pragma warn -8008 /* condition always returns true */
74 # pragma warn -8060 /* possibly incorrect assignment */
75 # pragma warn -8066 /* unreachable code */
78 # pragma warning (disable: 4102) /* Unused goto label. */
79 # pragma warning (disable: 4065) /* Switch statement contains default but no
81 # pragma warning (disable: 4244) /* loss of precision */
82 # pragma warning (disable: 4702) /* unreachable code */
86 /* Generate a reentrant parser object. */
95 /*-------------------------------------------------------------------------*/
100 %token cal_DOLLAR
"$"
101 %token cal_LCURLY
"{"
102 %token cal_RCURLY
"}"
104 %token cal_BSLASH
"\\"
110 /*-------------------------------------------------------------------------*/
116 GoalWithOptionalBackSlash
119 yyGetParser
->SetResult
($
<str
>1);
122 GoalWithOptionalBackSlash:
130 $
<str
>$
= yyGetParser
->CombineUnions
($
<str
>1, $
<str
>2);
140 $
<str
>$
= yyGetParser
->CombineUnions
($
<str
>1, $
<str
>2);
186 cal_ENVCURLY EnvVarName cal_RCURLY
188 $
<str
>$
= yyGetParser
->ExpandSpecialVariable
($
<str
>1,$
<str
>2);
189 //std::cerr << __LINE__ << " here: [" << $<str>1 << "] [" << $<str>2 << "] [" << $<str>3 << "]" << std::endl;
192 cal_NCURLY MultipleIds cal_RCURLY
194 $
<str
>$
= yyGetParser
->ExpandSpecialVariable
($
<str
>1,$
<str
>2);
195 //std::cerr << __LINE__ << " here: [" << $<str>1 << "] [" << $<str>2 << "] [" << $<str>3 << "]" << std::endl;
198 cal_DCURLY MultipleIds cal_RCURLY
200 $
<str
>$
= yyGetParser
->ExpandVariable
($
<str
>2);
201 //std::cerr << __LINE__ << " here: [" << $<str>1 << "] [" << $<str>2 << "] [" << $<str>3 << "]" << std::endl;
206 $
<str
>$
= yyGetParser
->ExpandVariableForAt
($
<str
>1);
215 cal_SYMBOL EnvVarName
227 $
<str
>$
= yyGetParser
->CombineUnions
($
<str
>1, $
<str
>2);
245 /*--------------------------------------------------------------------------*/
246 void cmCommandArgumentError
(yyscan_t yyscanner
, const char* message
)
248 yyGetParser
->Error
(message
);