2 /*=========================================================================
4 Program: CMake - Cross-Platform Makefile Generator
5 Module: $RCSfile: cmCommandArgumentLexer.in.l,v $
7 Date: $Date: 2008-12-18 14:58:06 $
8 Version: $Revision: 1.13 $
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
28 - put header block at top of file
30 - remove "yyscanner" argument from these methods:
31 yy_fatal_error, cmCommandArgument_yyalloc, cmCommandArgument_yyrealloc, cmCommandArgument_yyfree
32 - remove all YY_BREAK lines occurring right after return statements
33 - change while ( 1 ) to for(;;)
34 - add "return 0;" to end of cmCommandArgument_yylex
36 Modify cmCommandArgumentLexer.h:
38 - remove the yy_init_globals function
39 - remove the block that includes unistd.h
40 - remove #line directives (avoids bogus warning on old Sun)
44 #include "cmStandardLexer.h"
46 #include "cmCommandArgumentParserHelper.h"
48 /* Replace the lexer input function. */
50 #define YY_INPUT(buf, result, max_size) \
51 { result = yyextra->LexInput(buf, max_size); }
53 /* Include the set of tokens from the parser. */
54 #include "cmCommandArgumentParserTokens.h"
56 /*--------------------------------------------------------------------------*/
69 //std::cerr << __LINE__ << " here: [" << yytext << "]" << std::endl;
70 yyextra->AllocateParserType(yylvalp, yytext+1, strlen(yytext)-2);
74 \$[A-Za-z0-9/_.+-]+\{ {
75 //std::cerr << __LINE__ << " here: [" << yytext << "]" << std::endl;
76 yyextra->AllocateParserType(yylvalp, yytext+1, strlen(yytext)-2);
81 //std::cerr << __LINE__ << " here: [" << yytext << "]" << std::endl;
82 yyextra->AllocateParserType(yylvalp, yytext+1, strlen(yytext)-2);
87 //std::cerr << __LINE__ << " here: [" << yytext << "]" << std::endl;
88 //yyextra->AllocateParserType(yylvalp, yytext, strlen(yytext));
89 yylvalp->str = yyextra->DCURLYVariable;
94 //std::cerr << __LINE__ << " here: [" << yytext << "]" << std::endl;
95 //yyextra->AllocateParserType(yylvalp, yytext, strlen(yytext));
96 yylvalp->str = yyextra->RCURLYVariable;
101 //std::cerr << __LINE__ << " here: [" << yytext << "]" << std::endl;
102 //yyextra->AllocateParserType(yylvalp, yytext, strlen(yytext));
103 yylvalp->str = yyextra->ATVariable;
108 //std::cerr << __LINE__ << " here: [" << yytext << "]" << std::endl;
109 yyextra->AllocateParserType(yylvalp, yytext, strlen(yytext));
114 if ( !yyextra->HandleEscapeSymbol(yylvalp, *(yytext+1)) )
122 //std::cerr << __LINE__ << " here: [" << yytext << "]" << std::endl;
123 yyextra->AllocateParserType(yylvalp, yytext, strlen(yytext));
128 //yyextra->AllocateParserType(yylvalp, yytext, strlen(yytext));
129 yylvalp->str = yyextra->DOLLARVariable;
134 //yyextra->AllocateParserType(yylvalp, yytext, strlen(yytext));
135 yylvalp->str = yyextra->LCURLYVariable;
140 //yyextra->AllocateParserType(yylvalp, yytext, strlen(yytext));
141 yylvalp->str = yyextra->BSLASHVariable;
146 //yyextra->AllocateParserType(yylvalp, yytext, strlen(yytext));
147 yylvalp->str = yyextra->BSLASHVariable;
153 /*--------------------------------------------------------------------------*/
154 void cmCommandArgument_SetupEscapes(yyscan_t yyscanner, bool noEscapes)
156 /* Hack into the internal flex-generated scanner to set the state. */
157 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;