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
d935c21c
Commit
d935c21c
authored
Sep 22, 2011
by
Jacek Caban
Committed by
Alexandre Julliard
Sep 22, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
vbscript: Added for..to statement parser implementation.
parent
0e91f999
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
42 additions
and
2 deletions
+42
-2
lex.c
dlls/vbscript/lex.c
+6
-0
parse.h
dlls/vbscript/parse.h
+10
-0
parser.y
dlls/vbscript/parser.y
+26
-2
No files found.
dlls/vbscript/lex.c
View file @
d935c21c
...
...
@@ -44,6 +44,7 @@ static const WCHAR errorW[] = {'e','r','r','o','r',0};
static
const
WCHAR
exitW
[]
=
{
'e'
,
'x'
,
'i'
,
't'
,
0
};
static
const
WCHAR
explicitW
[]
=
{
'e'
,
'x'
,
'p'
,
'l'
,
'i'
,
'c'
,
'i'
,
't'
,
0
};
static
const
WCHAR
falseW
[]
=
{
'f'
,
'a'
,
'l'
,
's'
,
'e'
,
0
};
static
const
WCHAR
forW
[]
=
{
'f'
,
'o'
,
'r'
,
0
};
static
const
WCHAR
functionW
[]
=
{
'f'
,
'u'
,
'n'
,
'c'
,
't'
,
'i'
,
'o'
,
'n'
,
0
};
static
const
WCHAR
getW
[]
=
{
'g'
,
'e'
,
't'
,
0
};
static
const
WCHAR
gotoW
[]
=
{
'g'
,
'o'
,
't'
,
'o'
,
0
};
...
...
@@ -68,9 +69,11 @@ static const WCHAR publicW[] = {'p','u','b','l','i','c',0};
static
const
WCHAR
remW
[]
=
{
'r'
,
'e'
,
'm'
,
0
};
static
const
WCHAR
resumeW
[]
=
{
'r'
,
'e'
,
's'
,
'u'
,
'm'
,
'e'
,
0
};
static
const
WCHAR
setW
[]
=
{
's'
,
'e'
,
't'
,
0
};
static
const
WCHAR
stepW
[]
=
{
's'
,
't'
,
'e'
,
'p'
,
0
};
static
const
WCHAR
stopW
[]
=
{
's'
,
't'
,
'o'
,
'p'
,
0
};
static
const
WCHAR
subW
[]
=
{
's'
,
'u'
,
'b'
,
0
};
static
const
WCHAR
thenW
[]
=
{
't'
,
'h'
,
'e'
,
'n'
,
0
};
static
const
WCHAR
toW
[]
=
{
't'
,
'o'
,
0
};
static
const
WCHAR
trueW
[]
=
{
't'
,
'r'
,
'u'
,
'e'
,
0
};
static
const
WCHAR
untilW
[]
=
{
'u'
,
'n'
,
't'
,
'i'
,
'l'
,
0
};
static
const
WCHAR
wendW
[]
=
{
'w'
,
'e'
,
'n'
,
'd'
,
0
};
...
...
@@ -99,6 +102,7 @@ static const struct {
{
exitW
,
tEXIT
},
{
explicitW
,
tEXPLICIT
},
{
falseW
,
tFALSE
},
{
forW
,
tFOR
},
{
functionW
,
tFUNCTION
},
{
getW
,
tGET
},
{
gotoW
,
tGOTO
},
...
...
@@ -123,9 +127,11 @@ static const struct {
{
remW
,
tREM
},
{
resumeW
,
tRESUME
},
{
setW
,
tSET
},
{
stepW
,
tSTEP
},
{
stopW
,
tSTOP
},
{
subW
,
tSUB
},
{
thenW
,
tTHEN
},
{
toW
,
tTO
},
{
trueW
,
tTRUE
},
{
untilW
,
tUNTIL
},
{
wendW
,
tWEND
},
...
...
dlls/vbscript/parse.h
View file @
d935c21c
...
...
@@ -106,6 +106,7 @@ typedef enum {
STAT_EXITFUNC
,
STAT_EXITPROP
,
STAT_EXITSUB
,
STAT_FORTO
,
STAT_FUNC
,
STAT_IF
,
STAT_ONERROR
,
...
...
@@ -198,6 +199,15 @@ typedef struct {
typedef
struct
{
statement_t
stat
;
const
WCHAR
*
identifier
;
expression_t
*
from_expr
;
expression_t
*
to_expr
;
expression_t
*
step_expr
;
statement_t
*
body
;
}
forto_statement_t
;
typedef
struct
{
statement_t
stat
;
BOOL
resume_next
;
}
onerror_statement_t
;
...
...
dlls/vbscript/parser.y
View file @
d935c21c
...
...
@@ -52,6 +52,7 @@ static statement_t *new_assign_statement(parser_ctx_t*,member_expression_t*,expr
static statement_t *new_set_statement(parser_ctx_t*,member_expression_t*,expression_t*);
static statement_t *new_dim_statement(parser_ctx_t*,dim_decl_t*);
static statement_t *new_while_statement(parser_ctx_t*,statement_type_t,expression_t*,statement_t*);
static statement_t *new_forto_statement(parser_ctx_t*,const WCHAR*,expression_t*,expression_t*,expression_t*,statement_t*);
static statement_t *new_if_statement(parser_ctx_t*,expression_t*,statement_t*,elseif_decl_t*,statement_t*);
static statement_t *new_function_statement(parser_ctx_t*,function_decl_t*);
static statement_t *new_onerror_statement(parser_ctx_t*,BOOL);
...
...
@@ -102,7 +103,7 @@ static statement_t *link_statements(statement_t*,statement_t*);
%token tIS tLTEQ tGTEQ tMOD
%token tCALL tDIM tSUB tFUNCTION tPROPERTY tGET tLET tCONST
%token tIF tELSE tELSEIF tEND tTHEN tEXIT
%token tWHILE tWEND tDO tLOOP tUNTIL
%token tWHILE tWEND tDO tLOOP tUNTIL
tFOR tTO tSTEP
%token tBYREF tBYVAL
%token tOPTION tEXPLICIT
%token tSTOP
...
...
@@ -118,7 +119,7 @@ static statement_t *link_statements(statement_t*,statement_t*);
%type <expression> ConcatExpression AdditiveExpression ModExpression IntdivExpression MultiplicativeExpression ExpExpression
%type <expression> NotExpression UnaryExpression AndExpression OrExpression XorExpression EqvExpression
%type <member> MemberExpression
%type <expression> Arguments_opt ArgumentList_opt ArgumentList
%type <expression> Arguments_opt ArgumentList_opt ArgumentList
Step_opt
%type <bool> OptionExplicit_opt DoType
%type <arg_decl> ArgumentsDecl_opt ArgumentDeclList ArgumentDecl
%type <func_decl> FunctionDecl PropertyDecl
...
...
@@ -186,6 +187,8 @@ SimpleStatement
| tON tERROR tRESUME tNEXT { $$ = new_onerror_statement(ctx, TRUE); CHECK_ERROR; }
| tON tERROR tGOTO '0' { $$ = new_onerror_statement(ctx, FALSE); CHECK_ERROR; }
| tCONST ConstDeclList { $$ = new_const_statement(ctx, $2); CHECK_ERROR; }
| tFOR tIdentifier '=' Expression tTO Expression Step_opt tNL StatementsNl_opt tNEXT
{ $$ = new_forto_statement(ctx, $2, $4, $6, $7, $9); CHECK_ERROR; }
MemberExpression
: tIdentifier { $$ = new_member_expression(ctx, NULL, $1); CHECK_ERROR; }
...
...
@@ -206,6 +209,10 @@ DoType
: tWHILE { $$ = TRUE; }
| tUNTIL { $$ = FALSE; }
Step_opt
: /* empty */ { $$ = NULL;}
| tSTEP Expression { $$ = $2; }
IfStatement
: tIF Expression tTHEN tNL StatementsNl ElseIfs_opt Else_opt tEND tIF
{ $$ = new_if_statement(ctx, $2, $5, $6, $7); CHECK_ERROR; }
...
...
@@ -626,6 +633,23 @@ static statement_t *new_while_statement(parser_ctx_t *ctx, statement_type_t type
return &stat->stat;
}
static statement_t *new_forto_statement(parser_ctx_t *ctx, const WCHAR *identifier, expression_t *from_expr,
expression_t *to_expr, expression_t *step_expr, statement_t *body)
{
forto_statement_t *stat;
stat = new_statement(ctx, STAT_FORTO, sizeof(*stat));
if(!stat)
return NULL;
stat->identifier = identifier;
stat->from_expr = from_expr;
stat->to_expr = to_expr;
stat->step_expr = step_expr;
stat->body = body;
return &stat->stat;
}
static statement_t *new_if_statement(parser_ctx_t *ctx, expression_t *expr, statement_t *if_stat, elseif_decl_t *elseif_decl,
statement_t *else_stat)
{
...
...
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