Jacek Caban : vbscript: Added class property parser implementation.
Alexandre Julliard
julliard at winehq.org
Fri Sep 16 13:28:32 CDT 2011
Module: wine
Branch: master
Commit: 117fd7c0e1c0bf52d78f8c7a5409176297480b90
URL: http://source.winehq.org/git/wine.git/?a=commit;h=117fd7c0e1c0bf52d78f8c7a5409176297480b90
Author: Jacek Caban <jacek at codeweavers.com>
Date: Fri Sep 16 13:27:11 2011 +0200
vbscript: Added class property parser implementation.
---
dlls/vbscript/parse.h | 9 ++++++++-
dlls/vbscript/parser.y | 24 ++++++++++++++++++++++++
dlls/vbscript/tests/lang.vbs | 4 ++++
3 files changed, 36 insertions(+), 1 deletions(-)
diff --git a/dlls/vbscript/parse.h b/dlls/vbscript/parse.h
index 918a6db..63b2ded 100644
--- a/dlls/vbscript/parse.h
+++ b/dlls/vbscript/parse.h
@@ -142,14 +142,21 @@ typedef struct _function_decl_t {
struct _function_decl_t *next;
} function_decl_t;
-typedef struct _function_statement_t {
+typedef struct {
statement_t stat;
function_decl_t *func_decl;
} function_statement_t;
+typedef struct _class_prop_decl_t {
+ BOOL is_public;
+ const WCHAR *name;
+ struct _class_prop_decl_t *next;
+} class_prop_decl_t;
+
typedef struct _class_decl_t {
const WCHAR *name;
function_decl_t *funcs;
+ class_prop_decl_t *props;
struct _class_decl_t *next;
} class_decl_t;
diff --git a/dlls/vbscript/parser.y b/dlls/vbscript/parser.y
index 63423d1..5224c71 100644
--- a/dlls/vbscript/parser.y
+++ b/dlls/vbscript/parser.y
@@ -62,6 +62,7 @@ static arg_decl_t *new_argument_decl(parser_ctx_t*,const WCHAR*,BOOL);
static class_decl_t *new_class_decl(parser_ctx_t*);
static class_decl_t *add_class_function(parser_ctx_t*,class_decl_t*,function_decl_t*);
+static class_decl_t *add_variant_prop(parser_ctx_t*,class_decl_t*,const WCHAR*,unsigned);
#define STORAGE_IS_PRIVATE 1
#define STORAGE_IS_DEFAULT 2
@@ -293,6 +294,7 @@ ClassDeclaration
ClassBody
: /* empty */ { $$ = new_class_decl(ctx); }
| FunctionDecl tNL ClassBody { $$ = add_class_function(ctx, $3, $1); CHECK_ERROR; }
+ | Storage tIdentifier tNL ClassBody { $$ = add_variant_prop(ctx, $4, $2, $1); CHECK_ERROR; }
FunctionDecl
: Storage_opt tSUB tIdentifier ArgumentsDecl_opt tNL StatementsNl_opt tEND tSUB
@@ -628,6 +630,7 @@ static class_decl_t *new_class_decl(parser_ctx_t *ctx)
return NULL;
class_decl->funcs = NULL;
+ class_decl->props = NULL;
class_decl->next = NULL;
return class_decl;
}
@@ -651,6 +654,27 @@ static class_decl_t *add_class_function(parser_ctx_t *ctx, class_decl_t *class_d
return class_decl;
}
+static class_decl_t *add_variant_prop(parser_ctx_t *ctx, class_decl_t *class_decl, const WCHAR *identifier, unsigned storage_flags)
+{
+ class_prop_decl_t *prop;
+
+ if(storage_flags & STORAGE_IS_DEFAULT) {
+ FIXME("variant prop van't be default value\n");
+ ctx->hres = E_FAIL;
+ return NULL;
+ }
+
+ prop = parser_alloc(ctx, sizeof(*prop));
+ if(!prop)
+ return NULL;
+
+ prop->name = identifier;
+ prop->is_public = !(storage_flags & STORAGE_IS_PRIVATE);
+ prop->next = class_decl->props;
+ class_decl->props = prop;
+ return class_decl;
+}
+
void *parser_alloc(parser_ctx_t *ctx, size_t size)
{
void *ret;
diff --git a/dlls/vbscript/tests/lang.vbs b/dlls/vbscript/tests/lang.vbs
index 867779d..e23cd86 100644
--- a/dlls/vbscript/tests/lang.vbs
+++ b/dlls/vbscript/tests/lang.vbs
@@ -390,6 +390,10 @@ Class EmptyClass
End Class
Class TestClass
+ Public publicProp
+
+ Private privateProp
+
Public Function publicFunction()
privateSub()
publicFunction = 4
More information about the wine-cvs
mailing list