mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2025-01-28 13:05:02 -08:00
vkd3d-shader: Implement unary 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
d4929660c3
commit
f8a8987737
@ -157,7 +157,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;}
|
||||||
|
|
||||||
%%
|
%%
|
||||||
|
@ -333,7 +333,8 @@ static void free_parse_arg_names(struct parse_arg_names *args)
|
|||||||
%token T_CONCAT "##"
|
%token T_CONCAT "##"
|
||||||
%token T_DEFINED "defined"
|
%token T_DEFINED "defined"
|
||||||
|
|
||||||
%type <integer> expr
|
%type <integer> primary_expr
|
||||||
|
%type <integer> unary_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
|
||||||
@ -426,6 +427,18 @@ body_token_const
|
|||||||
{
|
{
|
||||||
$$ = ",";
|
$$ = ",";
|
||||||
}
|
}
|
||||||
|
| '+'
|
||||||
|
{
|
||||||
|
$$ = "+";
|
||||||
|
}
|
||||||
|
| '-'
|
||||||
|
{
|
||||||
|
$$ = "-";
|
||||||
|
}
|
||||||
|
| '!'
|
||||||
|
{
|
||||||
|
$$ = "!";
|
||||||
|
}
|
||||||
| T_CONCAT
|
| T_CONCAT
|
||||||
{
|
{
|
||||||
$$ = "##";
|
$$ = "##";
|
||||||
@ -467,7 +480,7 @@ directive
|
|||||||
}
|
}
|
||||||
vkd3d_free($2);
|
vkd3d_free($2);
|
||||||
}
|
}
|
||||||
| T_IF expr T_NEWLINE
|
| T_IF unary_expr T_NEWLINE
|
||||||
{
|
{
|
||||||
if (!preproc_push_if(ctx, !!$2))
|
if (!preproc_push_if(ctx, !!$2))
|
||||||
YYABORT;
|
YYABORT;
|
||||||
@ -482,7 +495,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 expr T_NEWLINE
|
| T_ELIF unary_expr T_NEWLINE
|
||||||
{
|
{
|
||||||
const struct preproc_file *file = preproc_get_top_file(ctx);
|
const struct preproc_file *file = preproc_get_top_file(ctx);
|
||||||
|
|
||||||
@ -582,7 +595,7 @@ directive
|
|||||||
vkd3d_free($2);
|
vkd3d_free($2);
|
||||||
}
|
}
|
||||||
|
|
||||||
expr
|
primary_expr
|
||||||
: T_INTEGER
|
: T_INTEGER
|
||||||
{
|
{
|
||||||
$$ = preproc_parse_integer($1);
|
$$ = preproc_parse_integer($1);
|
||||||
@ -603,3 +616,18 @@ expr
|
|||||||
$$ = !!preproc_find_macro(ctx, $3);
|
$$ = !!preproc_find_macro(ctx, $3);
|
||||||
vkd3d_free($3);
|
vkd3d_free($3);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
unary_expr
|
||||||
|
: primary_expr
|
||||||
|
| '+' unary_expr
|
||||||
|
{
|
||||||
|
$$ = $2;
|
||||||
|
}
|
||||||
|
| '-' unary_expr
|
||||||
|
{
|
||||||
|
$$ = -$2;
|
||||||
|
}
|
||||||
|
| '!' unary_expr
|
||||||
|
{
|
||||||
|
$$ = !$2;
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user