mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2025-01-28 13:05:02 -08:00
vkd3d-shader: Implement bitwise operators 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
15bbaed960
commit
c1d2edc9d5
@ -162,7 +162,7 @@ IDENTIFIER [A-Za-z_][A-Za-z0-9_]*
|
||||
}
|
||||
|
||||
<INITIAL>{WS}+ {}
|
||||
<INITIAL>[-()\[\]{},+!*/<>] {return yytext[0];}
|
||||
<INITIAL>[-()\[\]{},+!*/<>&|^] {return yytext[0];}
|
||||
<INITIAL>. {return T_TEXT;}
|
||||
|
||||
%%
|
||||
|
@ -344,6 +344,9 @@ static void free_parse_arg_names(struct parse_arg_names *args)
|
||||
%type <integer> add_expr
|
||||
%type <integer> ineq_expr
|
||||
%type <integer> eq_expr
|
||||
%type <integer> bitand_expr
|
||||
%type <integer> bitxor_expr
|
||||
%type <integer> bitor_expr
|
||||
%type <string> body_token
|
||||
%type <const_string> body_token_const
|
||||
%type <string_buffer> body_text
|
||||
@ -464,6 +467,18 @@ body_token_const
|
||||
{
|
||||
$$ = ">";
|
||||
}
|
||||
| '&'
|
||||
{
|
||||
$$ = "&";
|
||||
}
|
||||
| '|'
|
||||
{
|
||||
$$ = "|";
|
||||
}
|
||||
| '^'
|
||||
{
|
||||
$$ = "^";
|
||||
}
|
||||
| T_CONCAT
|
||||
{
|
||||
$$ = "##";
|
||||
@ -521,7 +536,7 @@ directive
|
||||
}
|
||||
vkd3d_free($2);
|
||||
}
|
||||
| T_IF eq_expr T_NEWLINE
|
||||
| T_IF bitor_expr T_NEWLINE
|
||||
{
|
||||
if (!preproc_push_if(ctx, !!$2))
|
||||
YYABORT;
|
||||
@ -536,7 +551,7 @@ directive
|
||||
preproc_push_if(ctx, !preproc_find_macro(ctx, $2));
|
||||
vkd3d_free($2);
|
||||
}
|
||||
| T_ELIF eq_expr T_NEWLINE
|
||||
| T_ELIF bitor_expr T_NEWLINE
|
||||
{
|
||||
const struct preproc_file *file = preproc_get_top_file(ctx);
|
||||
|
||||
@ -729,3 +744,24 @@ eq_expr
|
||||
{
|
||||
$$ = $1 != $3;
|
||||
}
|
||||
|
||||
bitand_expr
|
||||
: eq_expr
|
||||
| bitand_expr '&' eq_expr
|
||||
{
|
||||
$$ = $1 & $3;
|
||||
}
|
||||
|
||||
bitxor_expr
|
||||
: bitand_expr
|
||||
| bitxor_expr '^' bitand_expr
|
||||
{
|
||||
$$ = $1 ^ $3;
|
||||
}
|
||||
|
||||
bitor_expr
|
||||
: bitxor_expr
|
||||
| bitor_expr '|' bitxor_expr
|
||||
{
|
||||
$$ = $1 | $3;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user