-- v2: vkd3d-shader/hlsl: Use %option nodefault in the lexer. vkd3d-shader/hlsl: Lex invalid characters in #line directives. vkd3d-shader/preproc: Use %option nodefault in the lexer. vkd3d-shader/preproc: Ignore newlines in C comments.
From: Zebediah Figura zfigura@codeweavers.com
Avoid letting them fall through to the default rule.
A syntax error will be emitted by the parser. --- libs/vkd3d-shader/preproc.l | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/libs/vkd3d-shader/preproc.l b/libs/vkd3d-shader/preproc.l index 7686e0187..be4a05989 100644 --- a/libs/vkd3d-shader/preproc.l +++ b/libs/vkd3d-shader/preproc.l @@ -175,9 +175,9 @@ INT_SUFFIX [uUlL]{0,2} return T_NEWLINE; }
-<INITIAL>{WS}+ {} +<INITIAL,INCLUDE,LINE>{WS}+ {} <INITIAL>[-()[]{},+!*/<>&|^?:] {return yytext[0];} -<INITIAL>. {return T_TEXT;} +<INITIAL,INCLUDE,LINE>. {return T_TEXT;}
%%
From: Zebediah Figura zfigura@codeweavers.com
Avoid letting them fall through to the default rule. --- libs/vkd3d-shader/preproc.l | 1 + 1 file changed, 1 insertion(+)
diff --git a/libs/vkd3d-shader/preproc.l b/libs/vkd3d-shader/preproc.l index be4a05989..a54e47bc6 100644 --- a/libs/vkd3d-shader/preproc.l +++ b/libs/vkd3d-shader/preproc.l @@ -74,6 +74,7 @@ INT_SUFFIX [uUlL]{0,2} <C_COMMENT>"*/" {yy_pop_state(yyscanner);} <C_COMMENT,CXX_COMMENT><<EOF>> {yy_pop_state(yyscanner);} <C_COMMENT,CXX_COMMENT>. {} +<C_COMMENT>\n {}
<ERROR>(\{NEWLINE}|[^\n])* {return T_STRING;}
From: Zebediah Figura zfigura@codeweavers.com
--- libs/vkd3d-shader/preproc.l | 1 + 1 file changed, 1 insertion(+)
diff --git a/libs/vkd3d-shader/preproc.l b/libs/vkd3d-shader/preproc.l index a54e47bc6..8e35e3555 100644 --- a/libs/vkd3d-shader/preproc.l +++ b/libs/vkd3d-shader/preproc.l @@ -40,6 +40,7 @@ static void update_location(struct preproc_ctx *ctx); %option bison-locations %option extra-type="struct preproc_ctx *" %option never-interactive +%option nodefault %option noinput %option nounput %option noyy_top_state
From: Zebediah Figura zfigura@codeweavers.com
Avoid letting them fall through to the default rule. --- libs/vkd3d-shader/hlsl.l | 4 ++++ 1 file changed, 4 insertions(+)
diff --git a/libs/vkd3d-shader/hlsl.l b/libs/vkd3d-shader/hlsl.l index 10751bbe9..8a7cd2343 100644 --- a/libs/vkd3d-shader/hlsl.l +++ b/libs/vkd3d-shader/hlsl.l @@ -266,6 +266,10 @@ row_major {return KW_ROW_MAJOR; } return STRING; } <pp_line>{WS}+ {} +<pp_line>{ANY} { + FIXME("Malformed preprocessor line directive?\n"); + BEGIN(INITIAL); + } <pp_line>{NEWLINE} { FIXME("Malformed preprocessor line directive?\n"); BEGIN(INITIAL);
From: Zebediah Figura zfigura@codeweavers.com
--- libs/vkd3d-shader/hlsl.l | 1 + 1 file changed, 1 insertion(+)
diff --git a/libs/vkd3d-shader/hlsl.l b/libs/vkd3d-shader/hlsl.l index 8a7cd2343..6c2324c7b 100644 --- a/libs/vkd3d-shader/hlsl.l +++ b/libs/vkd3d-shader/hlsl.l @@ -37,6 +37,7 @@ static void update_location(struct hlsl_ctx *ctx, YYLTYPE *loc); %option bison-locations %option extra-type="struct hlsl_ctx *" %option never-interactive +%option nodefault %option noinput %option nounput %option noyywrap
Oops, somehow I dropped a commit and ended up submitting the wrong set of 5. Fixed in v2.
This merge request was approved by Henri Verbeet.
This merge request was approved by Giovanni Mascellani.