summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorCarl Worth <[email protected]>2014-06-25 13:07:44 -0700
committerCarl Worth <[email protected]>2014-07-29 15:11:50 -0700
commitf196eb2d39d334b3ac8fbc5c0513dcb25e725155 (patch)
tree8def244319cda11eee85b00e6ced4b0c63caa8ae /src
parentf062f0506a5b827667b7eb52136d8420b7e8113b (diff)
glsl: Add an internal-error catch-all rule
This is to avoid the default, silent flex rule which simply prints the character to stdout. For the following Khronos GLES3 conformance tests: invalid_char_in_name_vertex invalid_char_in_name_fragment With this commit, these tests now report Pass where they previously reported Fail, but Mesa isn't behaving correctly yet. It's now reporting the internal error where what is really desired is a syntax error. Reviewed-by: Jordan Justen <[email protected]>
Diffstat (limited to 'src')
-rw-r--r--src/glsl/glsl_lexer.ll13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/glsl/glsl_lexer.ll b/src/glsl/glsl_lexer.ll
index db7b1d1791b..1cadf1f9b58 100644
--- a/src/glsl/glsl_lexer.ll
+++ b/src/glsl/glsl_lexer.ll
@@ -153,6 +153,9 @@ literal_integer(char *text, int len, struct _mesa_glsl_parse_state *state,
%option prefix="_mesa_glsl_lexer_"
%option extra-type="struct _mesa_glsl_parse_state *"
+ /* Note: When adding any start conditions to this list, you must also
+ * update the "Internal compiler error" catch-all rule near the end of
+ * this file. */
%x PP PRAGMA
DEC_INT [1-9][0-9]*
@@ -555,6 +558,16 @@ subroutine KEYWORD(0, 300, 0, 0, SUBROUTINE);
. { return yytext[0]; }
+ /* This is a catch-all to avoid the annoying default flex action which
+ * matches any character and prints it. If any input ever matches this
+ * rule, then we have made a mistake above and need to fix one or more
+ * of the preceding patterns to match that input. */
+<PP,PRAGMA>. {
+ _mesa_glsl_error(yylloc, yyextra,
+ "Internal compiler error: Unexpected character: %s", yytext);
+}
+
+
%%
int