vkd3d-shader: Implement #pragma.

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:49 -06:00
committed by Alexandre Julliard
parent 92877f7a43
commit ba32e91aca
3 changed files with 15 additions and 2 deletions

View File

@@ -129,6 +129,8 @@ IDENTIFIER [A-Za-z_][A-Za-z0-9_]*
return T_IFDEF;
if (!strcmp(p, "ifndef"))
return T_IFNDEF;
if (!strcmp(p, "pragma"))
return T_PRAGMA;
if (!strcmp(p, "undef"))
return T_UNDEF;
@@ -352,6 +354,7 @@ int yylex(YYSTYPE *lval, YYLTYPE *lloc, yyscan_t scanner)
case T_IFDEF:
case T_IFNDEF:
case T_INCLUDE:
case T_PRAGMA:
case T_UNDEF:
ctx->current_directive = token;
break;
@@ -387,6 +390,16 @@ int yylex(YYSTYPE *lval, YYLTYPE *lloc, yyscan_t scanner)
continue;
}
if (ctx->current_directive == T_PRAGMA)
{
/* Print all tokens verbatim. */
if (token == T_PRAGMA)
vkd3d_string_buffer_printf(&ctx->buffer, "#pragma ");
else
vkd3d_string_buffer_printf(&ctx->buffer, "%s", text);
continue;
}
switch (func_state->state)
{
case STATE_NONE: