vbscript: Added parser support for string literals.

oldstable
Jacek Caban 2011-09-08 14:56:58 +02:00 committed by Alexandre Julliard
parent 0e415e0c0f
commit dc73a7c4bb
2 changed files with 21 additions and 1 deletions

View File

@ -18,7 +18,8 @@
typedef enum {
EXPR_BOOL,
EXPR_MEMBER
EXPR_MEMBER,
EXPR_STRING
} expression_type_t;
typedef struct _expression_t {
@ -31,6 +32,11 @@ typedef struct {
VARIANT_BOOL value;
} bool_expression_t;
typedef struct {
expression_t expr;
const WCHAR *value;
} string_expression_t;
typedef struct {
expression_t expr;
expression_t *obj_expr;

View File

@ -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;