Commit 117fd7c0 authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

vbscript: Added class property parser implementation.

parent 005808cb
......@@ -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;
......
......@@ -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;
......
......@@ -390,6 +390,10 @@ Class EmptyClass
End Class
Class TestClass
Public publicProp
Private privateProp
Public Function publicFunction()
privateSub()
publicFunction = 4
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment