summaryrefslogtreecommitdiffstats
path: root/Source/cmListFileLexer.in.l
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2013-02-17 01:41:47 (GMT)
committerBrad King <brad.king@kitware.com>2013-08-08 17:26:27 (GMT)
commit58e524165d44e672e391cca261d9f7dd723d2c70 (patch)
treec1d02fa92e6437232a97e487afc4b04d361f162e /Source/cmListFileLexer.in.l
parente75b69f55bcdc6ee524dfd0cab568644379fbacb (diff)
downloadCMake-58e524165d44e672e391cca261d9f7dd723d2c70.zip
CMake-58e524165d44e672e391cca261d9f7dd723d2c70.tar.gz
CMake-58e524165d44e672e391cca261d9f7dd723d2c70.tar.bz2
Warn about arguments not separated by whitespace
Teach the lexer to return tokens for whitespace. Teach the parser to tolerate the space tokens where whitespace is allowed. Also teach the parser to diagnose and warn about cases of quoted arguments followed immediately by another argument. This was accidentally allowed previously, so we only warn. Update the RunCMake.Syntax test case StringNoSpace expected stderr to include the warnings.
Diffstat (limited to 'Source/cmListFileLexer.in.l')
-rw-r--r--Source/cmListFileLexer.in.l6
1 files changed, 5 insertions, 1 deletions
diff --git a/Source/cmListFileLexer.in.l b/Source/cmListFileLexer.in.l
index 45fcdd2..e5ddb9e 100644
--- a/Source/cmListFileLexer.in.l
+++ b/Source/cmListFileLexer.in.l
@@ -168,8 +168,11 @@ LEGACY {MAKEVAR}|{UNQUOTED}|\"({MAKEVAR}|{UNQUOTED}|[ \t])*\"
return 1;
}
-[ \t\r] {
+[ \t\r]+ {
+ lexer->token.type = cmListFileLexer_Token_Space;
+ cmListFileLexerSetToken(lexer, yytext, yyleng);
lexer->column += yyleng;
+ return 1;
}
. {
@@ -420,6 +423,7 @@ const char* cmListFileLexer_GetTypeAsString(cmListFileLexer* lexer,
switch(type)
{
case cmListFileLexer_Token_None: return "nothing";
+ case cmListFileLexer_Token_Space: return "space";
case cmListFileLexer_Token_Newline: return "newline";
case cmListFileLexer_Token_Identifier: return "identifier";
case cmListFileLexer_Token_ParenLeft: return "left paren";