diff options
author | Brad King <brad.king@kitware.com> | 2004-08-31 22:39:42 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2004-08-31 22:39:42 (GMT) |
commit | 486a26d3db24cf2569310b4b2dad32667cbbcaa1 (patch) | |
tree | 323e4da91a75b65df7edb6efa495fead998e0f82 /Source/cmListFileLexer.in.l | |
parent | 491bebefa2f6da9221c5d40ce1c4d3ff2da1c401 (diff) | |
download | CMake-486a26d3db24cf2569310b4b2dad32667cbbcaa1.zip CMake-486a26d3db24cf2569310b4b2dad32667cbbcaa1.tar.gz CMake-486a26d3db24cf2569310b4b2dad32667cbbcaa1.tar.bz2 |
BUG#1049: Added error message when file ends in an unterminated string.
Diffstat (limited to 'Source/cmListFileLexer.in.l')
-rw-r--r-- | Source/cmListFileLexer.in.l | 28 |
1 files changed, 27 insertions, 1 deletions
diff --git a/Source/cmListFileLexer.in.l b/Source/cmListFileLexer.in.l index 5c86c92..e99bc03 100644 --- a/Source/cmListFileLexer.in.l +++ b/Source/cmListFileLexer.in.l @@ -165,12 +165,18 @@ static void cmListFileLexerDestroy(cmListFileLexer* lexer); lexer->column += yyleng; } +<STRING><<EOF>> { + lexer->token.type = cmListFileLexer_Token_BadString; + BEGIN(INITIAL); + return 1; +} + [ \t\r] { lexer->column += yyleng; } . { - lexer->token.type = cmListFileLexer_Token_Error; + lexer->token.type = cmListFileLexer_Token_BadCharacter; cmListFileLexerSetToken(lexer, yytext, yyleng); lexer->column += yyleng; return 1; @@ -408,3 +414,23 @@ long cmListFileLexer_GetCurrentColumn(cmListFileLexer* lexer) return 0; } } + +/*--------------------------------------------------------------------------*/ +const char* cmListFileLexer_GetTypeAsString(cmListFileLexer* lexer, + cmListFileLexer_Type type) +{ + (void)lexer; + switch(type) + { + case cmListFileLexer_Token_None: return "nothing"; + case cmListFileLexer_Token_Newline: return "newline"; + case cmListFileLexer_Token_Identifier: return "identifier"; + case cmListFileLexer_Token_ParenLeft: return "left paren"; + case cmListFileLexer_Token_ParenRight: return "right paren"; + case cmListFileLexer_Token_ArgumentUnquoted: return "unquoted argument"; + case cmListFileLexer_Token_ArgumentQuoted: return "quoted argument"; + case cmListFileLexer_Token_BadCharacter: return "bad character"; + case cmListFileLexer_Token_BadString: return "unterminated string"; + } + return "unknown token"; +} |