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.
This commit is contained in:
parent
8f2b0c3307
commit
56457837e2
|
@ -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;
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
message
|
|
@ -0,0 +1,7 @@
|
|||
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)
|
||||
|
|
Loading…
Reference in New Issue