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 flex --prefix=cmCommandArgument_yy --header-file=cmCommandArgumentLexer.h -ocmCommandArgumentLexer.cxx cmCommandArgumentLexer.in.l
21 Modify cmCommandArgumentLexer.cxx:
22 - add #include "cmStandardIncludes.h" to top of file
23 - put header block at top of file
25 - remove "yyscanner" argument from these methods:
26 yy_fatal_error, cmCommandArgument_yyalloc, cmCommandArgument_yyrealloc, cmCommandArgument_yyfree
27 - remove all YY_BREAK lines occurring right after return statements
28 - change while ( 1 ) to for(;;)
29 - add "return 0;" to end of cmCommandArgument_yylex
31 Modify cmCommandArgumentLexer.h:
33 - remove the yy_init_globals function
34 - remove the block that includes unistd.h
35 - remove #line directives (avoids bogus warning on old Sun)
39 #include "cmStandardLexer.h"
41 #include "cmCommandArgumentParserHelper.h"
43 /* Replace the lexer input function. */
45 #define YY_INPUT(buf, result, max_size) \
46 { result = yyextra->LexInput(buf, max_size); }
48 /* Include the set of tokens from the parser. */
49 #include "cmCommandArgumentParserTokens.h"
51 /*--------------------------------------------------------------------------*/
64 //std::cerr << __LINE__ << " here: [" << yytext << "]" << std::endl;
65 yyextra->AllocateParserType(yylvalp, yytext+1, strlen(yytext)-2);
69 \$[A-Za-z0-9/_.+-]+\{ {
70 //std::cerr << __LINE__ << " here: [" << yytext << "]" << std::endl;
71 yyextra->AllocateParserType(yylvalp, yytext+1, strlen(yytext)-2);
76 //std::cerr << __LINE__ << " here: [" << yytext << "]" << std::endl;
77 yyextra->AllocateParserType(yylvalp, yytext+1, strlen(yytext)-2);
82 //std::cerr << __LINE__ << " here: [" << yytext << "]" << std::endl;
83 //yyextra->AllocateParserType(yylvalp, yytext, strlen(yytext));
84 yylvalp->str = yyextra->DCURLYVariable;
89 //std::cerr << __LINE__ << " here: [" << yytext << "]" << std::endl;
90 //yyextra->AllocateParserType(yylvalp, yytext, strlen(yytext));
91 yylvalp->str = yyextra->RCURLYVariable;
96 //std::cerr << __LINE__ << " here: [" << yytext << "]" << std::endl;
97 //yyextra->AllocateParserType(yylvalp, yytext, strlen(yytext));
98 yylvalp->str = yyextra->ATVariable;
103 //std::cerr << __LINE__ << " here: [" << yytext << "]" << std::endl;
104 yyextra->AllocateParserType(yylvalp, yytext, strlen(yytext));
109 if ( !yyextra->HandleEscapeSymbol(yylvalp, *(yytext+1)) )
117 //std::cerr << __LINE__ << " here: [" << yytext << "]" << std::endl;
118 yyextra->AllocateParserType(yylvalp, yytext, strlen(yytext));
123 //yyextra->AllocateParserType(yylvalp, yytext, strlen(yytext));
124 yylvalp->str = yyextra->DOLLARVariable;
129 //yyextra->AllocateParserType(yylvalp, yytext, strlen(yytext));
130 yylvalp->str = yyextra->LCURLYVariable;
135 //yyextra->AllocateParserType(yylvalp, yytext, strlen(yytext));
136 yylvalp->str = yyextra->BSLASHVariable;
141 //yyextra->AllocateParserType(yylvalp, yytext, strlen(yytext));
142 yylvalp->str = yyextra->BSLASHVariable;
148 /*--------------------------------------------------------------------------*/
149 void cmCommandArgument_SetupEscapes(yyscan_t yyscanner, bool noEscapes)
151 /* Hack into the internal flex-generated scanner to set the state. */
152 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;