Jacek Caban : vbscript: Short if statement may have optional 'end if'.

Alexandre Julliard julliard at winehq.org
Fri Apr 13 11:03:22 CDT 2012


Module: wine
Branch: master
Commit: cb1a8a3c58e1ba020fa6b8b8196519637d2cb916
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=cb1a8a3c58e1ba020fa6b8b8196519637d2cb916

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Fri Apr 13 17:40:40 2012 +0200

vbscript: Short if statement may have optional 'end if'.

---

 dlls/vbscript/parser.y       |    6 +++++-
 dlls/vbscript/tests/lang.vbs |    2 ++
 2 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/dlls/vbscript/parser.y b/dlls/vbscript/parser.y
index 45e0e8a..2a85272 100644
--- a/dlls/vbscript/parser.y
+++ b/dlls/vbscript/parser.y
@@ -221,9 +221,13 @@ IfStatement
     : tIF Expression tTHEN tNL StatementsNl ElseIfs_opt Else_opt tEND tIF
                                             { $$ = new_if_statement(ctx, $2, $5, $6, $7); CHECK_ERROR; }
     | tIF Expression tTHEN Statement        { $$ = new_if_statement(ctx, $2, $4, NULL, NULL); CHECK_ERROR; }
-    | tIF Expression tTHEN Statement tELSE Statement
+    | tIF Expression tTHEN Statement tELSE Statement EndIf_opt
                                             { $$ = new_if_statement(ctx, $2, $4, NULL, $6); CHECK_ERROR; }
 
+EndIf_opt
+    : /* empty */
+    | tEND tIF
+
 ElseIfs_opt
     : /* empty */                           { $$ = NULL; }
     | ElseIfs                               { $$ = $1; }
diff --git a/dlls/vbscript/tests/lang.vbs b/dlls/vbscript/tests/lang.vbs
index 0025d69..4380432 100644
--- a/dlls/vbscript/tests/lang.vbs
+++ b/dlls/vbscript/tests/lang.vbs
@@ -209,6 +209,8 @@ if false then :
 
 if false then x = y : if true then call ok(false, "embedded if called")
 
+if false then x=1 else x=2 end if
+
 if false then
     ok false, "if false called"
 end if




More information about the wine-cvs mailing list