cmExprLexer: Treat newline as whitespace explicitly

Newlines matched no rule, so they reached flex's default rule.  It
discards them only because cmStandardLexer.h defines ECHO as empty, and
`flex -s` warns "default rule can be matched".  Add the newline to the
whitespace rule to make the existing behavior of math(EXPR) explicit.
This commit is contained in:
Christoph Grüninger authored and Brad King committed 2026-10-30 10:54:30 -04:00
1 parent 168c36e6b3
commit 5eab16cef5
2 files changed
+3 -2

No files matched your search

+2 -1
View File
@@ -559,7 +559,7 @@ struct yy_trans_info
};
static const flex_int16_t yy_accept[29] =
{ 0,
0, 0, 19, 17, 1, 18, 8, 10, 15, 16,
0, 0, 19, 17, 1, 1, 8, 10, 15, 16,
6, 4, 5, 7, 2, 2, 17, 17, 11, 9,
12, 2, 0, 13, 14, 3, 3, 0
} ;
@@ -987,6 +987,7 @@ do_action: /* This label is used only to access EOF actions. */
goto yy_find_action;
case 1:
/* rule 1 can match eol */
YY_RULE_SETUP
{}
YY_BREAK
+1 -1
View File
@@ -42,7 +42,7 @@ Modify cmExprLexer.cxx:
%pointer
%%
[ \t] {}
[ \t\n] {}
[0-9][0-9]* { yylvalp->Number = std::stoll(yytext, nullptr, 10); return exp_NUMBER; }
0[xX][0-9a-fA-F][0-9a-fA-F]* { yylvalp->Number = std::stoll(yytext, nullptr, 16); return exp_NUMBER; }