[PATCH v2 0/5] MR204: vkd3d-shader: Get rid of flex default rules.
-- 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. https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/204
From: Zebediah Figura <zfigura(a)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;} %% -- GitLab https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/204
From: Zebediah Figura <zfigura(a)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;} -- GitLab https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/204
From: Zebediah Figura <zfigura(a)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 -- GitLab https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/204
From: Zebediah Figura <zfigura(a)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); -- GitLab https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/204
From: Zebediah Figura <zfigura(a)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 -- GitLab https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/204
Oops, somehow I dropped a commit and ended up submitting the wrong set of 5. Fixed in v2. -- https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/204#note_32165
This merge request was approved by Henri Verbeet. -- https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/204
This merge request was approved by Giovanni Mascellani. -- https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/204
participants (4)
-
Giovanni Mascellani (@giomasce) -
Henri Verbeet (@hverbeet) -
Zebediah Figura -
Zebediah Figura (@zfigura)