Commit 56457837 authored by Brad King's avatar Brad King

cmListFileLexer: Allow command names with one letter (#14181)

Teach the lexer to treat a single letter as an identifier instead of an
unquoted argument.  Outside of a command invocation, the parser treats
an identifier as a command name and an unquoted argument as an error.
Inside of a command invocation, the parser treats an identifier as an
unquoted argument.  Therefore this change to the lexer will make what
was previously an error case work with no other behavioral change.
parent 8f2b0c33
......@@ -381,7 +381,7 @@ struct yy_trans_info
static yyconst flex_int16_t yy_accept[45] =
{ 0,
0, 0, 0, 0, 17, 6, 14, 1, 8, 2,
6, 3, 4, 6, 15, 9, 11, 12, 13, 6,
6, 3, 4, 5, 15, 9, 11, 12, 13, 6,
0, 6, 0, 14, 2, 0, 5, 6, 9, 0,
10, 0, 7, 0, 0, 0, 7, 0, 7, 0,
0, 0, 0, 0
......
......@@ -107,7 +107,7 @@ LEGACY {MAKEVAR}|{UNQUOTED}|\"({MAKEVAR}|{UNQUOTED}|[ \t])*\"
return 1;
}
[A-Za-z_][A-Za-z0-9_]+ {
[A-Za-z_][A-Za-z0-9_]* {
lexer->token.type = cmListFileLexer_Token_Identifier;
cmListFileLexerSetToken(lexer, yytext, yyleng);
lexer->column += yyleng;
......
function(f)
g(${ARGN})
endfunction()
macro(g)
message(${ARGN})
endmacro()
f(message)
......@@ -9,6 +9,7 @@ run_cmake(CommandError1)
run_cmake(String0)
run_cmake(String1)
run_cmake(StringNoSpace)
run_cmake(OneLetter)
run_cmake(Unquoted0)
run_cmake(Unquoted1)
run_cmake(ParenNoSpace)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment