summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorIan Romanick <[email protected]>2016-11-08 11:14:49 -0800
committerIan Romanick <[email protected]>2016-11-10 10:57:59 -0800
commitc8c46641af43edd106528ac0293db5aa02a2364e (patch)
tree1627da2088c9fd8f1c1842cb87c7702a411458b7 /src
parente85a747e294762785df2ce8a299c153254c6fca2 (diff)
glsl: Parse 0 as a preprocessor INTCONSTANT
This allows a more reasonable error message for '#version 0' of 0:1(10): error: GLSL 0.00 is not supported. Supported versions are: 1.10, 1.20, 1.30, 1.00 ES, 3.00 ES, 3.10 ES, and 3.20 ES instead of 0:1(10): error: syntax error, unexpected $undefined, expecting INTCONSTANT Signed-off-by: Ian Romanick <[email protected]> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=97420 Reviewed-by: Nicolai Hähnle <[email protected]> Cc: [email protected] Cc: Juan A. Suarez Romero <[email protected]> Cc: Karol Herbst <[email protected]>
Diffstat (limited to 'src')
-rw-r--r--src/compiler/glsl/glsl_lexer.ll4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/compiler/glsl/glsl_lexer.ll b/src/compiler/glsl/glsl_lexer.ll
index b473af7845c..0e722cbfba3 100644
--- a/src/compiler/glsl/glsl_lexer.ll
+++ b/src/compiler/glsl/glsl_lexer.ll
@@ -253,6 +253,10 @@ HASH ^{SPC}#{SPC}
yylval->n = strtol(yytext, NULL, 10);
return INTCONSTANT;
}
+<PP>0 {
+ yylval->n = 0;
+ return INTCONSTANT;
+ }
<PP>\n { BEGIN 0; yylineno++; yycolumn = 0; return EOL; }
<PP>. { return yytext[0]; }