summaryrefslogtreecommitdiffstats
path: root/Source/cmCommandArgumentLexer.in.l
diff options
context:
space:
mode:
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 aa4f729..f5d025b 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);
+ }
+}