[Mesa-dev] [PATCH 2/2] glsl: Parse 0 as a preprocessor INTCONSTANT

Nicolai Hähnle nhaehnle at gmail.com
Wed Nov 9 11:26:32 UTC 2016


I'm far from a flex/bison expert, but these changes look reasonable to 
me. For both patches:

Reviewed-by: Nicolai Hähnle <nicolai.haehnle at amd.com>

On 08.11.2016 21:14, Ian Romanick wrote:
> From: Ian Romanick <ian.d.romanick at intel.com>
>
> 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 <ian.d.romanick at intel.com>
> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=97420
> Cc: mesa-stable at lists.freedesktop.org
> Cc: Juan A. Suarez Romero <jasuarez at igalia.com>
> Cc: Karol Herbst <karolherbst at gmail.com>
> ---
>  src/compiler/glsl/glsl_lexer.ll | 4 ++++
>  1 file changed, 4 insertions(+)
>
> diff --git a/src/compiler/glsl/glsl_lexer.ll b/src/compiler/glsl/glsl_lexer.ll
> index b473af7..0e722cb 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]; }
>
>


More information about the mesa-dev mailing list