From 0d5f5d127b2ccac29b12bc7377ccd8cd5b29c70b Mon Sep 17 00:00:00 2001 From: Carl Worth Date: Wed, 25 Jun 2014 11:52:02 -0700 Subject: glsl/glcpp: Don't use start-condition stack when switching to/from This commit does not cause any behavioral change for any valid program. Prior to entering the start condition, the only valid start condition is , so whether pushing/popping onto the stack or explicit returning to is equivalent. The reason for this change is that we are planning to soon add a start condition for with the following semantics: : We just saw a directive-introducing '#' : We just saw "#define" starting a directive With these two start conditions in place, the only correct behavior is to leave by returning to . But the old push/pop code would have returned to the start condition which would then cause an error when the next directive-introducing '#' would be encountered. Reviewed-by: Jordan Justen --- src/glsl/glcpp/glcpp-lex.l | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/glsl/glcpp/glcpp-lex.l b/src/glsl/glcpp/glcpp-lex.l index 798ff4c1a7b..f13b3dacb16 100644 --- a/src/glsl/glcpp/glcpp-lex.l +++ b/src/glsl/glcpp/glcpp-lex.l @@ -299,21 +299,21 @@ HEXADECIMAL_INTEGER 0[xX][0-9a-fA-F]+[uU]? */ {HASH}define{HSPACE}+ { if (! parser->skipping) { + BEGIN DEFINE; yyextra->space_tokens = 0; - yy_push_state(DEFINE, yyscanner); RETURN_TOKEN (HASH_DEFINE); } } /* An identifier immediately followed by '(' */ {IDENTIFIER}/"(" { - yy_pop_state(yyscanner); + BEGIN INITIAL; RETURN_STRING_TOKEN (FUNC_IDENTIFIER); } /* An identifier not immediately followed by '(' */ {IDENTIFIER} { - yy_pop_state(yyscanner); + BEGIN INITIAL; RETURN_STRING_TOKEN (OBJ_IDENTIFIER); } -- cgit v1.2.3