Commit d145d0c0 authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

vbscript: Added bool literals parsing support.

parent 7cbc5235
......@@ -17,6 +17,7 @@
*/
typedef enum {
EXPR_BOOL,
EXPR_MEMBER
} expression_type_t;
......@@ -27,6 +28,11 @@ typedef struct _expression_t {
typedef struct {
expression_t expr;
VARIANT_BOOL value;
} bool_expression_t;
typedef struct {
expression_t expr;
expression_t *obj_expr;
const WCHAR *identifier;
expression_t *args;
......
......@@ -35,6 +35,8 @@ static void parse_complete(parser_ctx_t*);
static void source_add_statement(parser_ctx_t*,statement_t*);
static expression_t *new_bool_expression(parser_ctx_t*,VARIANT_BOOL);
static member_expression_t *new_member_expression(parser_ctx_t*,expression_t*,const WCHAR*);
static statement_t *new_call_statement(parser_ctx_t*,member_expression_t*);
......@@ -69,8 +71,9 @@ static statement_t *new_call_statement(parser_ctx_t*,member_expression_t*);
%token <string> tIdentifier
%type <statement> Statement StatementNl
%type <expression> Expression LiteralExpression
%type <member> MemberExpression
%type <expression> Arguments_opt ArgumentList_opt
%type <expression> Arguments_opt ArgumentList_opt ArgumentList
%%
......@@ -98,7 +101,18 @@ Arguments_opt
ArgumentList_opt
: /* empty */ { $$ = NULL; }
/* | ArgumentList { $$ = $1; } */
| ArgumentList { $$ = $1; }
ArgumentList
: Expression { $$ = $1; }
| Expression ',' ArgumentList { $1->next = $3; $$ = $1; }
Expression
: LiteralExpression /* FIXME */ { $$ = $1; }
LiteralExpression
: tTRUE { $$ = new_bool_expression(ctx, VARIANT_TRUE); CHECK_ERROR; }
| tFALSE { $$ = new_bool_expression(ctx, VARIANT_FALSE); CHECK_ERROR; }
%%
......@@ -135,6 +149,18 @@ static void *new_expression(parser_ctx_t *ctx, expression_type_t type, unsigned
return expr;
}
static expression_t *new_bool_expression(parser_ctx_t *ctx, VARIANT_BOOL value)
{
bool_expression_t *expr;
expr = new_expression(ctx, EXPR_BOOL, sizeof(*expr));
if(!expr)
return NULL;
expr->value = value;
return &expr->expr;
}
static member_expression_t *new_member_expression(parser_ctx_t *ctx, expression_t *obj_expr, const WCHAR *identifier)
{
member_expression_t *expr;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment