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

vbscript: Added parser support for string literals.

parent 0e415e0c
......@@ -18,7 +18,8 @@
typedef enum {
EXPR_BOOL,
EXPR_MEMBER
EXPR_MEMBER,
EXPR_STRING
} expression_type_t;
typedef struct _expression_t {
......@@ -33,6 +34,11 @@ typedef struct {
typedef struct {
expression_t expr;
const WCHAR *value;
} string_expression_t;
typedef struct {
expression_t expr;
expression_t *obj_expr;
const WCHAR *identifier;
expression_t *args;
......
......@@ -36,6 +36,7 @@ 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 expression_t *new_string_expression(parser_ctx_t*,const WCHAR*);
static member_expression_t *new_member_expression(parser_ctx_t*,expression_t*,const WCHAR*);
......@@ -113,6 +114,7 @@ Expression
LiteralExpression
: tTRUE { $$ = new_bool_expression(ctx, VARIANT_TRUE); CHECK_ERROR; }
| tFALSE { $$ = new_bool_expression(ctx, VARIANT_FALSE); CHECK_ERROR; }
| tString { $$ = new_string_expression(ctx, $1); CHECK_ERROR; }
%%
......@@ -161,6 +163,18 @@ static expression_t *new_bool_expression(parser_ctx_t *ctx, VARIANT_BOOL value)
return &expr->expr;
}
static expression_t *new_string_expression(parser_ctx_t *ctx, const WCHAR *value)
{
string_expression_t *expr;
expr = new_expression(ctx, EXPR_STRING, 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