2 /*=========================================================================
4 Program: CMake - Cross-Platform Makefile Generator
5 Module: $RCSfile: cmCommandArgumentParser.y,v $
7 Date: $Date: 2006-10-04 18:37:41 $
8 Version: $Revision: 1.10 $
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:
31 #include "cmStandardIncludes.h"
33 /* Configure the parser to use a lexer object. */
34 #define YYPARSE_PARAM yyscanner
35 #define YYLEX_PARAM yyscanner
36 #define YYERROR_VERBOSE 1
37 #define cmCommandArgument_yyerror(x) \
38 cmCommandArgumentError
(yyscanner
, x
)
39 #define yyGetParser (cmCommandArgument_yyget_extra(yyscanner))
41 /* Make sure malloc and free are available on QNX. */
46 /* Make sure the parser uses standard memory allocation. The default
47 generated parser malloc/free declarations do not work on all
50 #define YYMALLOC malloc
53 /*-------------------------------------------------------------------------*/
54 #include "cmCommandArgumentParserHelper.h" /* Interface to parser object. */
55 #include "cmCommandArgumentLexer.h" /* Interface to lexer object. */
56 #include "cmCommandArgumentParserTokens.h" /* Need YYSTYPE for YY_DECL. */
58 /* Forward declare the lexer entry point. */
61 /* Internal utility functions. */
62 static void cmCommandArgumentError
(yyscan_t yyscanner
, const char* message
);
65 //#define YYMAXDEPTH 100000
66 //#define YYINITDEPTH 10000
69 /* Disable some warnings in the generated code. */
71 # pragma warn -8004 /* Variable assigned a value that is not used. */
72 # pragma warn -8008 /* condition always returns true */
73 # pragma warn -8060 /* possibly incorrect assignment */
74 # pragma warn -8066 /* unreachable code */
77 # pragma warning (disable: 4102) /* Unused goto label. */
78 # pragma warning (disable: 4065) /* Switch statement contains default but no
83 /* Generate a reentrant parser object. */
92 /*-------------------------------------------------------------------------*/
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_NCURLY MultipleIds 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_DCURLY MultipleIds cal_RCURLY
190 $
<str
>$
= yyGetParser
->ExpandVariable
($
<str
>2);
191 //std::cerr << __LINE__ << " here: [" << $<str>1 << "] [" << $<str>2 << "] [" << $<str>3 << "]" << std::endl;
196 $
<str
>$
= yyGetParser
->ExpandVariableForAt
($
<str
>1);
206 $
<str
>$
= yyGetParser
->CombineUnions
($
<str
>1, $
<str
>2);
224 /*--------------------------------------------------------------------------*/
225 void cmCommandArgumentError
(yyscan_t yyscanner
, const char* message
)
227 yyGetParser
->Error
(message
);