Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
7f835c96
Commit
7f835c96
authored
Sep 12, 2011
by
Jacek Caban
Committed by
Alexandre Julliard
Sep 12, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
vbscript: Added parser support for numeric literals.
parent
1e224b4e
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
46 additions
and
1 deletion
+46
-1
parse.h
dlls/vbscript/parse.h
+14
-1
parser.y
dlls/vbscript/parser.y
+32
-0
No files found.
dlls/vbscript/parse.h
View file @
7f835c96
...
@@ -18,12 +18,15 @@
...
@@ -18,12 +18,15 @@
typedef
enum
{
typedef
enum
{
EXPR_BOOL
,
EXPR_BOOL
,
EXPR_DOUBLE
,
EXPR_EMPTY
,
EXPR_EMPTY
,
EXPR_EQUAL
,
EXPR_EQUAL
,
EXPR_MEMBER
,
EXPR_MEMBER
,
EXPR_NOT
,
EXPR_NOT
,
EXPR_NULL
,
EXPR_NULL
,
EXPR_STRING
EXPR_STRING
,
EXPR_ULONG
,
EXPR_USHORT
}
expression_type_t
;
}
expression_type_t
;
typedef
struct
_expression_t
{
typedef
struct
_expression_t
{
...
@@ -38,6 +41,16 @@ typedef struct {
...
@@ -38,6 +41,16 @@ typedef struct {
typedef
struct
{
typedef
struct
{
expression_t
expr
;
expression_t
expr
;
LONG
value
;
}
int_expression_t
;
typedef
struct
{
expression_t
expr
;
double
value
;
}
double_expression_t
;
typedef
struct
{
expression_t
expr
;
const
WCHAR
*
value
;
const
WCHAR
*
value
;
}
string_expression_t
;
}
string_expression_t
;
...
...
dlls/vbscript/parser.y
View file @
7f835c96
...
@@ -38,6 +38,8 @@ static void source_add_statement(parser_ctx_t*,statement_t*);
...
@@ -38,6 +38,8 @@ static void source_add_statement(parser_ctx_t*,statement_t*);
static void *new_expression(parser_ctx_t*,expression_type_t,size_t);
static void *new_expression(parser_ctx_t*,expression_type_t,size_t);
static expression_t *new_bool_expression(parser_ctx_t*,VARIANT_BOOL);
static expression_t *new_bool_expression(parser_ctx_t*,VARIANT_BOOL);
static expression_t *new_string_expression(parser_ctx_t*,const WCHAR*);
static expression_t *new_string_expression(parser_ctx_t*,const WCHAR*);
static expression_t *new_long_expression(parser_ctx_t*,expression_type_t,LONG);
static expression_t *new_double_expression(parser_ctx_t*,double);
static expression_t *new_unary_expression(parser_ctx_t*,expression_type_t,expression_t*);
static expression_t *new_unary_expression(parser_ctx_t*,expression_type_t,expression_t*);
static expression_t *new_binary_expression(parser_ctx_t*,expression_type_t,expression_t*,expression_t*);
static expression_t *new_binary_expression(parser_ctx_t*,expression_type_t,expression_t*,expression_t*);
...
@@ -57,7 +59,9 @@ static statement_t *new_call_statement(parser_ctx_t*,member_expression_t*);
...
@@ -57,7 +59,9 @@ static statement_t *new_call_statement(parser_ctx_t*,member_expression_t*);
statement_t *statement;
statement_t *statement;
expression_t *expression;
expression_t *expression;
member_expression_t *member;
member_expression_t *member;
LONG lng;
BOOL bool;
BOOL bool;
double dbl;
}
}
%token tEOF tNL tREM tEMPTYBRACKETS
%token tEOF tNL tREM tEMPTYBRACKETS
...
@@ -148,6 +152,10 @@ LiteralExpression
...
@@ -148,6 +152,10 @@ LiteralExpression
: tTRUE { $$ = new_bool_expression(ctx, VARIANT_TRUE); CHECK_ERROR; }
: tTRUE { $$ = new_bool_expression(ctx, VARIANT_TRUE); CHECK_ERROR; }
| tFALSE { $$ = new_bool_expression(ctx, VARIANT_FALSE); CHECK_ERROR; }
| tFALSE { $$ = new_bool_expression(ctx, VARIANT_FALSE); CHECK_ERROR; }
| tString { $$ = new_string_expression(ctx, $1); CHECK_ERROR; }
| tString { $$ = new_string_expression(ctx, $1); CHECK_ERROR; }
| tShort { $$ = new_long_expression(ctx, EXPR_USHORT, $1); CHECK_ERROR; }
| '0' { $$ = new_long_expression(ctx, EXPR_USHORT, 0); CHECK_ERROR; }
| tLong { $$ = new_long_expression(ctx, EXPR_ULONG, $1); CHECK_ERROR; }
| tDouble { $$ = new_double_expression(ctx, $1); CHECK_ERROR; }
| tEMPTY { $$ = new_expression(ctx, EXPR_EMPTY, 0); CHECK_ERROR; }
| tEMPTY { $$ = new_expression(ctx, EXPR_EMPTY, 0); CHECK_ERROR; }
| tNULL { $$ = new_expression(ctx, EXPR_NULL, 0); CHECK_ERROR; }
| tNULL { $$ = new_expression(ctx, EXPR_NULL, 0); CHECK_ERROR; }
...
@@ -214,6 +222,30 @@ static expression_t *new_string_expression(parser_ctx_t *ctx, const WCHAR *value
...
@@ -214,6 +222,30 @@ static expression_t *new_string_expression(parser_ctx_t *ctx, const WCHAR *value
return &expr->expr;
return &expr->expr;
}
}
static expression_t *new_long_expression(parser_ctx_t *ctx, expression_type_t type, LONG value)
{
int_expression_t *expr;
expr = new_expression(ctx, type, sizeof(*expr));
if(!expr)
return NULL;
expr->value = value;
return &expr->expr;
}
static expression_t *new_double_expression(parser_ctx_t *ctx, double value)
{
double_expression_t *expr;
expr = new_expression(ctx, EXPR_DOUBLE, sizeof(*expr));
if(!expr)
return NULL;
expr->value = value;
return &expr->expr;
}
static expression_t *new_unary_expression(parser_ctx_t *ctx, expression_type_t type, expression_t *subexpr)
static expression_t *new_unary_expression(parser_ctx_t *ctx, expression_type_t type, expression_t *subexpr)
{
{
unary_expression_t *expr;
unary_expression_t *expr;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment