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
b2c774d4
Commit
b2c774d4
authored
Jun 30, 2023
by
Fabian Maurer
Committed by
Alexandre Julliard
Jul 04, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
vbscript: Support one-line sub/function.
Wine-Bug:
https://bugs.winehq.org/show_bug.cgi?id=54978
parent
0fb31cfc
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
34 additions
and
4 deletions
+34
-4
parser.y
dlls/vbscript/parser.y
+18
-4
lang.vbs
dlls/vbscript/tests/lang.vbs
+16
-0
No files found.
dlls/vbscript/parser.y
View file @
b2c774d4
...
@@ -145,7 +145,7 @@ static statement_t *link_statements(statement_t*,statement_t*);
...
@@ -145,7 +145,7 @@ static statement_t *link_statements(statement_t*,statement_t*);
%type <member> MemberExpression
%type <member> MemberExpression
%type <expression> Arguments ArgumentList ArgumentList_opt Step_opt ExpressionList
%type <expression> Arguments ArgumentList ArgumentList_opt Step_opt ExpressionList
%type <boolean> DoType Preserve_opt
%type <boolean> DoType Preserve_opt
%type <arg_decl> ArgumentsDecl_opt ArgumentDeclList ArgumentDecl
%type <arg_decl> ArgumentsDecl
ArgumentsDecl
_opt ArgumentDeclList ArgumentDecl
%type <func_decl> FunctionDecl PropertyDecl
%type <func_decl> FunctionDecl PropertyDecl
%type <elseif> ElseIfs_opt ElseIfs ElseIf
%type <elseif> ElseIfs_opt ElseIfs ElseIf
%type <class_decl> ClassDeclaration ClassBody
%type <class_decl> ClassDeclaration ClassBody
...
@@ -475,9 +475,13 @@ PropertyDecl
...
@@ -475,9 +475,13 @@ PropertyDecl
{ $$ = new_function_decl(ctx, $4, FUNC_PROPSET, $1, $6, $9); CHECK_ERROR; }
{ $$ = new_function_decl(ctx, $4, FUNC_PROPSET, $1, $6, $9); CHECK_ERROR; }
FunctionDecl
FunctionDecl
: Storage_opt tSUB Identifier ArgumentsDecl_opt StSep BodyStatements tEND tSUB
: Storage_opt tSUB Identifier StSep BodyStatements tEND tSUB
{ $$ = new_function_decl(ctx, $3, FUNC_SUB, $1, NULL, $5); CHECK_ERROR; }
| Storage_opt tSUB Identifier ArgumentsDecl Nl_opt BodyStatements tEND tSUB
{ $$ = new_function_decl(ctx, $3, FUNC_SUB, $1, $4, $6); CHECK_ERROR; }
{ $$ = new_function_decl(ctx, $3, FUNC_SUB, $1, $4, $6); CHECK_ERROR; }
| Storage_opt tFUNCTION Identifier ArgumentsDecl_opt StSep BodyStatements tEND tFUNCTION
| Storage_opt tFUNCTION Identifier StSep BodyStatements tEND tFUNCTION
{ $$ = new_function_decl(ctx, $3, FUNC_FUNCTION, $1, NULL, $5); CHECK_ERROR; }
| Storage_opt tFUNCTION Identifier ArgumentsDecl Nl_opt BodyStatements tEND tFUNCTION
{ $$ = new_function_decl(ctx, $3, FUNC_FUNCTION, $1, $4, $6); CHECK_ERROR; }
{ $$ = new_function_decl(ctx, $3, FUNC_FUNCTION, $1, $4, $6); CHECK_ERROR; }
Storage_opt
Storage_opt
...
@@ -490,7 +494,11 @@ Storage
...
@@ -490,7 +494,11 @@ Storage
| tPRIVATE { $$ = STORAGE_IS_PRIVATE; }
| tPRIVATE { $$ = STORAGE_IS_PRIVATE; }
ArgumentsDecl_opt
ArgumentsDecl_opt
: EmptyBrackets_opt { $$ = NULL; }
: /* empty*/ { $$ = 0; }
| ArgumentsDecl { $$ = $1; }
ArgumentsDecl
: tEMPTYBRACKETS { $$ = NULL; }
| '(' ArgumentDeclList ')' { $$ = $2; }
| '(' ArgumentDeclList ')' { $$ = $2; }
ArgumentDeclList
ArgumentDeclList
...
@@ -515,6 +523,10 @@ StSep_opt
...
@@ -515,6 +523,10 @@ StSep_opt
: /* empty */
: /* empty */
| StSep
| StSep
Nl_opt
: /* empty */
| tNL Nl_opt
/* Most statements accept both new line and ':' as separators */
/* Most statements accept both new line and ':' as separators */
StSep
StSep
: tNL
: tNL
...
@@ -1163,6 +1175,8 @@ static statement_t *link_statements(statement_t *head, statement_t *tail)
...
@@ -1163,6 +1175,8 @@ static statement_t *link_statements(statement_t *head, statement_t *tail)
{
{
statement_t *iter;
statement_t *iter;
if (!head) return tail;
for(iter = head; iter->next; iter = iter->next);
for(iter = head; iter->next; iter = iter->next);
iter->next = tail;
iter->next = tail;
...
...
dlls/vbscript/tests/lang.vbs
View file @
b2c774d4
...
@@ -827,6 +827,14 @@ x = false
...
@@ -827,6 +827,14 @@ x = false
Call
testsub
Call
testsub
Call
ok
(
x
,
"x is false, testsub not called?"
)
Call
ok
(
x
,
"x is false, testsub not called?"
)
if
false
then
Sub
testsub_one_line
()
x
=
true
End
Sub
end
if
x
=
false
Call
testsub_one_line
Call
ok
(
x
,
"x is false, testsub_one_line not called?"
)
Sub
SubSetTrue
(
v
)
Sub
SubSetTrue
(
v
)
Call
ok
(
not
v
,
"v is not true"
)
Call
ok
(
not
v
,
"v is not true"
)
v
=
true
v
=
true
...
@@ -920,6 +928,14 @@ x = false
...
@@ -920,6 +928,14 @@ x = false
Call
TestFunc
Call
TestFunc
Call
ok
(
x
,
"x is false, testfunc not called?"
)
Call
ok
(
x
,
"x is false, testfunc not called?"
)
if
false
then
Function
testfunc_one_line
()
x
=
true
End
Function
end
if
x
=
false
Call
testfunc_one_line
Call
ok
(
x
,
"x is false, testfunc_one_line not called?"
)
Function
FuncSetTrue
(
v
)
Function
FuncSetTrue
(
v
)
Call
ok
(
not
v
,
"v is not true"
)
Call
ok
(
not
v
,
"v is not true"
)
v
=
true
v
=
true
...
...
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