From 4ebff9bca638d96b562640c093b2dcc5d02fb443 Mon Sep 17 00:00:00 2001 From: Carl Worth Date: Tue, 1 Jul 2014 15:02:14 -0700 Subject: [PATCH] glsl/glcpp: Combine the two rules matching any character MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Using a single rule here means that we can use the <*> syntax to match all start conditions. This makes the catch-all rule more robust against the addition of future start conditions, (no need to maintain an ever- growing list of start conditions for this rul). Reviewed-by: Kenneth Graunke Reviewed-by: Kristian Høgsberg --- src/glsl/glcpp/glcpp-lex.l | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/glsl/glcpp/glcpp-lex.l b/src/glsl/glcpp/glcpp-lex.l index f95e6a3919d..79a7ad7b09a 100644 --- a/src/glsl/glcpp/glcpp-lex.l +++ b/src/glsl/glcpp/glcpp-lex.l @@ -543,17 +543,17 @@ HEXADECIMAL_INTEGER 0[xX][0-9a-fA-F]+[uU]? * rule, then we have made a mistake above and need to fix one or more * of the preceding patterns to match that input. */ -. { +<*>. { glcpp_error(yylloc, yyextra, "Internal compiler error: Unexpected character: %s", yytext); -} /* We don't actually use the UNREACHABLE start condition. We - only have this action here so that we can pretend to call some + only have this block here so that we can pretend to call some generated functions, (to avoid "defined but not used" warnings. */ -. { - unput('.'); - yy_top_state(yyextra); + if (YY_START == UNREACHABLE) { + unput('.'); + yy_top_state(yyextra); + } } %% -- 2.30.2