summaryrefslogtreecommitdiffstats
path: root/Source/cmListFileLexer.in.l
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2012-08-06 13:41:10 (GMT)
committerBrad King <brad.king@kitware.com>2013-08-08 17:26:26 (GMT)
commit1eafa3edaf34569cb6fa7eb449a9825049fe6270 (patch)
tree60123e7371cd69acabcec38f6662911c270aeb34 /Source/cmListFileLexer.in.l
parentf3155cd62ab669afc9d21bc877d5eb452ed94a7d (diff)
downloadCMake-1eafa3edaf34569cb6fa7eb449a9825049fe6270.zip
CMake-1eafa3edaf34569cb6fa7eb449a9825049fe6270.tar.gz
CMake-1eafa3edaf34569cb6fa7eb449a9825049fe6270.tar.bz2
cmListFileLexer: Fix line number after backslash in string
If a line inside a string ends in a backslash count the following newline character as a line increment. Add a test covering this case to verify that subsequent line numbers are correct.
Diffstat (limited to 'Source/cmListFileLexer.in.l')
-rw-r--r--Source/cmListFileLexer.in.l8
1 files changed, 7 insertions, 1 deletions
diff --git a/Source/cmListFileLexer.in.l b/Source/cmListFileLexer.in.l
index eedf494..4459c7b 100644
--- a/Source/cmListFileLexer.in.l
+++ b/Source/cmListFileLexer.in.l
@@ -125,11 +125,17 @@ MAKEVAR \$\([A-Za-z0-9_]*\)
BEGIN(STRING);
}
-<STRING>([^\\\n\"]|\\(.|\n))+ {
+<STRING>([^\\\n\"]|\\.)+ {
cmListFileLexerAppend(lexer, yytext, yyleng);
lexer->column += yyleng;
}
+<STRING>\\\n {
+ cmListFileLexerAppend(lexer, yytext, yyleng);
+ ++lexer->line;
+ lexer->column = 1;
+}
+
<STRING>\n {
cmListFileLexerAppend(lexer, yytext, yyleng);
++lexer->line;