summaryrefslogtreecommitdiff
path: root/Source/cmCommandArgumentLexer.in.l
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2007-06-04 15:57:33 -0400
committerBrad King <brad.king@kitware.com>2007-06-04 15:57:33 -0400
commite40c51dddf7428d25543c0f05d6a6cc16454c97f (patch)
treeeb2d44ad19e284a17c125d6047a01655187a9646 /Source/cmCommandArgumentLexer.in.l
parent64a8eb990ac12152a9c74f273978b926edec3724 (diff)
downloadcmake-e40c51dddf7428d25543c0f05d6a6cc16454c97f.tar.gz
BUG: Fixed cmCommandArgumentLexer no-escape mode to not match backslash-escape sequences as lexical tokens at all. Needed to configure files with backslashes preceding an @VAR@ replacement. This fixes bug#5130.
Diffstat (limited to 'Source/cmCommandArgumentLexer.in.l')
-rw-r--r--Source/cmCommandArgumentLexer.in.l27
1 files changed, 25 insertions, 2 deletions
diff --git a/Source/cmCommandArgumentLexer.in.l b/Source/cmCommandArgumentLexer.in.l
index aa4f7297bb..f5d025b0ef 100644
--- a/Source/cmCommandArgumentLexer.in.l
+++ b/Source/cmCommandArgumentLexer.in.l
@@ -56,6 +56,8 @@ Modify cmCommandArgumentLexer.h:
%option reentrant
%option noyywrap
%pointer
+%s ESCAPES
+%s NOESCAPES
%%
@@ -98,7 +100,7 @@ Modify cmCommandArgumentLexer.h:
return cal_NAME;
}
-\\. {
+<ESCAPES>\\. {
if ( !yyextra->HandleEscapeSymbol(yylvalp, *(yytext+1)) )
{
return cal_ERROR;
@@ -124,10 +126,31 @@ Modify cmCommandArgumentLexer.h:
return cal_LCURLY;
}
-"\\" {
+<ESCAPES>"\\" {
//yyextra->AllocateParserType(yylvalp, yytext, strlen(yytext));
yylvalp->str = yyextra->BSLASHVariable;
return cal_BSLASH;
}
+<NOESCAPES>"\\" {
+ //yyextra->AllocateParserType(yylvalp, yytext, strlen(yytext));
+ yylvalp->str = yyextra->BSLASHVariable;
+ return cal_SYMBOL;
+}
+
%%
+
+/*--------------------------------------------------------------------------*/
+void cmCommandArgument_SetupEscapes(yyscan_t yyscanner, bool noEscapes)
+{
+ /* Hack into the internal flex-generated scanner to set the state. */
+ struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
+ if(noEscapes)
+ {
+ BEGIN(NOESCAPES);
+ }
+ else
+ {
+ BEGIN(ESCAPES);
+ }
+}