vkd3d-shader: Implement the "defined" keyword.

Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Matteo Bruni <mbruni@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Zebediah Figura
2021-01-14 14:47:51 -06:00
committed by Alexandre Julliard
parent 1a326d16c6
commit d31f288111
3 changed files with 32 additions and 0 deletions

View File

@@ -331,6 +331,7 @@ static void free_parse_arg_names(struct parse_arg_names *args)
%token T_UNDEF "#undef"
%token T_CONCAT "##"
%token T_DEFINED "defined"
%type <integer> expr
%type <string> body_token
@@ -429,6 +430,10 @@ body_token_const
{
$$ = "##";
}
| T_DEFINED
{
$$ = "defined";
}
directive
: T_DEFINE T_IDENTIFIER body_text T_NEWLINE
@@ -583,3 +588,13 @@ expr
$$ = preproc_parse_integer($1);
vkd3d_free($1);
}
| T_DEFINED T_IDENTIFIER
{
$$ = !!preproc_find_macro(ctx, $2);
vkd3d_free($2);
}
| T_DEFINED '(' T_IDENTIFIER ')'
{
$$ = !!preproc_find_macro(ctx, $3);
vkd3d_free($3);
}