2 /*=========================================================================
4 Program: CMake - Cross-Platform Makefile Generator
5 Module: $RCSfile: cmCommandArgumentLexer.in.l,v $
7 Date: $Date: 2007-06-05 13:19:27 $
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 flex --prefix=cmCommandArgument_yy --header-file=cmCommandArgumentLexer.h -ocmCommandArgumentLexer.cxx cmCommandArgumentLexer.in.l
26 Modify cmCommandArgumentLexer.cxx:
27 - add #include "cmStandardIncludes.h" to top of file
29 - remove "yyscanner" argument from these methods:
30 yy_fatal_error, cmCommandArgument_yyalloc, cmCommandArgument_yyrealloc, cmCommandArgument_yyfree
31 - remove all YY_BREAK lines occurring right after return statements
32 - change while ( 1 ) to for(;;)
34 Modify cmCommandArgumentLexer.h:
36 - remove the yy_init_globals function
37 - remove the block that includes unistd.h
38 - remove #line directives (avoids bogus warning on old Sun)
42 #include "cmStandardLexer.h"
44 #include "cmCommandArgumentParserHelper.h"
46 /* Replace the lexer input function. */
48 #define YY_INPUT(buf, result, max_size) \
49 { result = yyextra->LexInput(buf, max_size); }
51 /* Include the set of tokens from the parser. */
52 #include "cmCommandArgumentParserTokens.h"
54 /*--------------------------------------------------------------------------*/
65 \$[A-Za-z0-9/_.+-]+\{ {
66 //std::cerr << __LINE__ << " here: [" << yytext << "]" << std::endl;
67 yyextra->AllocateParserType(yylvalp, yytext+1, strlen(yytext)-2);
72 //std::cerr << __LINE__ << " here: [" << yytext << "]" << std::endl;
73 yyextra->AllocateParserType(yylvalp, yytext+1, strlen(yytext)-2);
78 //std::cerr << __LINE__ << " here: [" << yytext << "]" << std::endl;
79 //yyextra->AllocateParserType(yylvalp, yytext, strlen(yytext));
80 yylvalp->str = yyextra->DCURLYVariable;
85 //std::cerr << __LINE__ << " here: [" << yytext << "]" << std::endl;
86 //yyextra->AllocateParserType(yylvalp, yytext, strlen(yytext));
87 yylvalp->str = yyextra->RCURLYVariable;
92 //std::cerr << __LINE__ << " here: [" << yytext << "]" << std::endl;
93 //yyextra->AllocateParserType(yylvalp, yytext, strlen(yytext));
94 yylvalp->str = yyextra->ATVariable;
99 //std::cerr << __LINE__ << " here: [" << yytext << "]" << std::endl;
100 yyextra->AllocateParserType(yylvalp, yytext, strlen(yytext));
105 if ( !yyextra->HandleEscapeSymbol(yylvalp, *(yytext+1)) )
113 //std::cerr << __LINE__ << " here: [" << yytext << "]" << std::endl;
114 yyextra->AllocateParserType(yylvalp, yytext, strlen(yytext));
119 //yyextra->AllocateParserType(yylvalp, yytext, strlen(yytext));
120 yylvalp->str = yyextra->DOLLARVariable;
125 //yyextra->AllocateParserType(yylvalp, yytext, strlen(yytext));
126 yylvalp->str = yyextra->LCURLYVariable;
131 //yyextra->AllocateParserType(yylvalp, yytext, strlen(yytext));
132 yylvalp->str = yyextra->BSLASHVariable;
137 //yyextra->AllocateParserType(yylvalp, yytext, strlen(yytext));
138 yylvalp->str = yyextra->BSLASHVariable;
144 /*--------------------------------------------------------------------------*/
145 void cmCommandArgument_SetupEscapes(yyscan_t yyscanner, bool noEscapes)
147 /* Hack into the internal flex-generated scanner to set the state. */
148 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;