mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2024-11-21 16:46:41 -08:00
vkd3d-shader: Implement the ternary operator in #if directives.
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com> Signed-off-by: Matteo Bruni <mbruni@codeweavers.com> Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
338399d563
commit
e15b884e1a
@ -162,7 +162,7 @@ IDENTIFIER [A-Za-z_][A-Za-z0-9_]*
|
|||||||
}
|
}
|
||||||
|
|
||||||
<INITIAL>{WS}+ {}
|
<INITIAL>{WS}+ {}
|
||||||
<INITIAL>[-()\[\]{},+!*/<>&|^] {return yytext[0];}
|
<INITIAL>[-()\[\]{},+!*/<>&|^?:] {return yytext[0];}
|
||||||
<INITIAL>. {return T_TEXT;}
|
<INITIAL>. {return T_TEXT;}
|
||||||
|
|
||||||
%%
|
%%
|
||||||
|
@ -351,6 +351,7 @@ static void free_parse_arg_names(struct parse_arg_names *args)
|
|||||||
%type <integer> bitor_expr
|
%type <integer> bitor_expr
|
||||||
%type <integer> logicand_expr
|
%type <integer> logicand_expr
|
||||||
%type <integer> logicor_expr
|
%type <integer> logicor_expr
|
||||||
|
%type <integer> expr
|
||||||
%type <string> body_token
|
%type <string> body_token
|
||||||
%type <const_string> body_token_const
|
%type <const_string> body_token_const
|
||||||
%type <string_buffer> body_text
|
%type <string_buffer> body_text
|
||||||
@ -483,6 +484,14 @@ body_token_const
|
|||||||
{
|
{
|
||||||
$$ = "^";
|
$$ = "^";
|
||||||
}
|
}
|
||||||
|
| '?'
|
||||||
|
{
|
||||||
|
$$ = "?";
|
||||||
|
}
|
||||||
|
| ':'
|
||||||
|
{
|
||||||
|
$$ = ":";
|
||||||
|
}
|
||||||
| T_CONCAT
|
| T_CONCAT
|
||||||
{
|
{
|
||||||
$$ = "##";
|
$$ = "##";
|
||||||
@ -548,7 +557,7 @@ directive
|
|||||||
}
|
}
|
||||||
vkd3d_free($2);
|
vkd3d_free($2);
|
||||||
}
|
}
|
||||||
| T_IF logicor_expr T_NEWLINE
|
| T_IF expr T_NEWLINE
|
||||||
{
|
{
|
||||||
if (!preproc_push_if(ctx, !!$2))
|
if (!preproc_push_if(ctx, !!$2))
|
||||||
YYABORT;
|
YYABORT;
|
||||||
@ -563,7 +572,7 @@ directive
|
|||||||
preproc_push_if(ctx, !preproc_find_macro(ctx, $2));
|
preproc_push_if(ctx, !preproc_find_macro(ctx, $2));
|
||||||
vkd3d_free($2);
|
vkd3d_free($2);
|
||||||
}
|
}
|
||||||
| T_ELIF logicor_expr T_NEWLINE
|
| T_ELIF expr T_NEWLINE
|
||||||
{
|
{
|
||||||
const struct preproc_file *file = preproc_get_top_file(ctx);
|
const struct preproc_file *file = preproc_get_top_file(ctx);
|
||||||
|
|
||||||
@ -791,3 +800,10 @@ logicor_expr
|
|||||||
{
|
{
|
||||||
$$ = $1 || $3;
|
$$ = $1 || $3;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
expr
|
||||||
|
: logicor_expr
|
||||||
|
| expr '?' logicor_expr ':' logicor_expr
|
||||||
|
{
|
||||||
|
$$ = $1 ? $3 : $5;
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user