From: Kenneth Graunke Date: Thu, 12 Jun 2014 05:04:09 +0000 (-0700) Subject: glsl: Properly lex extra tokens when handling # directives. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=de0b4b6607c755257a63a72d0079ef9f2aaccbc2;p=mesa.git glsl: Properly lex extra tokens when handling # directives. Without this, in the state, we would hit Flex's default rule, which prints tokens to stdout, rather than returning them as tokens. (Or, after the previous commit, we would hit the new catch-all rule and generate an internal compiler error.) With this commit in place, we generate the desired syntax error. This manifested as a weird bug where shaders with semicolons after extension directives, such as: #extension GL_foo_bar : enable; would print semicolons to the screen, but otherwise compile just fine (even though this is illegal). Fixes Piglit's extension-semicolon.frag test. This also fixes the following Khronos GLES3 conformance tests, (and for real this time): invalid_char_in_name_vertex invalid_char_in_name_fragment Signed-off-by: Kenneth Graunke Reviewed-by: Carl Worth Reviewed-by: Jordan Justen --- diff --git a/src/glsl/glsl_lexer.ll b/src/glsl/glsl_lexer.ll index 1cadf1f9b58..1a0dde2e9b8 100644 --- a/src/glsl/glsl_lexer.ll +++ b/src/glsl/glsl_lexer.ll @@ -239,6 +239,7 @@ HASH ^{SPC}#{SPC} return INTCONSTANT; } \n { BEGIN 0; yylineno++; yycolumn = 0; return EOL; } +. { return yytext[0]; } \n { yylineno++; yycolumn = 0; }