From 9a0ddc1388bb296ea8c7b97057b44428ad3b843e Mon Sep 17 00:00:00 2001 From: Amine Khaldi Date: Sun, 1 Dec 2019 19:42:07 +0100 Subject: [PATCH] [VBSCRIPT] Sync with Wine Staging 4.18. CORE-16441 --- dll/win32/vbscript/compile.c | 108 +- dll/win32/vbscript/global.c | 1222 ++++++++----- dll/win32/vbscript/interp.c | 138 +- dll/win32/vbscript/lex.c | 66 +- dll/win32/vbscript/parse.h | 13 +- dll/win32/vbscript/parser.tab.c | 2602 +++++++++++++++++----------- dll/win32/vbscript/parser.tab.h | 149 +- dll/win32/vbscript/parser.y | 169 +- dll/win32/vbscript/regexp.c | 28 +- dll/win32/vbscript/vbdisp.c | 290 +--- dll/win32/vbscript/vbregexp.c | 4 +- dll/win32/vbscript/vbscript.c | 281 +-- dll/win32/vbscript/vbscript.h | 111 +- dll/win32/vbscript/vbscript.rc | 42 + dll/win32/vbscript/vbscript_defs.h | 37 + dll/win32/vbscript/vbscript_main.c | 64 +- media/doc/README.WINE | 2 +- 17 files changed, 3194 insertions(+), 2132 deletions(-) diff --git a/dll/win32/vbscript/compile.c b/dll/win32/vbscript/compile.c index 302804f4c28..c129f3670da 100644 --- a/dll/win32/vbscript/compile.c +++ b/dll/win32/vbscript/compile.c @@ -136,7 +136,7 @@ static WCHAR *compiler_alloc_string(vbscode_t *vbscode, const WCHAR *str) size_t size; WCHAR *ret; - size = (strlenW(str)+1)*sizeof(WCHAR); + size = (lstrlenW(str)+1)*sizeof(WCHAR); ret = compiler_alloc(vbscode, size); if(ret) memcpy(ret, str, size); @@ -375,12 +375,24 @@ static inline BOOL emit_catch(compile_ctx_t *ctx, unsigned off) return emit_catch_jmp(ctx, off, ctx->instr_cnt); } +static HRESULT compile_error(script_ctx_t *ctx, HRESULT error) +{ + if(error == SCRIPT_E_REPORTED) + return error; + + clear_ei(&ctx->ei); + ctx->ei.scode = error = map_hres(error); + ctx->ei.bstrSource = get_vbscript_string(VBS_COMPILE_ERROR); + ctx->ei.bstrDescription = get_vbscript_error_string(error); + return report_script_error(ctx); +} + static expression_t *lookup_const_decls(compile_ctx_t *ctx, const WCHAR *name, BOOL lookup_global) { const_decl_t *decl; for(decl = ctx->const_decls; decl; decl = decl->next) { - if(!strcmpiW(decl->name, name)) + if(!wcsicmp(decl->name, name)) return decl->value_expr; } @@ -388,7 +400,7 @@ static expression_t *lookup_const_decls(compile_ctx_t *ctx, const WCHAR *name, B return NULL; for(decl = ctx->global_consts; decl; decl = decl->next) { - if(!strcmpiW(decl->name, name)) + if(!wcsicmp(decl->name, name)) return decl->value_expr; } @@ -536,10 +548,8 @@ static HRESULT compile_expression(compile_ctx_t *ctx, expression_t *expr) return push_instr_str(ctx, OP_string, ((string_expression_t*)expr)->value); case EXPR_SUB: return compile_binary_expression(ctx, (binary_expression_t*)expr, OP_sub); - case EXPR_USHORT: - return push_instr_int(ctx, OP_short, ((int_expression_t*)expr)->value); - case EXPR_ULONG: - return push_instr_int(ctx, OP_long, ((int_expression_t*)expr)->value); + case EXPR_INT: + return push_instr_int(ctx, OP_int, ((int_expression_t*)expr)->value); case EXPR_XOR: return compile_binary_expression(ctx, (binary_expression_t*)expr, OP_xor); default: @@ -781,7 +791,7 @@ static HRESULT compile_forto_statement(compile_ctx_t *ctx, forto_statement_t *st if(!push_instr(ctx, OP_val)) return E_OUTOFMEMORY; }else { - hres = push_instr_int(ctx, OP_short, 1); + hres = push_instr_int(ctx, OP_int, 1); if(FAILED(hres)) return hres; } @@ -994,7 +1004,7 @@ static BOOL lookup_dim_decls(compile_ctx_t *ctx, const WCHAR *name) dim_decl_t *dim_decl; for(dim_decl = ctx->dim_decls; dim_decl; dim_decl = dim_decl->next) { - if(!strcmpiW(dim_decl->name, name)) + if(!wcsicmp(dim_decl->name, name)) return TRUE; } @@ -1006,7 +1016,7 @@ static BOOL lookup_args_name(compile_ctx_t *ctx, const WCHAR *name) unsigned i; for(i = 0; i < ctx->func->arg_cnt; i++) { - if(!strcmpiW(ctx->func->args[i].name, name)) + if(!wcsicmp(ctx->func->args[i].name, name)) return TRUE; } @@ -1198,6 +1208,21 @@ static HRESULT compile_onerror_statement(compile_ctx_t *ctx, onerror_statement_t return push_instr_int(ctx, OP_errmode, stat->resume_next); } +static HRESULT compile_retval_statement(compile_ctx_t *ctx, retval_statement_t *stat) +{ + HRESULT hres; + + hres = compile_expression(ctx, stat->expr); + if(FAILED(hres)) + return hres; + + hres = push_instr(ctx, OP_retval); + if(FAILED(hres)) + return hres; + + return S_OK; +} + static HRESULT compile_statement(compile_ctx_t *ctx, statement_ctx_t *stat_ctx, statement_t *stat) { HRESULT hres; @@ -1269,6 +1294,9 @@ static HRESULT compile_statement(compile_ctx_t *ctx, statement_ctx_t *stat_ctx, case STAT_WHILELOOP: hres = compile_while_statement(ctx, (while_statement_t*)stat); break; + case STAT_RETVAL: + hres = compile_retval_statement(ctx, (retval_statement_t*)stat); + break; default: FIXME("Unimplemented statement type %d\n", stat->type); hres = E_NOTIMPL; @@ -1444,7 +1472,7 @@ static BOOL lookup_funcs_name(compile_ctx_t *ctx, const WCHAR *name) function_t *iter; for(iter = ctx->funcs; iter; iter = iter->next) { - if(!strcmpiW(iter->name, name)) + if(!wcsicmp(iter->name, name)) return TRUE; } @@ -1511,7 +1539,7 @@ static BOOL lookup_class_name(compile_ctx_t *ctx, const WCHAR *name) class_desc_t *iter; for(iter = ctx->classes; iter; iter = iter->next) { - if(!strcmpiW(iter->name, name)) + if(!wcsicmp(iter->name, name)) return TRUE; } @@ -1563,7 +1591,7 @@ static BOOL lookup_class_funcs(class_desc_t *class_desc, const WCHAR *name) unsigned i; for(i=0; i < class_desc->func_cnt; i++) { - if(class_desc->funcs[i].name && !strcmpiW(class_desc->funcs[i].name, name)) + if(class_desc->funcs[i].name && !wcsicmp(class_desc->funcs[i].name, name)) return TRUE; } @@ -1619,14 +1647,14 @@ static HRESULT compile_class(compile_ctx_t *ctx, class_decl_t *class_decl) } } - if(!strcmpiW(class_initializeW, func_decl->name)) { + if(!wcsicmp(class_initializeW, func_decl->name)) { if(func_decl->type != FUNC_SUB) { FIXME("class initializer is not sub\n"); return E_FAIL; } class_desc->class_initialize_id = i; - }else if(!strcmpiW(class_terminateW, func_decl->name)) { + }else if(!wcsicmp(class_terminateW, func_decl->name)) { if(func_decl->type != FUNC_SUB) { FIXME("class terminator is not sub\n"); return E_FAIL; @@ -1690,17 +1718,17 @@ static BOOL lookup_script_identifier(script_ctx_t *script, const WCHAR *identifi function_t *func; for(var = script->global_vars; var; var = var->next) { - if(!strcmpiW(var->name, identifier)) + if(!wcsicmp(var->name, identifier)) return TRUE; } for(func = script->global_funcs; func; func = func->next) { - if(!strcmpiW(func->name, identifier)) + if(!wcsicmp(func->name, identifier)) return TRUE; } for(class = script->classes; class; class = class->next) { - if(!strcmpiW(class->name, identifier)) + if(!wcsicmp(class->name, identifier)) return TRUE; } @@ -1797,7 +1825,7 @@ static void release_compiler(compile_ctx_t *ctx) release_vbscode(ctx->code); } -HRESULT compile_script(script_ctx_t *script, const WCHAR *src, const WCHAR *delimiter, vbscode_t **ret) +HRESULT compile_script(script_ctx_t *script, const WCHAR *src, const WCHAR *delimiter, DWORD flags, vbscode_t **ret) { function_t *new_func; function_decl_t *func_decl; @@ -1806,13 +1834,15 @@ HRESULT compile_script(script_ctx_t *script, const WCHAR *src, const WCHAR *deli vbscode_t *code; HRESULT hres; - hres = parse_script(&ctx.parser, src, delimiter); + if (!src) src = L""; + + hres = parse_script(&ctx.parser, src, delimiter, flags); if(FAILED(hres)) - return hres; + return compile_error(script, hres); code = ctx.code = alloc_vbscode(&ctx, src); if(!ctx.code) - return E_OUTOFMEMORY; + return compile_error(script, E_OUTOFMEMORY); ctx.funcs = NULL; ctx.func_decls = NULL; @@ -1826,7 +1856,7 @@ HRESULT compile_script(script_ctx_t *script, const WCHAR *src, const WCHAR *deli hres = compile_func(&ctx, ctx.parser.stats, &ctx.code->main_code); if(FAILED(hres)) { release_compiler(&ctx); - return hres; + return compile_error(script, hres); } ctx.global_consts = ctx.const_decls; @@ -1835,7 +1865,7 @@ HRESULT compile_script(script_ctx_t *script, const WCHAR *src, const WCHAR *deli hres = create_function(&ctx, func_decl, &new_func); if(FAILED(hres)) { release_compiler(&ctx); - return hres; + return compile_error(script, hres); } new_func->next = ctx.funcs; @@ -1846,14 +1876,14 @@ HRESULT compile_script(script_ctx_t *script, const WCHAR *src, const WCHAR *deli hres = compile_class(&ctx, class_decl); if(FAILED(hres)) { release_compiler(&ctx); - return hres; + return compile_error(script, hres); } } hres = check_script_collisions(&ctx, script); if(FAILED(hres)) { release_compiler(&ctx); - return hres; + return compile_error(script, hres); } if(ctx.global_vars) { @@ -1896,3 +1926,29 @@ HRESULT compile_script(script_ctx_t *script, const WCHAR *src, const WCHAR *deli *ret = code; return S_OK; } + +HRESULT compile_procedure(script_ctx_t *script, const WCHAR *src, const WCHAR *delimiter, DWORD flags, class_desc_t **ret) +{ + class_desc_t *desc; + vbscode_t *code; + HRESULT hres; + + hres = compile_script(script, src, delimiter, flags, &code); + if(FAILED(hres)) + return hres; + + if(!(desc = compiler_alloc_zero(code, sizeof(*desc)))) + return E_OUTOFMEMORY; + if(!(desc->funcs = compiler_alloc_zero(code, sizeof(*desc->funcs)))) + return E_OUTOFMEMORY; + + desc->ctx = script; + desc->func_cnt = 1; + desc->funcs->entries[VBDISP_CALLGET] = &code->main_code; + + desc->next = script->procs; + script->procs = desc; + + *ret = desc; + return S_OK; +} diff --git a/dll/win32/vbscript/global.c b/dll/win32/vbscript/global.c index 6d26b2c6a5c..db1f4c74405 100644 --- a/dll/win32/vbscript/global.c +++ b/dll/win32/vbscript/global.c @@ -29,6 +29,7 @@ #ifdef __REACTOS__ #include +#include #endif WINE_DEFAULT_DEBUG_CHANNEL(vbscript); @@ -43,6 +44,252 @@ const GUID GUID_CUSTOM_CONFIRMOBJECTSAFETY = static const WCHAR emptyW[] = {0}; static const WCHAR vbscriptW[] = {'V','B','S','c','r','i','p','t',0}; +#define BP_GET 1 +#define BP_GETPUT 2 + +typedef struct { + UINT16 len; + WCHAR buf[7]; +} string_constant_t; + +struct _builtin_prop_t { + const WCHAR *name; + HRESULT (*proc)(BuiltinDisp*,VARIANT*,unsigned,VARIANT*); + DWORD flags; + unsigned min_args; + UINT_PTR max_args; +}; + +static inline BuiltinDisp *impl_from_IDispatch(IDispatch *iface) +{ + return CONTAINING_RECORD(iface, BuiltinDisp, IDispatch_iface); +} + +static HRESULT WINAPI Builtin_QueryInterface(IDispatch *iface, REFIID riid, void **ppv) +{ + BuiltinDisp *This = impl_from_IDispatch(iface); + + if(IsEqualGUID(&IID_IUnknown, riid)) { + TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv); + *ppv = &This->IDispatch_iface; + }else if(IsEqualGUID(&IID_IDispatch, riid)) { + TRACE("(%p)->(IID_IDispatch %p)\n", This, ppv); + *ppv = &This->IDispatch_iface; + }else { + WARN("(%p)->(%s %p)\n", This, debugstr_guid(riid), ppv); + *ppv = NULL; + return E_NOINTERFACE; + } + + IUnknown_AddRef((IUnknown*)*ppv); + return S_OK; +} + +static ULONG WINAPI Builtin_AddRef(IDispatch *iface) +{ + BuiltinDisp *This = impl_from_IDispatch(iface); + LONG ref = InterlockedIncrement(&This->ref); + + TRACE("(%p) ref=%d\n", This, ref); + + return ref; +} + +static ULONG WINAPI Builtin_Release(IDispatch *iface) +{ + BuiltinDisp *This = impl_from_IDispatch(iface); + LONG ref = InterlockedDecrement(&This->ref); + + TRACE("(%p) ref=%d\n", This, ref); + + if(!ref) { + assert(!This->ctx); + heap_free(This); + } + + return ref; +} + +static HRESULT WINAPI Builtin_GetTypeInfoCount(IDispatch *iface, UINT *pctinfo) +{ + BuiltinDisp *This = impl_from_IDispatch(iface); + TRACE("(%p)->(%p)\n", This, pctinfo); + *pctinfo = 0; + return S_OK; +} + +static HRESULT WINAPI Builtin_GetTypeInfo(IDispatch *iface, UINT iTInfo, LCID lcid, ITypeInfo **ppTInfo) +{ + BuiltinDisp *This = impl_from_IDispatch(iface); + TRACE("(%p)->(%u %u %p)\n", This, iTInfo, lcid, ppTInfo); + return DISP_E_BADINDEX; +} + +HRESULT get_builtin_id(BuiltinDisp *disp, const WCHAR *name, DISPID *id) +{ + size_t min = 1, max = disp->member_cnt - 1, i; + int r; + + while(min <= max) { + i = (min + max) / 2; + r = wcsicmp(disp->members[i].name, name); + if(!r) { + *id = i; + return S_OK; + } + if(r < 0) + min = i+1; + else + max = i-1; + } + + return DISP_E_MEMBERNOTFOUND; + +} + +static HRESULT WINAPI Builtin_GetIDsOfNames(IDispatch *iface, REFIID riid, LPOLESTR *names, UINT name_cnt, + LCID lcid, DISPID *ids) +{ + BuiltinDisp *This = impl_from_IDispatch(iface); + unsigned i; + HRESULT hres; + + TRACE("(%p)->(%s %p %u %u %p)\n", This, debugstr_guid(riid), names, name_cnt, lcid, ids); + + if(!This->ctx) { + FIXME("NULL context\n"); + return E_UNEXPECTED; + } + + for(i = 0; i < name_cnt; i++) { + hres = get_builtin_id(This, names[i], &ids[i]); + if(FAILED(hres)) + return hres; + } + + return S_OK; +} + +static HRESULT WINAPI Builtin_Invoke(IDispatch *iface, DISPID id, REFIID riid, LCID lcid, WORD flags, + DISPPARAMS *dp, VARIANT *res, EXCEPINFO *ei, UINT *err) +{ + BuiltinDisp *This = impl_from_IDispatch(iface); + const builtin_prop_t *prop; + VARIANT args[8]; + unsigned argn, i; + + TRACE("(%p)->(%d %s %d %d %p %p %p %p)\n", This, id, debugstr_guid(riid), lcid, flags, dp, res, ei, err); + + if(!This->ctx) { + FIXME("NULL context\n"); + return E_UNEXPECTED; + } + + if(id >= This->member_cnt || (!This->members[id].proc && !This->members[id].flags)) + return DISP_E_MEMBERNOTFOUND; + prop = This->members + id; + + switch(flags) { + case DISPATCH_PROPERTYGET: + if(!(prop->flags & (BP_GET|BP_GETPUT))) { + FIXME("property does not support DISPATCH_PROPERTYGET\n"); + return E_FAIL; + } + break; + case DISPATCH_PROPERTYGET|DISPATCH_METHOD: + if(!prop->proc && prop->flags == BP_GET) { + const int vt = prop->min_args, val = prop->max_args; + switch(vt) { + case VT_I2: + V_VT(res) = VT_I2; + V_I2(res) = val; + break; + case VT_I4: + V_VT(res) = VT_I4; + V_I4(res) = val; + break; + case VT_BSTR: { + const string_constant_t *str = (const string_constant_t*)prop->max_args; + BSTR ret; + + ret = SysAllocStringLen(str->buf, str->len); + if(!ret) + return E_OUTOFMEMORY; + + V_VT(res) = VT_BSTR; + V_BSTR(res) = ret; + break; + } + DEFAULT_UNREACHABLE; + } + return S_OK; + } + break; + case DISPATCH_METHOD: + if(prop->flags & (BP_GET|BP_GETPUT)) { + FIXME("Call on property\n"); + return E_FAIL; + } + break; + case DISPATCH_PROPERTYPUT: + if(!(prop->flags & BP_GETPUT)) { + FIXME("property does not support DISPATCH_PROPERTYPUT\n"); + return E_FAIL; + } + + FIXME("call put\n"); + return E_NOTIMPL; + default: + FIXME("unsupported flags %x\n", flags); + return E_NOTIMPL; + } + + argn = arg_cnt(dp); + + if(argn < prop->min_args || argn > (prop->max_args ? prop->max_args : prop->min_args)) { + WARN("invalid number of arguments\n"); + return MAKE_VBSERROR(VBSE_FUNC_ARITY_MISMATCH); + } + + assert(argn < ARRAY_SIZE(args)); + + for(i=0; i < argn; i++) { + if(V_VT(dp->rgvarg+dp->cArgs-i-1) == (VT_BYREF|VT_VARIANT)) + args[i] = *V_VARIANTREF(dp->rgvarg+dp->cArgs-i-1); + else + args[i] = dp->rgvarg[dp->cArgs-i-1]; + } + + return prop->proc(This, args, dp->cArgs, res); +} + +static const IDispatchVtbl BuiltinDispVtbl = { + Builtin_QueryInterface, + Builtin_AddRef, + Builtin_Release, + Builtin_GetTypeInfoCount, + Builtin_GetTypeInfo, + Builtin_GetIDsOfNames, + Builtin_Invoke +}; + +static HRESULT create_builtin_dispatch(script_ctx_t *ctx, const builtin_prop_t *members, size_t member_cnt, BuiltinDisp **ret) +{ + BuiltinDisp *disp; + + if(!(disp = heap_alloc(sizeof(*disp)))) + return E_OUTOFMEMORY; + + disp->IDispatch_iface.lpVtbl = &BuiltinDispVtbl; + disp->ref = 1; + disp->members = members; + disp->member_cnt = member_cnt; + disp->ctx = ctx; + + *ret = disp; + return S_OK; +} + static IInternetHostSecurityManager *get_sec_mgr(script_ctx_t *ctx) { IInternetHostSecurityManager *secmgr; @@ -202,6 +449,19 @@ static HRESULT to_string(VARIANT *v, BSTR *ret) return S_OK; } +static HRESULT to_system_time(VARIANT *v, SYSTEMTIME *st) +{ + VARIANT date; + HRESULT hres; + + V_VT(&date) = VT_EMPTY; + hres = VariantChangeType(&date, v, 0, VT_DATE); + if(FAILED(hres)) + return hres; + + return VariantTimeToSystemTime(V_DATE(&date), st); +} + static HRESULT set_object_site(script_ctx_t *ctx, IUnknown *obj) { IObjectWithSite *obj_site; @@ -333,7 +593,7 @@ static HRESULT show_msgbox(script_ctx_t *ctx, BSTR prompt, unsigned type, BSTR o if(orig_title && *orig_title) { WCHAR *ptr; - title = title_buf = heap_alloc(sizeof(vbscriptW) + (strlenW(orig_title)+2)*sizeof(WCHAR)); + title = title_buf = heap_alloc(sizeof(vbscriptW) + (lstrlenW(orig_title)+2)*sizeof(WCHAR)); if(!title) return E_OUTOFMEMORY; @@ -342,7 +602,7 @@ static HRESULT show_msgbox(script_ctx_t *ctx, BSTR prompt, unsigned type, BSTR o *ptr++ = ':'; *ptr++ = ' '; - strcpyW(ptr, orig_title); + lstrcpyW(ptr, orig_title); }else { title = vbscriptW; } @@ -369,7 +629,7 @@ static HRESULT show_msgbox(script_ctx_t *ctx, BSTR prompt, unsigned type, BSTR o return return_short(res, ret); } -static HRESULT Global_CCur(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) +static HRESULT Global_CCur(BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) { VARIANT v; HRESULT hres; @@ -392,7 +652,7 @@ static HRESULT Global_CCur(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARI return S_OK; } -static HRESULT Global_CInt(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) +static HRESULT Global_CInt(BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) { VARIANT v; HRESULT hres; @@ -414,7 +674,7 @@ static HRESULT Global_CInt(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARI } } -static HRESULT Global_CLng(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) +static HRESULT Global_CLng(BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) { int i; HRESULT hres; @@ -432,7 +692,7 @@ static HRESULT Global_CLng(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARI return return_int(res, i); } -static HRESULT Global_CBool(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) +static HRESULT Global_CBool(BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) { VARIANT v; HRESULT hres; @@ -453,7 +713,7 @@ static HRESULT Global_CBool(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VAR return S_OK; } -static HRESULT Global_CByte(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) +static HRESULT Global_CByte(BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) { VARIANT v; HRESULT hres; @@ -476,13 +736,13 @@ static HRESULT Global_CByte(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VAR return S_OK; } -static HRESULT Global_CDate(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) +static HRESULT Global_CDate(BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) { FIXME("\n"); return E_NOTIMPL; } -static HRESULT Global_CDbl(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) +static HRESULT Global_CDbl(BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) { VARIANT v; HRESULT hres; @@ -504,7 +764,7 @@ static HRESULT Global_CDbl(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARI } } -static HRESULT Global_CSng(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) +static HRESULT Global_CSng(BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) { VARIANT v; HRESULT hres; @@ -525,13 +785,16 @@ static HRESULT Global_CSng(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARI return S_OK; } -static HRESULT Global_CStr(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) +static HRESULT Global_CStr(BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) { BSTR str; HRESULT hres; TRACE("%s\n", debugstr_variant(arg)); + if(V_VT(arg) == VT_NULL) + return MAKE_VBSERROR(VBSE_ILLEGAL_NULL_USE); + hres = to_string(arg, &str); if(FAILED(hres)) return hres; @@ -544,7 +807,7 @@ static inline WCHAR hex_char(unsigned n) return n < 10 ? '0'+n : 'A'+n-10; } -static HRESULT Global_Hex(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) +static HRESULT Global_Hex(BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) { WCHAR buf[17], *ptr; DWORD n; @@ -585,7 +848,7 @@ static HRESULT Global_Hex(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIA return return_string(res, ptr); } -static HRESULT Global_Oct(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) +static HRESULT Global_Oct(BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) { HRESULT hres; WCHAR buf[23], *ptr; @@ -626,27 +889,30 @@ static HRESULT Global_Oct(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIA return return_string(res, ptr); } -static HRESULT Global_VarType(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) +static HRESULT Global_VarType(BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) { + VARTYPE vt; + TRACE("(%s)\n", debugstr_variant(arg)); assert(args_cnt == 1); - if(V_VT(arg) & ~VT_TYPEMASK) { + vt = V_VT(arg) & ~VT_BYREF; + if(vt & ~(VT_TYPEMASK | VT_ARRAY)) { FIXME("not supported %s\n", debugstr_variant(arg)); return E_NOTIMPL; } - return return_short(res, V_VT(arg)); + return return_short(res, vt); } -static HRESULT Global_IsDate(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) +static HRESULT Global_IsDate(BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) { FIXME("\n"); return E_NOTIMPL; } -static HRESULT Global_IsEmpty(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) +static HRESULT Global_IsEmpty(BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) { TRACE("(%s)\n", debugstr_variant(arg)); @@ -659,7 +925,7 @@ static HRESULT Global_IsEmpty(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, V return S_OK; } -static HRESULT Global_IsNull(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) +static HRESULT Global_IsNull(BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) { TRACE("(%s)\n", debugstr_variant(arg)); @@ -672,7 +938,7 @@ static HRESULT Global_IsNull(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VA return S_OK; } -static HRESULT Global_IsNumeric(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) +static HRESULT Global_IsNumeric(BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) { HRESULT hres; double d; @@ -686,13 +952,13 @@ static HRESULT Global_IsNumeric(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, return return_bool(res, SUCCEEDED(hres)); } -static HRESULT Global_IsArray(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) +static HRESULT Global_IsArray(BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) { FIXME("\n"); return E_NOTIMPL; } -static HRESULT Global_IsObject(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) +static HRESULT Global_IsObject(BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) { TRACE("(%s)\n", debugstr_variant(arg)); @@ -705,7 +971,7 @@ static HRESULT Global_IsObject(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, return S_OK; } -static HRESULT Global_Atn(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) +static HRESULT Global_Atn(BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) { HRESULT hres; double d; @@ -717,7 +983,7 @@ static HRESULT Global_Atn(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIA return return_double(res, atan(d)); } -static HRESULT Global_Cos(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) +static HRESULT Global_Cos(BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) { HRESULT hres; double d; @@ -729,7 +995,7 @@ static HRESULT Global_Cos(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIA return return_double(res, cos(d)); } -static HRESULT Global_Sin(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) +static HRESULT Global_Sin(BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) { HRESULT hres; double d; @@ -741,7 +1007,7 @@ static HRESULT Global_Sin(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIA return return_double(res, sin(d)); } -static HRESULT Global_Tan(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) +static HRESULT Global_Tan(BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) { HRESULT hres; double d; @@ -753,7 +1019,7 @@ static HRESULT Global_Tan(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIA return return_double(res, tan(d)); } -static HRESULT Global_Exp(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) +static HRESULT Global_Exp(BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) { HRESULT hres; double d; @@ -765,7 +1031,7 @@ static HRESULT Global_Exp(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIA return return_double(res, exp(d)); } -static HRESULT Global_Log(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) +static HRESULT Global_Log(BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) { HRESULT hres; double d; @@ -780,7 +1046,7 @@ static HRESULT Global_Log(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIA return return_double(res, log(d)); } -static HRESULT Global_Sqr(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) +static HRESULT Global_Sqr(BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) { HRESULT hres; double d; @@ -795,19 +1061,19 @@ static HRESULT Global_Sqr(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIA return return_double(res, sqrt(d)); } -static HRESULT Global_Randomize(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) +static HRESULT Global_Randomize(BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) { FIXME("\n"); return E_NOTIMPL; } -static HRESULT Global_Rnd(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) +static HRESULT Global_Rnd(BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) { FIXME("\n"); return E_NOTIMPL; } -static HRESULT Global_Timer(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) +static HRESULT Global_Timer(BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) { SYSTEMTIME lt; double sec; @@ -818,13 +1084,13 @@ static HRESULT Global_Timer(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VAR } -static HRESULT Global_LBound(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) +static HRESULT Global_LBound(BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) { FIXME("\n"); return E_NOTIMPL; } -static HRESULT Global_UBound(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) +static HRESULT Global_UBound(BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) { SAFEARRAY *sa; HRESULT hres; @@ -862,7 +1128,7 @@ static HRESULT Global_UBound(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VA return return_int(res, ubound); } -static HRESULT Global_RGB(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) +static HRESULT Global_RGB(BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) { HRESULT hres; int i, color[3]; @@ -884,7 +1150,7 @@ static HRESULT Global_RGB(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIA return return_int(res, RGB(color[0], color[1], color[2])); } -static HRESULT Global_Len(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) +static HRESULT Global_Len(BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) { DWORD len; HRESULT hres; @@ -910,13 +1176,13 @@ static HRESULT Global_Len(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIA return return_int(res, len); } -static HRESULT Global_LenB(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) +static HRESULT Global_LenB(BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) { FIXME("\n"); return E_NOTIMPL; } -static HRESULT Global_Left(vbdisp_t *This, VARIANT *args, unsigned args_cnt, VARIANT *res) +static HRESULT Global_Left(BuiltinDisp *This, VARIANT *args, unsigned args_cnt, VARIANT *res) { BSTR str, ret, conv_str = NULL; int len, str_len; @@ -954,13 +1220,13 @@ static HRESULT Global_Left(vbdisp_t *This, VARIANT *args, unsigned args_cnt, VAR return return_bstr(res, ret); } -static HRESULT Global_LeftB(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) +static HRESULT Global_LeftB(BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) { FIXME("\n"); return E_NOTIMPL; } -static HRESULT Global_Right(vbdisp_t *This, VARIANT *args, unsigned args_cnt, VARIANT *res) +static HRESULT Global_Right(BuiltinDisp *This, VARIANT *args, unsigned args_cnt, VARIANT *res) { BSTR str, ret, conv_str = NULL; int len, str_len; @@ -998,13 +1264,13 @@ static HRESULT Global_Right(vbdisp_t *This, VARIANT *args, unsigned args_cnt, VA return return_bstr(res, ret); } -static HRESULT Global_RightB(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) +static HRESULT Global_RightB(BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) { FIXME("\n"); return E_NOTIMPL; } -static HRESULT Global_Mid(vbdisp_t *This, VARIANT *args, unsigned args_cnt, VARIANT *res) +static HRESULT Global_Mid(BuiltinDisp *This, VARIANT *args, unsigned args_cnt, VARIANT *res) { int len = -1, start, str_len; BSTR str; @@ -1057,13 +1323,13 @@ static HRESULT Global_Mid(vbdisp_t *This, VARIANT *args, unsigned args_cnt, VARI return S_OK; } -static HRESULT Global_MidB(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) +static HRESULT Global_MidB(BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) { FIXME("\n"); return E_NOTIMPL; } -static HRESULT Global_StrComp(vbdisp_t *This, VARIANT *args, unsigned args_cnt, VARIANT *res) +static HRESULT Global_StrComp(BuiltinDisp *This, VARIANT *args, unsigned args_cnt, VARIANT *res) { BSTR left, right; int mode, ret; @@ -1098,7 +1364,7 @@ static HRESULT Global_StrComp(vbdisp_t *This, VARIANT *args, unsigned args_cnt, return hres; } - ret = mode ? strcmpiW(left, right) : strcmpW(left, right); + ret = mode ? wcsicmp(left, right) : wcscmp(left, right); val = ret < 0 ? -1 : (ret > 0 ? 1 : 0); SysFreeString(left); @@ -1106,7 +1372,7 @@ static HRESULT Global_StrComp(vbdisp_t *This, VARIANT *args, unsigned args_cnt, return return_short(res, val); } -static HRESULT Global_LCase(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) +static HRESULT Global_LCase(BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) { BSTR str; HRESULT hres; @@ -1127,7 +1393,7 @@ static HRESULT Global_LCase(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VAR WCHAR *ptr; for(ptr = str; *ptr; ptr++) - *ptr = tolowerW(*ptr); + *ptr = towlower(*ptr); V_VT(res) = VT_BSTR; V_BSTR(res) = str; @@ -1137,7 +1403,7 @@ static HRESULT Global_LCase(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VAR return S_OK; } -static HRESULT Global_UCase(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) +static HRESULT Global_UCase(BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) { BSTR str; HRESULT hres; @@ -1158,7 +1424,7 @@ static HRESULT Global_UCase(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VAR WCHAR *ptr; for(ptr = str; *ptr; ptr++) - *ptr = toupperW(*ptr); + *ptr = towupper(*ptr); V_VT(res) = VT_BSTR; V_BSTR(res) = str; @@ -1168,7 +1434,7 @@ static HRESULT Global_UCase(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VAR return S_OK; } -static HRESULT Global_LTrim(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) +static HRESULT Global_LTrim(BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) { BSTR str, conv_str = NULL; WCHAR *ptr; @@ -1185,7 +1451,7 @@ static HRESULT Global_LTrim(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VAR str = conv_str; } - for(ptr = str; *ptr && isspaceW(*ptr); ptr++); + for(ptr = str; *ptr && iswspace(*ptr); ptr++); str = SysAllocString(ptr); SysFreeString(conv_str); @@ -1195,7 +1461,7 @@ static HRESULT Global_LTrim(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VAR return return_bstr(res, str); } -static HRESULT Global_RTrim(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) +static HRESULT Global_RTrim(BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) { BSTR str, conv_str = NULL; WCHAR *ptr; @@ -1212,7 +1478,7 @@ static HRESULT Global_RTrim(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VAR str = conv_str; } - for(ptr = str+SysStringLen(str); ptr-1 > str && isspaceW(*(ptr-1)); ptr--); + for(ptr = str+SysStringLen(str); ptr-1 > str && iswspace(*(ptr-1)); ptr--); str = SysAllocStringLen(str, ptr-str); SysFreeString(conv_str); @@ -1222,7 +1488,7 @@ static HRESULT Global_RTrim(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VAR return return_bstr(res, str); } -static HRESULT Global_Trim(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) +static HRESULT Global_Trim(BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) { BSTR str, conv_str = NULL; WCHAR *begin_ptr, *end_ptr; @@ -1239,8 +1505,8 @@ static HRESULT Global_Trim(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARI str = conv_str; } - for(begin_ptr = str; *begin_ptr && isspaceW(*begin_ptr); begin_ptr++); - for(end_ptr = str+SysStringLen(str); end_ptr-1 > begin_ptr && isspaceW(*(end_ptr-1)); end_ptr--); + for(begin_ptr = str; *begin_ptr && iswspace(*begin_ptr); begin_ptr++); + for(end_ptr = str+SysStringLen(str); end_ptr-1 > begin_ptr && iswspace(*(end_ptr-1)); end_ptr--); str = SysAllocStringLen(begin_ptr, end_ptr-begin_ptr); SysFreeString(conv_str); @@ -1250,7 +1516,7 @@ static HRESULT Global_Trim(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARI return return_bstr(res, str); } -static HRESULT Global_Space(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) +static HRESULT Global_Space(BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) { BSTR str; int n, i; @@ -1282,13 +1548,13 @@ static HRESULT Global_Space(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VAR return S_OK; } -static HRESULT Global_String(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) +static HRESULT Global_String(BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) { FIXME("\n"); return E_NOTIMPL; } -static HRESULT Global_InStr(vbdisp_t *This, VARIANT *args, unsigned args_cnt, VARIANT *res) +static HRESULT Global_InStr(BuiltinDisp *This, VARIANT *args, unsigned args_cnt, VARIANT *res) { VARIANT *startv, *str1v, *str2v; BSTR str1, str2; @@ -1346,7 +1612,7 @@ static HRESULT Global_InStr(vbdisp_t *This, VARIANT *args, unsigned args_cnt, VA if(start < SysStringLen(str1)) { WCHAR *ptr; - ptr = strstrW(str1+start, str2); + ptr = wcsstr(str1+start, str2); ret = ptr ? ptr-str1+1 : 0; }else { ret = 0; @@ -1355,34 +1621,58 @@ static HRESULT Global_InStr(vbdisp_t *This, VARIANT *args, unsigned args_cnt, VA return return_int(res, ret); } -static HRESULT Global_InStrB(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) +static HRESULT Global_InStrB(BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) { FIXME("\n"); return E_NOTIMPL; } -static HRESULT Global_AscB(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) +static HRESULT Global_AscB(BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) { FIXME("\n"); return E_NOTIMPL; } -static HRESULT Global_ChrB(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) +static HRESULT Global_ChrB(BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) { FIXME("\n"); return E_NOTIMPL; } -static HRESULT Global_Asc(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) +static HRESULT Global_Asc(BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) { - FIXME("\n"); - return E_NOTIMPL; + BSTR conv_str = NULL, str; + HRESULT hres = S_OK; + + TRACE("(%s)\n", debugstr_variant(arg)); + + switch(V_VT(arg)) { + case VT_NULL: + return MAKE_VBSERROR(VBSE_ILLEGAL_NULL_USE); + case VT_EMPTY: + return MAKE_VBSERROR(VBSE_ILLEGAL_FUNC_CALL); + case VT_BSTR: + str = V_BSTR(arg); + break; + default: + hres = to_string(arg, &conv_str); + if(FAILED(hres)) + return hres; + str = conv_str; + } + + if(!SysStringLen(str) || *str >= 0x100) + hres = MAKE_VBSERROR(VBSE_ILLEGAL_FUNC_CALL); + else if(res) + hres = return_short(res, *str); + SysFreeString(conv_str); + return hres; } /* The function supports only single-byte and double-byte character sets. It * ignores language specified by IActiveScriptSite::GetLCID. The argument needs * to be in range of short or unsigned short. */ -static HRESULT Global_Chr(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) +static HRESULT Global_Chr(BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) { int cp, c, len = 0; CPINFO cpi; @@ -1424,19 +1714,19 @@ static HRESULT Global_Chr(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIA return S_OK; } -static HRESULT Global_AscW(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) +static HRESULT Global_AscW(BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) { FIXME("\n"); return E_NOTIMPL; } -static HRESULT Global_ChrW(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) +static HRESULT Global_ChrW(BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) { FIXME("\n"); return E_NOTIMPL; } -static HRESULT Global_Abs(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) +static HRESULT Global_Abs(BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) { HRESULT hres; VARIANT dst; @@ -1457,7 +1747,7 @@ static HRESULT Global_Abs(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIA return S_OK; } -static HRESULT Global_Fix(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) +static HRESULT Global_Fix(BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) { HRESULT hres; VARIANT dst; @@ -1478,7 +1768,7 @@ static HRESULT Global_Fix(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIA return S_OK; } -static HRESULT Global_Int(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) +static HRESULT Global_Int(BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) { HRESULT hres; VARIANT dst; @@ -1499,7 +1789,7 @@ static HRESULT Global_Int(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIA return S_OK; } -static HRESULT Global_Sgn(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) +static HRESULT Global_Sgn(BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) { double v; short val; @@ -1520,7 +1810,7 @@ static HRESULT Global_Sgn(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIA return return_short(res, val); } -static HRESULT Global_Now(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) +static HRESULT Global_Now(BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) { SYSTEMTIME lt; double date; @@ -1532,7 +1822,7 @@ static HRESULT Global_Now(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIA return return_date(res, date); } -static HRESULT Global_Date(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) +static HRESULT Global_Date(BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) { SYSTEMTIME lt; UDATE ud; @@ -1550,7 +1840,7 @@ static HRESULT Global_Date(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARI return return_date(res, date); } -static HRESULT Global_Time(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) +static HRESULT Global_Time(BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) { SYSTEMTIME lt; UDATE ud; @@ -1568,79 +1858,109 @@ static HRESULT Global_Time(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARI return return_date(res, time); } -static HRESULT Global_Day(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) +static HRESULT Global_Day(BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) +{ + SYSTEMTIME st; + HRESULT hres; + + TRACE("(%s)\n", debugstr_variant(arg)); + + hres = to_system_time(arg, &st); + return FAILED(hres) ? hres : return_short(res, st.wDay); +} + +static HRESULT Global_Month(BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) +{ + SYSTEMTIME st; + HRESULT hres; + + TRACE("(%s)\n", debugstr_variant(arg)); + + hres = to_system_time(arg, &st); + return FAILED(hres) ? hres : return_short(res, st.wMonth); +} + +static HRESULT Global_Weekday(BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) { FIXME("\n"); return E_NOTIMPL; } -static HRESULT Global_Month(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) +static HRESULT Global_Year(BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) +{ + SYSTEMTIME st; + HRESULT hres; + + TRACE("(%s)\n", debugstr_variant(arg)); + + hres = to_system_time(arg, &st); + return FAILED(hres) ? hres : return_short(res, st.wYear); +} + +static HRESULT Global_Hour(BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) +{ + SYSTEMTIME st; + HRESULT hres; + + TRACE("(%s)\n", debugstr_variant(arg)); + + hres = to_system_time(arg, &st); + return FAILED(hres) ? hres : return_short(res, st.wHour); +} + +static HRESULT Global_Minute(BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) +{ + SYSTEMTIME st; + HRESULT hres; + + TRACE("(%s)\n", debugstr_variant(arg)); + + hres = to_system_time(arg, &st); + return FAILED(hres) ? hres : return_short(res, st.wMinute); +} + +static HRESULT Global_Second(BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) +{ + SYSTEMTIME st; + HRESULT hres; + + TRACE("(%s)\n", debugstr_variant(arg)); + + hres = to_system_time(arg, &st); + return FAILED(hres) ? hres : return_short(res, st.wSecond); +} + +static HRESULT Global_DateValue(BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) { FIXME("\n"); return E_NOTIMPL; } -static HRESULT Global_Weekday(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) +static HRESULT Global_TimeValue(BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) { FIXME("\n"); return E_NOTIMPL; } -static HRESULT Global_Year(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) +static HRESULT Global_DateSerial(BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) { FIXME("\n"); return E_NOTIMPL; } -static HRESULT Global_Hour(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) +static HRESULT Global_TimeSerial(BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) { FIXME("\n"); return E_NOTIMPL; } -static HRESULT Global_Minute(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) +static HRESULT Global_InputBox(BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) { FIXME("\n"); return E_NOTIMPL; } -static HRESULT Global_Second(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) -{ - FIXME("\n"); - return E_NOTIMPL; -} - -static HRESULT Global_DateValue(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) -{ - FIXME("\n"); - return E_NOTIMPL; -} - -static HRESULT Global_TimeValue(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) -{ - FIXME("\n"); - return E_NOTIMPL; -} - -static HRESULT Global_DateSerial(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) -{ - FIXME("\n"); - return E_NOTIMPL; -} - -static HRESULT Global_TimeSerial(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) -{ - FIXME("\n"); - return E_NOTIMPL; -} - -static HRESULT Global_InputBox(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) -{ - FIXME("\n"); - return E_NOTIMPL; -} - -static HRESULT Global_MsgBox(vbdisp_t *This, VARIANT *args, unsigned args_cnt, VARIANT *res) +static HRESULT Global_MsgBox(BuiltinDisp *This, VARIANT *args, unsigned args_cnt, VARIANT *res) { BSTR prompt, title = NULL; int type = MB_OK; @@ -1666,14 +1986,14 @@ static HRESULT Global_MsgBox(vbdisp_t *This, VARIANT *args, unsigned args_cnt, V } if(SUCCEEDED(hres)) - hres = show_msgbox(This->desc->ctx, prompt, type, title, res); + hres = show_msgbox(This->ctx, prompt, type, title, res); SysFreeString(prompt); SysFreeString(title); return hres; } -static HRESULT Global_CreateObject(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) +static HRESULT Global_CreateObject(BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) { IUnknown *obj; HRESULT hres; @@ -1685,7 +2005,7 @@ static HRESULT Global_CreateObject(vbdisp_t *This, VARIANT *arg, unsigned args_c return E_INVALIDARG; } - obj = create_object(This->desc->ctx, V_BSTR(arg)); + obj = create_object(This->ctx, V_BSTR(arg)); if(!obj) return VB_E_CANNOT_CREATE_OBJ; @@ -1701,7 +2021,7 @@ static HRESULT Global_CreateObject(vbdisp_t *This, VARIANT *arg, unsigned args_c return S_OK; } -static HRESULT Global_GetObject(vbdisp_t *This, VARIANT *args, unsigned args_cnt, VARIANT *res) +static HRESULT Global_GetObject(BuiltinDisp *This, VARIANT *args, unsigned args_cnt, VARIANT *res) { IBindCtx *bind_ctx; IUnknown *obj_unk; @@ -1717,7 +2037,7 @@ static HRESULT Global_GetObject(vbdisp_t *This, VARIANT *args, unsigned args_cnt return E_NOTIMPL; } - if(This->desc->ctx->safeopt & (INTERFACE_USES_SECURITY_MANAGER|INTERFACESAFE_FOR_UNTRUSTED_DATA)) { + if(This->ctx->safeopt & (INTERFACE_USES_SECURITY_MANAGER|INTERFACESAFE_FOR_UNTRUSTED_DATA)) { WARN("blocked in current safety mode\n"); return VB_E_CANNOT_CREATE_OBJ; } @@ -1737,7 +2057,7 @@ static HRESULT Global_GetObject(vbdisp_t *This, VARIANT *args, unsigned args_cnt if(FAILED(hres)) return hres; - hres = set_object_site(This->desc->ctx, obj_unk); + hres = set_object_site(This->ctx, obj_unk); if(FAILED(hres)) { IUnknown_Release(obj_unk); return hres; @@ -1758,25 +2078,25 @@ static HRESULT Global_GetObject(vbdisp_t *This, VARIANT *args, unsigned args_cnt return hres; } -static HRESULT Global_DateAdd(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) +static HRESULT Global_DateAdd(BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) { FIXME("\n"); return E_NOTIMPL; } -static HRESULT Global_DateDiff(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) +static HRESULT Global_DateDiff(BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) { FIXME("\n"); return E_NOTIMPL; } -static HRESULT Global_DatePart(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) +static HRESULT Global_DatePart(BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) { FIXME("\n"); return E_NOTIMPL; } -static HRESULT Global_TypeName(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) +static HRESULT Global_TypeName(BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) { static const WCHAR ByteW[] = {'B', 'y', 't', 'e', 0}; static const WCHAR IntegerW[] = {'I', 'n', 't', 'e', 'g', 'e', 'r', 0}; @@ -1826,7 +2146,7 @@ static HRESULT Global_TypeName(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, } } -static HRESULT Global_Array(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) +static HRESULT Global_Array(BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) { SAFEARRAYBOUND bounds; SAFEARRAY *sa; @@ -1868,37 +2188,37 @@ static HRESULT Global_Array(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VAR return S_OK; } -static HRESULT Global_Erase(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) +static HRESULT Global_Erase(BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) { FIXME("\n"); return E_NOTIMPL; } -static HRESULT Global_Filter(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) +static HRESULT Global_Filter(BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) { FIXME("\n"); return E_NOTIMPL; } -static HRESULT Global_Join(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) +static HRESULT Global_Join(BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) { FIXME("\n"); return E_NOTIMPL; } -static HRESULT Global_Split(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) +static HRESULT Global_Split(BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) { FIXME("\n"); return E_NOTIMPL; } -static HRESULT Global_Replace(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) +static HRESULT Global_Replace(BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) { FIXME("\n"); return E_NOTIMPL; } -static HRESULT Global_StrReverse(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) +static HRESULT Global_StrReverse(BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) { WCHAR *ptr1, *ptr2, ch; BSTR ret; @@ -1921,7 +2241,7 @@ static HRESULT Global_StrReverse(vbdisp_t *This, VARIANT *arg, unsigned args_cnt return return_bstr(res, ret); } -static HRESULT Global_InStrRev(vbdisp_t *This, VARIANT *args, unsigned args_cnt, VARIANT *res) +static HRESULT Global_InStrRev(BuiltinDisp *This, VARIANT *args, unsigned args_cnt, VARIANT *res) { int start, ret = 0; BSTR str1, str2; @@ -1981,13 +2301,13 @@ static HRESULT Global_InStrRev(vbdisp_t *This, VARIANT *args, unsigned args_cnt, return return_int(res, ret); } -static HRESULT Global_LoadPicture(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) +static HRESULT Global_LoadPicture(BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) { FIXME("\n"); return E_NOTIMPL; } -static HRESULT Global_ScriptEngine(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) +static HRESULT Global_ScriptEngine(BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) { TRACE("%s\n", debugstr_variant(arg)); @@ -1996,7 +2316,7 @@ static HRESULT Global_ScriptEngine(vbdisp_t *This, VARIANT *arg, unsigned args_c return return_string(res, vbscriptW); } -static HRESULT Global_ScriptEngineMajorVersion(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) +static HRESULT Global_ScriptEngineMajorVersion(BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) { TRACE("%s\n", debugstr_variant(arg)); @@ -2005,7 +2325,7 @@ static HRESULT Global_ScriptEngineMajorVersion(vbdisp_t *This, VARIANT *arg, uns return return_int(res, VBSCRIPT_MAJOR_VERSION); } -static HRESULT Global_ScriptEngineMinorVersion(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) +static HRESULT Global_ScriptEngineMinorVersion(BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) { TRACE("%s\n", debugstr_variant(arg)); @@ -2014,7 +2334,7 @@ static HRESULT Global_ScriptEngineMinorVersion(vbdisp_t *This, VARIANT *arg, uns return return_int(res, VBSCRIPT_MINOR_VERSION); } -static HRESULT Global_ScriptEngineBuildVersion(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) +static HRESULT Global_ScriptEngineBuildVersion(BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) { TRACE("%s\n", debugstr_variant(arg)); @@ -2023,31 +2343,31 @@ static HRESULT Global_ScriptEngineBuildVersion(vbdisp_t *This, VARIANT *arg, uns return return_int(res, VBSCRIPT_BUILD_VERSION); } -static HRESULT Global_FormatNumber(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) +static HRESULT Global_FormatNumber(BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) { FIXME("\n"); return E_NOTIMPL; } -static HRESULT Global_FormatCurrency(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) +static HRESULT Global_FormatCurrency(BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) { FIXME("\n"); return E_NOTIMPL; } -static HRESULT Global_FormatPercent(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) +static HRESULT Global_FormatPercent(BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) { FIXME("\n"); return E_NOTIMPL; } -static HRESULT Global_FormatDateTime(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) +static HRESULT Global_FormatDateTime(BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) { FIXME("\n"); return E_NOTIMPL; } -static HRESULT Global_WeekdayName(vbdisp_t *This, VARIANT *args, unsigned args_cnt, VARIANT *res) +static HRESULT Global_WeekdayName(BuiltinDisp *This, VARIANT *args, unsigned args_cnt, VARIANT *res) { int weekday, first_day = 1, abbrev = 0; BSTR ret; @@ -2080,7 +2400,7 @@ static HRESULT Global_WeekdayName(vbdisp_t *This, VARIANT *args, unsigned args_c return return_bstr(res, ret); } -static HRESULT Global_MonthName(vbdisp_t *This, VARIANT *args, unsigned args_cnt, VARIANT *res) +static HRESULT Global_MonthName(BuiltinDisp *This, VARIANT *args, unsigned args_cnt, VARIANT *res) { int month, abbrev = 0; BSTR ret; @@ -2107,7 +2427,7 @@ static HRESULT Global_MonthName(vbdisp_t *This, VARIANT *args, unsigned args_cnt return return_bstr(res, ret); } -static HRESULT Global_Round(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) +static HRESULT Global_Round(BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) { double n; HRESULT hres; @@ -2135,42 +2455,57 @@ static HRESULT Global_Round(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VAR return return_double(res, round(n)); } -static HRESULT Global_Escape(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) +static HRESULT Global_Escape(BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) { FIXME("\n"); return E_NOTIMPL; } -static HRESULT Global_Unescape(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) +static HRESULT Global_Unescape(BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) { FIXME("\n"); return E_NOTIMPL; } -static HRESULT Global_Eval(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) +static HRESULT Global_Eval(BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) { FIXME("\n"); return E_NOTIMPL; } -static HRESULT Global_Execute(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) +static HRESULT Global_Execute(BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) { FIXME("\n"); return E_NOTIMPL; } -static HRESULT Global_ExecuteGlobal(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) +static HRESULT Global_ExecuteGlobal(BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) { FIXME("\n"); return E_NOTIMPL; } -static HRESULT Global_GetRef(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) +static HRESULT Global_GetRef(BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) { FIXME("\n"); return E_NOTIMPL; } +static HRESULT Global_Err(BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) +{ + TRACE("\n"); + + if(args_cnt) { + FIXME("Setter not supported\n"); + return E_NOTIMPL; + } + + V_VT(res) = VT_DISPATCH; + V_DISPATCH(res) = &This->ctx->err_obj->IDispatch_iface; + IDispatch_AddRef(V_DISPATCH(res)); + return S_OK; +} + static const string_constant_t vbCr = {1, {'\r'}}; static const string_constant_t vbCrLf = {2, {'\r','\n'}}; static const string_constant_t vbNewLine = {2, {'\r','\n'}}; @@ -2182,296 +2517,363 @@ static const string_constant_t vbTab = {1, {'\t'}}; static const string_constant_t vbVerticalTab = {1, {0xb}}; static const builtin_prop_t global_props[] = { - {DISPID_GLOBAL_VBUSESYSTEM, NULL, BP_GET, VT_I2, 0}, - {DISPID_GLOBAL_USESYSTEMDAYOFWEEK, NULL, BP_GET, VT_I2, 0}, - {DISPID_GLOBAL_VBSUNDAY, NULL, BP_GET, VT_I2, 1}, - {DISPID_GLOBAL_VBMONDAY, NULL, BP_GET, VT_I2, 2}, - {DISPID_GLOBAL_VBTUESDAY, NULL, BP_GET, VT_I2, 3}, - {DISPID_GLOBAL_VBWEDNESDAY, NULL, BP_GET, VT_I2, 4}, - {DISPID_GLOBAL_VBTHURSDAY, NULL, BP_GET, VT_I2, 5}, - {DISPID_GLOBAL_VBFRIDAY, NULL, BP_GET, VT_I2, 6}, - {DISPID_GLOBAL_VBSATURDAY, NULL, BP_GET, VT_I2, 7}, - {DISPID_GLOBAL_VBFIRSTJAN1, NULL, BP_GET, VT_I2, 1}, - {DISPID_GLOBAL_VBFIRSTFOURDAYS, NULL, BP_GET, VT_I2, 2}, - {DISPID_GLOBAL_VBFIRSTFULLWEEK, NULL, BP_GET, VT_I2, 3}, - {DISPID_GLOBAL_VBOKONLY, NULL, BP_GET, VT_I2, MB_OK}, - {DISPID_GLOBAL_VBOKCANCEL, NULL, BP_GET, VT_I2, MB_OKCANCEL}, - {DISPID_GLOBAL_VBABORTRETRYIGNORE, NULL, BP_GET, VT_I2, MB_ABORTRETRYIGNORE}, - {DISPID_GLOBAL_VBYESNOCANCEL, NULL, BP_GET, VT_I2, MB_YESNOCANCEL}, - {DISPID_GLOBAL_VBYESNO, NULL, BP_GET, VT_I2, MB_YESNO}, - {DISPID_GLOBAL_VBRETRYCANCEL, NULL, BP_GET, VT_I2, MB_RETRYCANCEL}, - {DISPID_GLOBAL_VBCRITICAL, NULL, BP_GET, VT_I2, MB_ICONHAND}, - {DISPID_GLOBAL_VBQUESTION, NULL, BP_GET, VT_I2, MB_ICONQUESTION}, - {DISPID_GLOBAL_VBEXCLAMATION, NULL, BP_GET, VT_I2, MB_ICONEXCLAMATION}, - {DISPID_GLOBAL_VBINFORMATION, NULL, BP_GET, VT_I2, MB_ICONASTERISK}, - {DISPID_GLOBAL_VBDEFAULTBUTTON1, NULL, BP_GET, VT_I2, MB_DEFBUTTON1}, - {DISPID_GLOBAL_VBDEFAULTBUTTON2, NULL, BP_GET, VT_I2, MB_DEFBUTTON2}, - {DISPID_GLOBAL_VBDEFAULTBUTTON3, NULL, BP_GET, VT_I2, MB_DEFBUTTON3}, - {DISPID_GLOBAL_VBDEFAULTBUTTON4, NULL, BP_GET, VT_I2, MB_DEFBUTTON4}, - {DISPID_GLOBAL_VBAPPLICATIONMODAL, NULL, BP_GET, VT_I2, MB_APPLMODAL}, - {DISPID_GLOBAL_VBSYSTEMMODAL, NULL, BP_GET, VT_I2, MB_SYSTEMMODAL}, - {DISPID_GLOBAL_VBOK, NULL, BP_GET, VT_I2, IDOK}, - {DISPID_GLOBAL_VBCANCEL, NULL, BP_GET, VT_I2, IDCANCEL}, - {DISPID_GLOBAL_VBABORT, NULL, BP_GET, VT_I2, IDABORT}, - {DISPID_GLOBAL_VBRETRY, NULL, BP_GET, VT_I2, IDRETRY}, - {DISPID_GLOBAL_VBIGNORE, NULL, BP_GET, VT_I2, IDIGNORE}, - {DISPID_GLOBAL_VBYES, NULL, BP_GET, VT_I2, IDYES}, - {DISPID_GLOBAL_VBNO, NULL, BP_GET, VT_I2, IDNO}, - {DISPID_GLOBAL_VBEMPTY, NULL, BP_GET, VT_I2, VT_EMPTY}, - {DISPID_GLOBAL_VBNULL, NULL, BP_GET, VT_I2, VT_NULL}, - {DISPID_GLOBAL_VBINTEGER, NULL, BP_GET, VT_I2, VT_I2}, - {DISPID_GLOBAL_VBLONG, NULL, BP_GET, VT_I2, VT_I4}, - {DISPID_GLOBAL_VBSINGLE, NULL, BP_GET, VT_I2, VT_R4}, - {DISPID_GLOBAL_VBDOUBLE, NULL, BP_GET, VT_I2, VT_R8}, - {DISPID_GLOBAL_VBCURRENCY, NULL, BP_GET, VT_I2, VT_CY}, - {DISPID_GLOBAL_VBDATE, NULL, BP_GET, VT_I2, VT_DATE}, - {DISPID_GLOBAL_VBSTRING, NULL, BP_GET, VT_I2, VT_BSTR}, - {DISPID_GLOBAL_VBOBJECT, NULL, BP_GET, VT_I2, VT_DISPATCH}, - {DISPID_GLOBAL_VBERROR, NULL, BP_GET, VT_I2, VT_ERROR}, - {DISPID_GLOBAL_VBBOOLEAN, NULL, BP_GET, VT_I2, VT_BOOL}, - {DISPID_GLOBAL_VBVARIANT, NULL, BP_GET, VT_I2, VT_VARIANT}, - {DISPID_GLOBAL_VBDATAOBJECT, NULL, BP_GET, VT_I2, VT_UNKNOWN}, - {DISPID_GLOBAL_VBDECIMAL, NULL, BP_GET, VT_I2, VT_DECIMAL}, - {DISPID_GLOBAL_VBBYTE, NULL, BP_GET, VT_I2, VT_UI1}, - {DISPID_GLOBAL_VBARRAY, NULL, BP_GET, VT_I2, VT_ARRAY}, - {DISPID_GLOBAL_VBTRUE, NULL, BP_GET, VT_I2, VARIANT_TRUE}, - {DISPID_GLOBAL_VBFALSE, NULL, BP_GET, VT_I2, VARIANT_FALSE}, - {DISPID_GLOBAL_VBUSEDEFAULT, NULL, BP_GET, VT_I2, -2}, - {DISPID_GLOBAL_VBBINARYCOMPARE, NULL, BP_GET, VT_I2, 0}, - {DISPID_GLOBAL_VBTEXTCOMPARE, NULL, BP_GET, VT_I2, 1}, - {DISPID_GLOBAL_VBDATABASECOMPARE, NULL, BP_GET, VT_I2, 2}, - {DISPID_GLOBAL_VBGENERALDATE, NULL, BP_GET, VT_I2, 0}, - {DISPID_GLOBAL_VBLONGDATE, NULL, BP_GET, VT_I2, 1}, - {DISPID_GLOBAL_VBSHORTDATE, NULL, BP_GET, VT_I2, 2}, - {DISPID_GLOBAL_VBLONGTIME, NULL, BP_GET, VT_I2, 3}, - {DISPID_GLOBAL_VBSHORTTIME, NULL, BP_GET, VT_I2, 4}, - {DISPID_GLOBAL_VBOBJECTERROR, NULL, BP_GET, VT_I4, 0x80040000}, - {DISPID_GLOBAL_VBBLACK, NULL, BP_GET, VT_I4, 0x000000}, - {DISPID_GLOBAL_VBBLUE, NULL, BP_GET, VT_I4, 0xff0000}, - {DISPID_GLOBAL_VBCYAN, NULL, BP_GET, VT_I4, 0xffff00}, - {DISPID_GLOBAL_VBGREEN, NULL, BP_GET, VT_I4, 0x00ff00}, - {DISPID_GLOBAL_VBMAGENTA, NULL, BP_GET, VT_I4, 0xff00ff}, - {DISPID_GLOBAL_VBRED, NULL, BP_GET, VT_I4, 0x0000ff}, - {DISPID_GLOBAL_VBWHITE, NULL, BP_GET, VT_I4, 0xffffff}, - {DISPID_GLOBAL_VBYELLOW, NULL, BP_GET, VT_I4, 0x00ffff}, - {DISPID_GLOBAL_VBCR, NULL, BP_GET, VT_BSTR, (UINT_PTR)&vbCr}, - {DISPID_GLOBAL_VBCRLF, NULL, BP_GET, VT_BSTR, (UINT_PTR)&vbCrLf}, - {DISPID_GLOBAL_VBNEWLINE, NULL, BP_GET, VT_BSTR, (UINT_PTR)&vbNewLine}, - {DISPID_GLOBAL_VBFORMFEED, NULL, BP_GET, VT_BSTR, (UINT_PTR)&vbFormFeed}, - {DISPID_GLOBAL_VBLF, NULL, BP_GET, VT_BSTR, (UINT_PTR)&vbLf}, - {DISPID_GLOBAL_VBNULLCHAR, NULL, BP_GET, VT_BSTR, (UINT_PTR)&vbNullChar}, - {DISPID_GLOBAL_VBNULLSTRING, NULL, BP_GET, VT_BSTR, (UINT_PTR)&vbNullString}, - {DISPID_GLOBAL_VBTAB, NULL, BP_GET, VT_BSTR, (UINT_PTR)&vbTab}, - {DISPID_GLOBAL_VBVERTICALTAB, NULL, BP_GET, VT_BSTR, (UINT_PTR)&vbVerticalTab}, - {DISPID_GLOBAL_CCUR, Global_CCur, 0, 1}, - {DISPID_GLOBAL_CINT, Global_CInt, 0, 1}, - {DISPID_GLOBAL_CLNG, Global_CLng, 0, 1}, - {DISPID_GLOBAL_CBOOL, Global_CBool, 0, 1}, - {DISPID_GLOBAL_CBYTE, Global_CByte, 0, 1}, - {DISPID_GLOBAL_CDATE, Global_CDate, 0, 1}, - {DISPID_GLOBAL_CDBL, Global_CDbl, 0, 1}, - {DISPID_GLOBAL_CSNG, Global_CSng, 0, 1}, - {DISPID_GLOBAL_CSTR, Global_CStr, 0, 1}, - {DISPID_GLOBAL_HEX, Global_Hex, 0, 1}, - {DISPID_GLOBAL_OCT, Global_Oct, 0, 1}, - {DISPID_GLOBAL_VARTYPE, Global_VarType, 0, 1}, - {DISPID_GLOBAL_ISDATE, Global_IsDate, 0, 1}, - {DISPID_GLOBAL_ISEMPTY, Global_IsEmpty, 0, 1}, - {DISPID_GLOBAL_ISNULL, Global_IsNull, 0, 1}, - {DISPID_GLOBAL_ISNUMERIC, Global_IsNumeric, 0, 1}, - {DISPID_GLOBAL_ISARRAY, Global_IsArray, 0, 1}, - {DISPID_GLOBAL_ISOBJECT, Global_IsObject, 0, 1}, - {DISPID_GLOBAL_ATN, Global_Atn, 0, 1}, - {DISPID_GLOBAL_COS, Global_Cos, 0, 1}, - {DISPID_GLOBAL_SIN, Global_Sin, 0, 1}, - {DISPID_GLOBAL_TAN, Global_Tan, 0, 1}, - {DISPID_GLOBAL_EXP, Global_Exp, 0, 1}, - {DISPID_GLOBAL_LOG, Global_Log, 0, 1}, - {DISPID_GLOBAL_SQR, Global_Sqr, 0, 1}, - {DISPID_GLOBAL_RANDOMIZE, Global_Randomize, 0, 1}, - {DISPID_GLOBAL_RND, Global_Rnd, 0, 1}, - {DISPID_GLOBAL_TIMER, Global_Timer, 0, 0}, - {DISPID_GLOBAL_LBOUND, Global_LBound, 0, 1}, - {DISPID_GLOBAL_UBOUND, Global_UBound, 0, 1, 2}, - {DISPID_GLOBAL_RGB, Global_RGB, 0, 3}, - {DISPID_GLOBAL_LEN, Global_Len, 0, 1}, - {DISPID_GLOBAL_LENB, Global_LenB, 0, 1}, - {DISPID_GLOBAL_LEFT, Global_Left, 0, 2}, - {DISPID_GLOBAL_LEFTB, Global_LeftB, 0, 2}, - {DISPID_GLOBAL_RIGHT, Global_Right, 0, 2}, - {DISPID_GLOBAL_RIGHTB, Global_RightB, 0, 2}, - {DISPID_GLOBAL_MID, Global_Mid, 0, 2, 3}, - {DISPID_GLOBAL_MIDB, Global_MidB, 0, 2, 3}, - {DISPID_GLOBAL_STRCOMP, Global_StrComp, 0, 2, 3}, - {DISPID_GLOBAL_LCASE, Global_LCase, 0, 1}, - {DISPID_GLOBAL_UCASE, Global_UCase, 0, 1}, - {DISPID_GLOBAL_LTRIM, Global_LTrim, 0, 1}, - {DISPID_GLOBAL_RTRIM, Global_RTrim, 0, 1}, - {DISPID_GLOBAL_TRIM, Global_Trim, 0, 1}, - {DISPID_GLOBAL_SPACE, Global_Space, 0, 1}, - {DISPID_GLOBAL_STRING, Global_String, 0, 0, 2}, - {DISPID_GLOBAL_INSTR, Global_InStr, 0, 2, 4}, - {DISPID_GLOBAL_INSTRB, Global_InStrB, 0, 3, 4}, - {DISPID_GLOBAL_ASCB, Global_AscB, 0, 1}, - {DISPID_GLOBAL_CHRB, Global_ChrB, 0, 1}, - {DISPID_GLOBAL_ASC, Global_Asc, 0, 1}, - {DISPID_GLOBAL_CHR, Global_Chr, 0, 1}, - {DISPID_GLOBAL_ASCW, Global_AscW, 0, 1}, - {DISPID_GLOBAL_CHRW, Global_ChrW, 0, 1}, - {DISPID_GLOBAL_ABS, Global_Abs, 0, 1}, - {DISPID_GLOBAL_FIX, Global_Fix, 0, 1}, - {DISPID_GLOBAL_INT, Global_Int, 0, 1}, - {DISPID_GLOBAL_SGN, Global_Sgn, 0, 1}, - {DISPID_GLOBAL_NOW, Global_Now, 0, 0}, - {DISPID_GLOBAL_DATE, Global_Date, 0, 0}, - {DISPID_GLOBAL_TIME, Global_Time, 0, 0}, - {DISPID_GLOBAL_DAY, Global_Day, 0, 1}, - {DISPID_GLOBAL_MONTH, Global_Month, 0, 1}, - {DISPID_GLOBAL_WEEKDAY, Global_Weekday, 0, 1, 2}, - {DISPID_GLOBAL_YEAR, Global_Year, 0, 1}, - {DISPID_GLOBAL_HOUR, Global_Hour, 0, 1}, - {DISPID_GLOBAL_MINUTE, Global_Minute, 0, 1}, - {DISPID_GLOBAL_SECOND, Global_Second, 0, 1}, - {DISPID_GLOBAL_DATEVALUE, Global_DateValue, 0, 1}, - {DISPID_GLOBAL_TIMEVALUE, Global_TimeValue, 0, 1}, - {DISPID_GLOBAL_DATESERIAL, Global_DateSerial, 0, 3}, - {DISPID_GLOBAL_TIMESERIAL, Global_TimeSerial, 0, 3}, - {DISPID_GLOBAL_INPUTBOX, Global_InputBox, 0, 1, 7}, - {DISPID_GLOBAL_MSGBOX, Global_MsgBox, 0, 1, 5}, - {DISPID_GLOBAL_CREATEOBJECT, Global_CreateObject, 0, 1}, - {DISPID_GLOBAL_GETOBJECT, Global_GetObject, 0, 0, 2}, - {DISPID_GLOBAL_DATEADD, Global_DateAdd, 0, 3}, - {DISPID_GLOBAL_DATEDIFF, Global_DateDiff, 0, 3, 5}, - {DISPID_GLOBAL_DATEPART, Global_DatePart, 0, 2, 4}, - {DISPID_GLOBAL_TYPENAME, Global_TypeName, 0, 1}, - {DISPID_GLOBAL_ARRAY, Global_Array, 0, 0, MAXDWORD}, - {DISPID_GLOBAL_ERASE, Global_Erase, 0, 1}, - {DISPID_GLOBAL_FILTER, Global_Filter, 0, 2, 4}, - {DISPID_GLOBAL_JOIN, Global_Join, 0, 1, 2}, - {DISPID_GLOBAL_SPLIT, Global_Split, 0, 1, 4}, - {DISPID_GLOBAL_REPLACE, Global_Replace, 0, 3, 6}, - {DISPID_GLOBAL_STRREVERSE, Global_StrReverse, 0, 1}, - {DISPID_GLOBAL_INSTRREV, Global_InStrRev, 0, 2, 4}, - {DISPID_GLOBAL_LOADPICTURE, Global_LoadPicture, 0, 1}, - {DISPID_GLOBAL_SCRIPTENGINE, Global_ScriptEngine, 0, 0}, - {DISPID_GLOBAL_SCRIPTENGINEMAJORVERSION, Global_ScriptEngineMajorVersion, 0, 0}, - {DISPID_GLOBAL_SCRIPTENGINEMINORVERSION, Global_ScriptEngineMinorVersion, 0, 0}, - {DISPID_GLOBAL_SCRIPTENGINEBUILDVERSION, Global_ScriptEngineBuildVersion, 0, 0}, - {DISPID_GLOBAL_FORMATNUMBER, Global_FormatNumber, 0, 1, 5}, - {DISPID_GLOBAL_FORMATCURRENCY, Global_FormatCurrency, 0, 1, 5}, - {DISPID_GLOBAL_FORMATPERCENT, Global_FormatPercent, 0, 1, 5}, - {DISPID_GLOBAL_FORMATDATETIME, Global_FormatDateTime, 0, 1, 2}, - {DISPID_GLOBAL_WEEKDAYNAME, Global_WeekdayName, 0, 1, 3}, - {DISPID_GLOBAL_MONTHNAME, Global_MonthName, 0, 1, 2}, - {DISPID_GLOBAL_ROUND, Global_Round, 0, 1, 2}, - {DISPID_GLOBAL_ESCAPE, Global_Escape, 0, 1}, - {DISPID_GLOBAL_UNESCAPE, Global_Unescape, 0, 1}, - {DISPID_GLOBAL_EVAL, Global_Eval, 0, 1}, - {DISPID_GLOBAL_EXECUTE, Global_Execute, 0, 1}, - {DISPID_GLOBAL_EXECUTEGLOBAL, Global_ExecuteGlobal, 0, 1}, - {DISPID_GLOBAL_GETREF, Global_GetRef, 0, 1}, - {DISPID_GLOBAL_VBMSGBOXHELPBUTTON, NULL, BP_GET, VT_I4, MB_HELP}, - {DISPID_GLOBAL_VBMSGBOXSETFOREGROUND, NULL, BP_GET, VT_I4, MB_SETFOREGROUND}, - {DISPID_GLOBAL_VBMSGBOXRIGHT, NULL, BP_GET, VT_I4, MB_RIGHT}, - {DISPID_GLOBAL_VBMSGBOXRTLREADING, NULL, BP_GET, VT_I4, MB_RTLREADING} + {NULL}, /* no default value */ + {L"Abs", Global_Abs, 0, 1}, + {L"Array", Global_Array, 0, 0, MAXDWORD}, + {L"Asc", Global_Asc, 0, 1}, + {L"AscB", Global_AscB, 0, 1}, + {L"AscW", Global_AscW, 0, 1}, + {L"Atn", Global_Atn, 0, 1}, + {L"CBool", Global_CBool, 0, 1}, + {L"CByte", Global_CByte, 0, 1}, + {L"CCur", Global_CCur, 0, 1}, + {L"CDate", Global_CDate, 0, 1}, + {L"CDbl", Global_CDbl, 0, 1}, + {L"Chr", Global_Chr, 0, 1}, + {L"ChrB", Global_ChrB, 0, 1}, + {L"ChrW", Global_ChrW, 0, 1}, + {L"CInt", Global_CInt, 0, 1}, + {L"CLng", Global_CLng, 0, 1}, + {L"Cos", Global_Cos, 0, 1}, + {L"CreateObject", Global_CreateObject, 0, 1}, + {L"CSng", Global_CSng, 0, 1}, + {L"CStr", Global_CStr, 0, 1}, + {L"Date", Global_Date, 0, 0}, + {L"DateAdd", Global_DateAdd, 0, 3}, + {L"DateDiff", Global_DateDiff, 0, 3, 5}, + {L"DatePart", Global_DatePart, 0, 2, 4}, + {L"DateSerial", Global_DateSerial, 0, 3}, + {L"DateValue", Global_DateValue, 0, 1}, + {L"Day", Global_Day, 0, 1}, + {L"Erase", Global_Erase, 0, 1}, + {L"Err", Global_Err, BP_GETPUT}, + {L"Escape", Global_Escape, 0, 1}, + {L"Eval", Global_Eval, 0, 1}, + {L"Execute", Global_Execute, 0, 1}, + {L"ExecuteGlobal", Global_ExecuteGlobal, 0, 1}, + {L"Exp", Global_Exp, 0, 1}, + {L"Filter", Global_Filter, 0, 2, 4}, + {L"Fix", Global_Fix, 0, 1}, + {L"FormatCurrency", Global_FormatCurrency, 0, 1, 5}, + {L"FormatDateTime", Global_FormatDateTime, 0, 1, 2}, + {L"FormatNumber", Global_FormatNumber, 0, 1, 5}, + {L"FormatPercent", Global_FormatPercent, 0, 1, 5}, + {L"GetObject", Global_GetObject, 0, 0, 2}, + {L"GetRef", Global_GetRef, 0, 1}, + {L"Hex", Global_Hex, 0, 1}, + {L"Hour", Global_Hour, 0, 1}, + {L"InputBox", Global_InputBox, 0, 1, 7}, + {L"InStr", Global_InStr, 0, 2, 4}, + {L"InStrB", Global_InStrB, 0, 3, 4}, + {L"InStrRev", Global_InStrRev, 0, 2, 4}, + {L"Int", Global_Int, 0, 1}, + {L"IsArray", Global_IsArray, 0, 1}, + {L"IsDate", Global_IsDate, 0, 1}, + {L"IsEmpty", Global_IsEmpty, 0, 1}, + {L"IsNull", Global_IsNull, 0, 1}, + {L"IsNumeric", Global_IsNumeric, 0, 1}, + {L"IsObject", Global_IsObject, 0, 1}, + {L"Join", Global_Join, 0, 1, 2}, + {L"LBound", Global_LBound, 0, 1}, + {L"LCase", Global_LCase, 0, 1}, + {L"Left", Global_Left, 0, 2}, + {L"LeftB", Global_LeftB, 0, 2}, + {L"Len", Global_Len, 0, 1}, + {L"LenB", Global_LenB, 0, 1}, + {L"LoadPicture", Global_LoadPicture, 0, 1}, + {L"Log", Global_Log, 0, 1}, + {L"LTrim", Global_LTrim, 0, 1}, + {L"Mid", Global_Mid, 0, 2, 3}, + {L"MidB", Global_MidB, 0, 2, 3}, + {L"Minute", Global_Minute, 0, 1}, + {L"Month", Global_Month, 0, 1}, + {L"MonthName", Global_MonthName, 0, 1, 2}, + {L"MsgBox", Global_MsgBox, 0, 1, 5}, + {L"Now", Global_Now, 0, 0}, + {L"Oct", Global_Oct, 0, 1}, + {L"Randomize", Global_Randomize, 0, 1}, + {L"Replace", Global_Replace, 0, 3, 6}, + {L"RGB", Global_RGB, 0, 3}, + {L"Right", Global_Right, 0, 2}, + {L"RightB", Global_RightB, 0, 2}, + {L"Rnd", Global_Rnd, 0, 1}, + {L"Round", Global_Round, 0, 1, 2}, + {L"RTrim", Global_RTrim, 0, 1}, + {L"ScriptEngine", Global_ScriptEngine, 0, 0}, + {L"ScriptEngineBuildVersion", Global_ScriptEngineBuildVersion, 0, 0}, + {L"ScriptEngineMajorVersion", Global_ScriptEngineMajorVersion, 0, 0}, + {L"ScriptEngineMinorVersion", Global_ScriptEngineMinorVersion, 0, 0}, + {L"Second", Global_Second, 0, 1}, + {L"Sgn", Global_Sgn, 0, 1}, + {L"Sin", Global_Sin, 0, 1}, + {L"Space", Global_Space, 0, 1}, + {L"Split", Global_Split, 0, 1, 4}, + {L"Sqr", Global_Sqr, 0, 1}, + {L"StrComp", Global_StrComp, 0, 2, 3}, + {L"String", Global_String, 0, 0, 2}, + {L"StrReverse", Global_StrReverse, 0, 1}, + {L"Tan", Global_Tan, 0, 1}, + {L"Time", Global_Time, 0, 0}, + {L"Timer", Global_Timer, 0, 0}, + {L"TimeSerial", Global_TimeSerial, 0, 3}, + {L"TimeValue", Global_TimeValue, 0, 1}, + {L"Trim", Global_Trim, 0, 1}, + {L"TypeName", Global_TypeName, 0, 1}, + {L"UBound", Global_UBound, 0, 1, 2}, + {L"UCase", Global_UCase, 0, 1}, + {L"Unescape", Global_Unescape, 0, 1}, + {L"VarType", Global_VarType, 0, 1}, + {L"vbAbort", NULL, BP_GET, VT_I2, IDABORT}, + {L"vbAbortRetryIgnore", NULL, BP_GET, VT_I2, MB_ABORTRETRYIGNORE}, + {L"vbApplicationModal", NULL, BP_GET, VT_I2, MB_APPLMODAL}, + {L"vbArray", NULL, BP_GET, VT_I2, VT_ARRAY}, + {L"vbBinaryCompare", NULL, BP_GET, VT_I2, 0}, + {L"vbBlack", NULL, BP_GET, VT_I4, 0x000000}, + {L"vbBlue", NULL, BP_GET, VT_I4, 0xff0000}, + {L"vbBoolean", NULL, BP_GET, VT_I2, VT_BOOL}, + {L"vbByte", NULL, BP_GET, VT_I2, VT_UI1}, + {L"vbCancel", NULL, BP_GET, VT_I2, IDCANCEL}, + {L"vbCr", NULL, BP_GET, VT_BSTR, (UINT_PTR)&vbCr}, + {L"vbCritical", NULL, BP_GET, VT_I2, MB_ICONHAND}, + {L"vbCrLf", NULL, BP_GET, VT_BSTR, (UINT_PTR)&vbCrLf}, + {L"vbCurrency", NULL, BP_GET, VT_I2, VT_CY}, + {L"vbCyan", NULL, BP_GET, VT_I4, 0xffff00}, + {L"vbDatabaseCompare", NULL, BP_GET, VT_I2, 2}, + {L"vbDataObject", NULL, BP_GET, VT_I2, VT_UNKNOWN}, + {L"vbDate", NULL, BP_GET, VT_I2, VT_DATE}, + {L"vbDecimal", NULL, BP_GET, VT_I2, VT_DECIMAL}, + {L"vbDefaultButton1", NULL, BP_GET, VT_I2, MB_DEFBUTTON1}, + {L"vbDefaultButton2", NULL, BP_GET, VT_I2, MB_DEFBUTTON2}, + {L"vbDefaultButton3", NULL, BP_GET, VT_I2, MB_DEFBUTTON3}, + {L"vbDefaultButton4", NULL, BP_GET, VT_I2, MB_DEFBUTTON4}, + {L"vbDouble", NULL, BP_GET, VT_I2, VT_R8}, + {L"vbEmpty", NULL, BP_GET, VT_I2, VT_EMPTY}, + {L"vbError", NULL, BP_GET, VT_I2, VT_ERROR}, + {L"vbExclamation", NULL, BP_GET, VT_I2, MB_ICONEXCLAMATION}, + {L"vbFalse", NULL, BP_GET, VT_I2, VARIANT_FALSE}, + {L"vbFirstFourDays", NULL, BP_GET, VT_I2, 2}, + {L"vbFirstFullWeek", NULL, BP_GET, VT_I2, 3}, + {L"vbFirstJan1", NULL, BP_GET, VT_I2, 1}, + {L"vbFormFeed", NULL, BP_GET, VT_BSTR, (UINT_PTR)&vbFormFeed}, + {L"vbFriday", NULL, BP_GET, VT_I2, 6}, + {L"vbGeneralDate", NULL, BP_GET, VT_I2, 0}, + {L"vbGreen", NULL, BP_GET, VT_I4, 0x00ff00}, + {L"vbIgnore", NULL, BP_GET, VT_I2, IDIGNORE}, + {L"vbInformation", NULL, BP_GET, VT_I2, MB_ICONASTERISK}, + {L"vbInteger", NULL, BP_GET, VT_I2, VT_I2}, + {L"vbLf", NULL, BP_GET, VT_BSTR, (UINT_PTR)&vbLf}, + {L"vbLong", NULL, BP_GET, VT_I2, VT_I4}, + {L"vbLongDate", NULL, BP_GET, VT_I2, 1}, + {L"vbLongTime", NULL, BP_GET, VT_I2, 3}, + {L"vbMagenta", NULL, BP_GET, VT_I4, 0xff00ff}, + {L"vbMonday", NULL, BP_GET, VT_I2, 2}, + {L"vbMsgBoxHelpButton", NULL, BP_GET, VT_I4, MB_HELP}, + {L"vbMsgBoxRight", NULL, BP_GET, VT_I4, MB_RIGHT}, + {L"vbMsgBoxRtlReading", NULL, BP_GET, VT_I4, MB_RTLREADING}, + {L"vbMsgBoxSetForeground", NULL, BP_GET, VT_I4, MB_SETFOREGROUND}, + {L"vbNewLine", NULL, BP_GET, VT_BSTR, (UINT_PTR)&vbNewLine}, + {L"vbNo", NULL, BP_GET, VT_I2, IDNO}, + {L"vbNull", NULL, BP_GET, VT_I2, VT_NULL}, + {L"vbNullChar", NULL, BP_GET, VT_BSTR, (UINT_PTR)&vbNullChar}, + {L"vbNullString", NULL, BP_GET, VT_BSTR, (UINT_PTR)&vbNullString}, + {L"vbObject", NULL, BP_GET, VT_I2, VT_DISPATCH}, + {L"vbObjectError", NULL, BP_GET, VT_I4, 0x80040000}, + {L"vbOK", NULL, BP_GET, VT_I2, IDOK}, + {L"vbOKCancel", NULL, BP_GET, VT_I2, MB_OKCANCEL}, + {L"vbOKOnly", NULL, BP_GET, VT_I2, MB_OK}, + {L"vbQuestion", NULL, BP_GET, VT_I2, MB_ICONQUESTION}, + {L"vbRed", NULL, BP_GET, VT_I4, 0x0000ff}, + {L"vbRetry", NULL, BP_GET, VT_I2, IDRETRY}, + {L"vbRetryCancel", NULL, BP_GET, VT_I2, MB_RETRYCANCEL}, + {L"vbSaturday", NULL, BP_GET, VT_I2, 7}, + {L"vbShortDate", NULL, BP_GET, VT_I2, 2}, + {L"vbShortTime", NULL, BP_GET, VT_I2, 4}, + {L"vbSingle", NULL, BP_GET, VT_I2, VT_R4}, + {L"vbString", NULL, BP_GET, VT_I2, VT_BSTR}, + {L"vbSunday", NULL, BP_GET, VT_I2, 1}, + {L"vbSystemModal", NULL, BP_GET, VT_I2, MB_SYSTEMMODAL}, + {L"vbTab", NULL, BP_GET, VT_BSTR, (UINT_PTR)&vbTab}, + {L"vbTextCompare", NULL, BP_GET, VT_I2, 1}, + {L"vbThursday", NULL, BP_GET, VT_I2, 5}, + {L"vbTrue", NULL, BP_GET, VT_I2, VARIANT_TRUE}, + {L"vbTuesday", NULL, BP_GET, VT_I2, 3}, + {L"vbUseDefault", NULL, BP_GET, VT_I2, -2}, + {L"vbUseSystem", NULL, BP_GET, VT_I2, 0}, + {L"vbUseSystemDayOfWeek", NULL, BP_GET, VT_I2, 0}, + {L"vbVariant", NULL, BP_GET, VT_I2, VT_VARIANT}, + {L"vbVerticalTab", NULL, BP_GET, VT_BSTR, (UINT_PTR)&vbVerticalTab}, + {L"vbWednesday", NULL, BP_GET, VT_I2, 4}, + {L"vbWhite", NULL, BP_GET, VT_I4, 0xffffff}, + {L"vbYellow", NULL, BP_GET, VT_I4, 0x00ffff}, + {L"vbYes", NULL, BP_GET, VT_I2, IDYES}, + {L"vbYesNo", NULL, BP_GET, VT_I2, MB_YESNO}, + {L"vbYesNoCancel", NULL, BP_GET, VT_I2, MB_YESNOCANCEL}, + {L"Weekday", Global_Weekday, 0, 1, 2}, + {L"WeekdayName", Global_WeekdayName, 0, 1, 3}, + {L"Year", Global_Year, 0, 1} }; -static HRESULT Err_Description(vbdisp_t *This, VARIANT *args, unsigned args_cnt, VARIANT *res) -{ - FIXME("\n"); - return E_NOTIMPL; -} - -static HRESULT Err_HelpContext(vbdisp_t *This, VARIANT *args, unsigned args_cnt, VARIANT *res) -{ - FIXME("\n"); - return E_NOTIMPL; -} - -static HRESULT Err_HelpFile(vbdisp_t *This, VARIANT *args, unsigned args_cnt, VARIANT *res) -{ - FIXME("\n"); - return E_NOTIMPL; -} - -static HRESULT Err_Number(vbdisp_t *This, VARIANT *args, unsigned args_cnt, VARIANT *res) +static HRESULT err_string_prop(BSTR *prop, VARIANT *args, unsigned args_cnt, VARIANT *res) { + BSTR str; HRESULT hres; - TRACE("\n"); + if(!args_cnt) + return return_string(res, *prop ? *prop : L""); - if(!This->desc) - return E_UNEXPECTED; + hres = to_string(args, &str); + if(FAILED(hres)) + return hres; + + SysFreeString(*prop); + *prop = str; + return S_OK; +} + +static HRESULT Err_Description(BuiltinDisp *This, VARIANT *args, unsigned args_cnt, VARIANT *res) +{ + TRACE("\n"); + return err_string_prop(&This->ctx->ei.bstrDescription, args, args_cnt, res); +} + +static HRESULT Err_HelpContext(BuiltinDisp *This, VARIANT *args, unsigned args_cnt, VARIANT *res) +{ + TRACE("\n"); if(args_cnt) { FIXME("setter not implemented\n"); return E_NOTIMPL; } - hres = This->desc->ctx->err_number; + return return_int(res, This->ctx->ei.dwHelpContext); +} + +static HRESULT Err_HelpFile(BuiltinDisp *This, VARIANT *args, unsigned args_cnt, VARIANT *res) +{ + TRACE("\n"); + return err_string_prop(&This->ctx->ei.bstrHelpFile, args, args_cnt, res); +} + +static HRESULT Err_Number(BuiltinDisp *This, VARIANT *args, unsigned args_cnt, VARIANT *res) +{ + HRESULT hres; + + TRACE("\n"); + + if(args_cnt) { + FIXME("setter not implemented\n"); + return E_NOTIMPL; + } + + hres = This->ctx->ei.scode; return return_int(res, HRESULT_FACILITY(hres) == FACILITY_VBS ? HRESULT_CODE(hres) : hres); } -static HRESULT Err_Source(vbdisp_t *This, VARIANT *args, unsigned args_cnt, VARIANT *res) +static HRESULT Err_Source(BuiltinDisp *This, VARIANT *args, unsigned args_cnt, VARIANT *res) { - FIXME("\n"); - return E_NOTIMPL; + TRACE("\n"); + return err_string_prop(&This->ctx->ei.bstrSource, args, args_cnt, res); } -static HRESULT Err_Clear(vbdisp_t *This, VARIANT *args, unsigned args_cnt, VARIANT *res) +static HRESULT Err_Clear(BuiltinDisp *This, VARIANT *args, unsigned args_cnt, VARIANT *res) { TRACE("\n"); - if(!This->desc) - return E_UNEXPECTED; - - This->desc->ctx->err_number = S_OK; + clear_ei(&This->ctx->ei); return S_OK; } -static HRESULT Err_Raise(vbdisp_t *This, VARIANT *args, unsigned args_cnt, VARIANT *res) +static HRESULT Err_Raise(BuiltinDisp *This, VARIANT *args, unsigned args_cnt, VARIANT *res) { - FIXME("\n"); - return E_NOTIMPL; + BSTR source = NULL, description = NULL, helpfile = NULL; + int code, helpcontext = 0; + HRESULT hres, error; + + TRACE("%s %u...\n", debugstr_variant(args), args_cnt); + + hres = to_int(args, &code); + if(FAILED(hres)) + return hres; + if(code > 0 && code > 0xffff) + return E_INVALIDARG; + + if(args_cnt >= 2) + hres = to_string(args + 1, &source); + if(args_cnt >= 3 && SUCCEEDED(hres)) + hres = to_string(args + 2, &description); + if(args_cnt >= 4 && SUCCEEDED(hres)) + hres = to_string(args + 3, &helpfile); + if(args_cnt >= 5 && SUCCEEDED(hres)) + hres = to_int(args + 4, &helpcontext); + + if(SUCCEEDED(hres)) { + script_ctx_t *ctx = This->ctx; + + error = (code & ~0xffff) ? map_hres(code) : MAKE_VBSERROR(code); + + if(source) { + if(ctx->ei.bstrSource) SysFreeString(ctx->ei.bstrSource); + ctx->ei.bstrSource = source; + } + if(!ctx->ei.bstrSource) + ctx->ei.bstrSource = get_vbscript_string(VBS_RUNTIME_ERROR); + if(description) { + if(ctx->ei.bstrDescription) SysFreeString(ctx->ei.bstrDescription); + ctx->ei.bstrDescription = description; + } + if(!ctx->ei.bstrDescription) + ctx->ei.bstrDescription = get_vbscript_error_string(error); + if(helpfile) { + if(ctx->ei.bstrHelpFile) SysFreeString(ctx->ei.bstrHelpFile); + ctx->ei.bstrHelpFile = helpfile; + } + if(args_cnt >= 5) + ctx->ei.dwHelpContext = helpcontext; + + ctx->ei.scode = error; + hres = SCRIPT_E_RECORDED; + }else { + SysFreeString(source); + SysFreeString(description); + SysFreeString(helpfile); + } + + return hres; } static const builtin_prop_t err_props[] = { - {DISPID_ERR_DESCRIPTION, Err_Description, BP_GETPUT}, - {DISPID_ERR_HELPCONTEXT, Err_HelpContext, BP_GETPUT}, - {DISPID_ERR_HELPFILE, Err_HelpFile, BP_GETPUT}, - {DISPID_ERR_NUMBER, Err_Number, BP_GETPUT}, - {DISPID_ERR_SOURCE, Err_Source, BP_GETPUT}, - {DISPID_ERR_CLEAR, Err_Clear}, - {DISPID_ERR_RAISE, Err_Raise, 0, 5}, + {NULL, Err_Number, BP_GETPUT}, + {L"Clear", Err_Clear}, + {L"Description", Err_Description, BP_GETPUT}, + {L"HelpContext", Err_HelpContext, BP_GETPUT}, + {L"HelpFile", Err_HelpFile, BP_GETPUT}, + {L"Number", Err_Number, BP_GETPUT}, + {L"Raise", Err_Raise, 0, 1, 5}, + {L"Source", Err_Source, BP_GETPUT} }; +void detach_global_objects(script_ctx_t *ctx) +{ + if(ctx->err_obj) { + ctx->err_obj->ctx = NULL; + IDispatch_Release(&ctx->err_obj->IDispatch_iface); + ctx->err_obj = NULL; + } + + if(ctx->global_obj) { + ctx->global_obj->ctx = NULL; + IDispatch_Release(&ctx->global_obj->IDispatch_iface); + ctx->global_obj = NULL; + } +} + HRESULT init_global(script_ctx_t *ctx) { HRESULT hres; - ctx->global_desc.ctx = ctx; - ctx->global_desc.builtin_prop_cnt = ARRAY_SIZE(global_props); - ctx->global_desc.builtin_props = global_props; - - hres = get_typeinfo(GlobalObj_tid, &ctx->global_desc.typeinfo); + hres = create_builtin_dispatch(ctx, global_props, ARRAY_SIZE(global_props), &ctx->global_obj); if(FAILED(hres)) return hres; - hres = create_vbdisp(&ctx->global_desc, &ctx->global_obj); - if(FAILED(hres)) - return hres; - - hres = create_script_disp(ctx, &ctx->script_obj); - if(FAILED(hres)) - return hres; - - ctx->err_desc.ctx = ctx; - ctx->err_desc.builtin_prop_cnt = ARRAY_SIZE(err_props); - ctx->err_desc.builtin_props = err_props; - - hres = get_typeinfo(ErrObj_tid, &ctx->err_desc.typeinfo); - if(FAILED(hres)) - return hres; - - return create_vbdisp(&ctx->err_desc, &ctx->err_obj); + return create_builtin_dispatch(ctx, err_props, ARRAY_SIZE(err_props), &ctx->err_obj); } diff --git a/dll/win32/vbscript/interp.c b/dll/win32/vbscript/interp.c index b46bd01c0fc..80ecc416998 100644 --- a/dll/win32/vbscript/interp.c +++ b/dll/win32/vbscript/interp.c @@ -83,7 +83,7 @@ typedef struct { static BOOL lookup_dynamic_vars(dynamic_var_t *var, const WCHAR *name, ref_t *ref) { while(var) { - if(!strcmpiW(var->name, name)) { + if(!wcsicmp(var->name, name)) { ref->type = var->is_const ? REF_CONST : REF_VAR; ref->u.v = &var->v; return TRUE; @@ -104,18 +104,16 @@ static HRESULT lookup_identifier(exec_ctx_t *ctx, BSTR name, vbdisp_invoke_type_ DISPID id; HRESULT hres; - static const WCHAR errW[] = {'e','r','r',0}; - if(invoke_type == VBDISP_LET && (ctx->func->type == FUNC_FUNCTION || ctx->func->type == FUNC_PROPGET || ctx->func->type == FUNC_DEFGET) - && !strcmpiW(name, ctx->func->name)) { + && !wcsicmp(name, ctx->func->name)) { ref->type = REF_VAR; ref->u.v = &ctx->ret_val; return S_OK; } for(i=0; i < ctx->func->var_cnt; i++) { - if(!strcmpiW(ctx->func->vars[i].name, name)) { + if(!wcsicmp(ctx->func->vars[i].name, name)) { ref->type = REF_VAR; ref->u.v = ctx->vars+i; return TRUE; @@ -123,7 +121,7 @@ static HRESULT lookup_identifier(exec_ctx_t *ctx, BSTR name, vbdisp_invoke_type_ } for(i=0; i < ctx->func->arg_cnt; i++) { - if(!strcmpiW(ctx->func->args[i].name, name)) { + if(!wcsicmp(ctx->func->args[i].name, name)) { ref->type = REF_VAR; ref->u.v = ctx->args+i; return S_OK; @@ -137,7 +135,7 @@ static HRESULT lookup_identifier(exec_ctx_t *ctx, BSTR name, vbdisp_invoke_type_ if(ctx->vbthis) { /* FIXME: Bind such identifier while generating bytecode. */ for(i=0; i < ctx->vbthis->desc->prop_cnt; i++) { - if(!strcmpiW(ctx->vbthis->desc->props[i].name, name)) { + if(!wcsicmp(ctx->vbthis->desc->props[i].name, name)) { ref->type = REF_VAR; ref->u.v = ctx->vbthis->props+i; return S_OK; @@ -168,23 +166,17 @@ static HRESULT lookup_identifier(exec_ctx_t *ctx, BSTR name, vbdisp_invoke_type_ return S_OK; for(func = ctx->script->global_funcs; func; func = func->next) { - if(!strcmpiW(func->name, name)) { + if(!wcsicmp(func->name, name)) { ref->type = REF_FUNC; ref->u.f = func; return S_OK; } } - if(!strcmpiW(name, errW)) { - ref->type = REF_OBJ; - ref->u.obj = (IDispatch*)&ctx->script->err_obj->IDispatchEx_iface; - return S_OK; - } - - hres = vbdisp_get_id(ctx->script->global_obj, name, invoke_type, TRUE, &id); + hres = get_builtin_id(ctx->script->global_obj, name, &id); if(SUCCEEDED(hres)) { ref->type = REF_DISP; - ref->u.d.disp = (IDispatch*)&ctx->script->global_obj->IDispatchEx_iface; + ref->u.d.disp = &ctx->script->global_obj->IDispatch_iface; ref->u.d.id = id; return S_OK; } @@ -226,7 +218,7 @@ static HRESULT add_dynamic_var(exec_ctx_t *ctx, const WCHAR *name, if(!new_var) return E_OUTOFMEMORY; - size = (strlenW(name)+1)*sizeof(WCHAR); + size = (lstrlenW(name)+1)*sizeof(WCHAR); str = heap_pool_alloc(heap, size); if(!str) return E_OUTOFMEMORY; @@ -247,6 +239,14 @@ static HRESULT add_dynamic_var(exec_ctx_t *ctx, const WCHAR *name, return S_OK; } +void clear_ei(EXCEPINFO *ei) +{ + SysFreeString(ei->bstrSource); + SysFreeString(ei->bstrDescription); + SysFreeString(ei->bstrHelpFile); + memset(ei, 0, sizeof(*ei)); +} + static inline VARIANT *stack_pop(exec_ctx_t *ctx) { assert(ctx->top); @@ -319,7 +319,7 @@ static HRESULT stack_pop_val(exec_ctx_t *ctx, variant_val_t *r) HRESULT hres; hres = get_disp_value(ctx->script, V_DISPATCH(r->v), &r->store); - if(r->owned) + if(r->owned && V_DISPATCH(r->v)) IDispatch_Release(V_DISPATCH(r->v)); if(FAILED(hres)) return hres; @@ -350,7 +350,8 @@ static HRESULT stack_assume_val(exec_ctx_t *ctx, unsigned n) disp = V_DISPATCH(v); hres = get_disp_value(ctx->script, disp, v); - IDispatch_Release(disp); + if(disp) + IDispatch_Release(disp); if(FAILED(hres)) return hres; } @@ -580,7 +581,7 @@ static HRESULT do_icall(exec_ctx_t *ctx, VARIANT *res) break; case REF_FUNC: vbstack_to_dp(ctx, arg_cnt, FALSE, &dp); - hres = exec_script(ctx->script, ref.u.f, NULL, &dp, res); + hres = exec_script(ctx->script, FALSE, ref.u.f, NULL, &dp, res); if(FAILED(hres)) return hres; break; @@ -688,23 +689,27 @@ static HRESULT interp_mcallv(exec_ctx_t *ctx) static HRESULT assign_value(exec_ctx_t *ctx, VARIANT *dst, VARIANT *src, WORD flags) { + VARIANT value; HRESULT hres; - hres = VariantCopyInd(dst, src); + V_VT(&value) = VT_EMPTY; + hres = VariantCopyInd(&value, src); if(FAILED(hres)) return hres; - if(V_VT(dst) == VT_DISPATCH && !(flags & DISPATCH_PROPERTYPUTREF)) { - VARIANT value; + if(V_VT(&value) == VT_DISPATCH && !(flags & DISPATCH_PROPERTYPUTREF)) { + IDispatch *disp = V_DISPATCH(&value); - hres = get_disp_value(ctx->script, V_DISPATCH(dst), &value); - IDispatch_Release(V_DISPATCH(dst)); + V_VT(&value) = VT_EMPTY; + hres = get_disp_value(ctx->script, disp, &value); + if(disp) + IDispatch_Release(disp); if(FAILED(hres)) return hres; - - *dst = value; } + VariantClear(dst); + *dst = value; return S_OK; } @@ -988,7 +993,7 @@ static HRESULT interp_new(exec_ctx_t *ctx) TRACE("%s\n", debugstr_w(arg)); - if(!strcmpiW(arg, regexpW)) { + if(!wcsicmp(arg, regexpW)) { V_VT(&v) = VT_DISPATCH; hres = create_regexp(&V_DISPATCH(&v)); if(FAILED(hres)) @@ -998,7 +1003,7 @@ static HRESULT interp_new(exec_ctx_t *ctx) } for(class_desc = ctx->script->classes; class_desc; class_desc = class_desc->next) { - if(!strcmpiW(class_desc->name, arg)) + if(!wcsicmp(class_desc->name, arg)) break; } if(!class_desc) { @@ -1258,6 +1263,30 @@ static HRESULT interp_ret(exec_ctx_t *ctx) return S_OK; } +static HRESULT interp_retval(exec_ctx_t *ctx) +{ + variant_val_t val; + HRESULT hres; + + TRACE("\n"); + + hres = stack_pop_val(ctx, &val); + if(FAILED(hres)) + return hres; + + if(val.owned) { + VariantClear(&ctx->ret_val); + ctx->ret_val = *val.v; + } + else { + hres = VariantCopy(&ctx->ret_val, val.v); + if(FAILED(hres)) + return hres; + } + + return S_OK; +} + static HRESULT interp_stop(exec_ctx_t *ctx) { WARN("\n"); @@ -1297,7 +1326,7 @@ static HRESULT interp_errmode(exec_ctx_t *ctx) TRACE("%d\n", err_mode); ctx->resume_next = err_mode; - ctx->script->err_number = S_OK; + clear_ei(&ctx->script->ei); return S_OK; } @@ -1315,27 +1344,20 @@ static HRESULT interp_string(exec_ctx_t *ctx) return stack_push(ctx, &v); } -static HRESULT interp_long(exec_ctx_t *ctx) +static HRESULT interp_int(exec_ctx_t *ctx) { const LONG arg = ctx->instr->arg1.lng; VARIANT v; TRACE("%d\n", arg); - V_VT(&v) = VT_I4; - V_I4(&v) = arg; - return stack_push(ctx, &v); -} - -static HRESULT interp_short(exec_ctx_t *ctx) -{ - const LONG arg = ctx->instr->arg1.lng; - VARIANT v; - - TRACE("%d\n", arg); - - V_VT(&v) = VT_I2; - V_I2(&v) = arg; + if(arg == (INT16)arg) { + V_VT(&v) = VT_I2; + V_I2(&v) = arg; + }else { + V_VT(&v) = VT_I4; + V_I4(&v) = arg; + } return stack_push(ctx, &v); } @@ -2061,7 +2083,7 @@ static void release_exec(exec_ctx_t *ctx) heap_free(ctx->stack); } -HRESULT exec_script(script_ctx_t *ctx, function_t *func, vbdisp_t *vbthis, DISPPARAMS *dp, VARIANT *res) +HRESULT exec_script(script_ctx_t *ctx, BOOL extern_caller, function_t *func, vbdisp_t *vbthis, DISPPARAMS *dp, VARIANT *res) { exec_ctx_t exec = {func->code_ctx}; vbsop_t op; @@ -2123,6 +2145,9 @@ HRESULT exec_script(script_ctx_t *ctx, function_t *func, vbdisp_t *vbthis, DISPP return E_OUTOFMEMORY; } + if(extern_caller) + IActiveScriptSite_OnEnterScript(ctx->site); + if(vbthis) { exec.this_obj = (IDispatch*)&vbthis->IDispatchEx_iface; exec.vbthis = vbthis; @@ -2141,7 +2166,15 @@ HRESULT exec_script(script_ctx_t *ctx, function_t *func, vbdisp_t *vbthis, DISPP op = exec.instr->op; hres = op_funcs[op](&exec); if(FAILED(hres)) { - ctx->err_number = hres = map_hres(hres); + if(hres != SCRIPT_E_RECORDED) { + clear_ei(&ctx->ei); + + ctx->ei.scode = hres = map_hres(hres); + ctx->ei.bstrSource = get_vbscript_string(VBS_RUNTIME_ERROR); + ctx->ei.bstrDescription = get_vbscript_error_string(hres); + }else { + hres = ctx->ei.scode; + } if(exec.resume_next) { unsigned stack_off; @@ -2186,8 +2219,15 @@ HRESULT exec_script(script_ctx_t *ctx, function_t *func, vbdisp_t *vbthis, DISPP } assert(!exec.top); - if(func->type != FUNC_FUNCTION && func->type != FUNC_PROPGET && func->type != FUNC_DEFGET) - assert(V_VT(&exec.ret_val) == VT_EMPTY); + + if(extern_caller) { + IActiveScriptSite_OnLeaveScript(ctx->site); + if(FAILED(hres)) { + if(!ctx->ei.scode) + ctx->ei.scode = hres; + hres = report_script_error(ctx); + } + } if(SUCCEEDED(hres) && res) { *res = exec.ret_val; diff --git a/dll/win32/vbscript/lex.c b/dll/win32/vbscript/lex.c index 571854db58e..26b3d45a727 100644 --- a/dll/win32/vbscript/lex.c +++ b/dll/win32/vbscript/lex.c @@ -16,11 +16,13 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ -#include "config.h" -#include "wine/port.h" - +#ifdef __REACTOS__ +#include +#include +#endif #include #include +#include #include "vbscript.h" #include "parse.h" @@ -153,17 +155,17 @@ static const struct { static inline BOOL is_identifier_char(WCHAR c) { - return isalnumW(c) || c == '_'; + return iswalnum(c) || c == '_'; } -static int check_keyword(parser_ctx_t *ctx, const WCHAR *word) +static int check_keyword(parser_ctx_t *ctx, const WCHAR *word, const WCHAR **lval) { const WCHAR *p1 = ctx->ptr; const WCHAR *p2 = word; WCHAR c; while(p1 < ctx->end && *p2) { - c = tolowerW(*p1); + c = towlower(*p1); if(c != *p2) return c - *p2; p1++; @@ -174,17 +176,18 @@ static int check_keyword(parser_ctx_t *ctx, const WCHAR *word) return 1; ctx->ptr = p1; + *lval = word; return 0; } -static int check_keywords(parser_ctx_t *ctx) +static int check_keywords(parser_ctx_t *ctx, const WCHAR **lval) { int min = 0, max = ARRAY_SIZE(keywords)-1, r, i; while(min <= max) { i = (min+max)/2; - r = check_keyword(ctx, keywords[i].word); + r = check_keyword(ctx, keywords[i].word, lval); if(!r) return keywords[i].token; @@ -224,7 +227,7 @@ static int parse_string_literal(parser_ctx_t *ctx, const WCHAR **ret) int len = 0; while(ctx->ptr < ctx->end) { - if(*ctx->ptr == '\n') { + if(*ctx->ptr == '\n' || *ctx->ptr == '\r') { FIXME("newline inside string literal\n"); return 0; } @@ -270,7 +273,7 @@ static int parse_numeric_literal(parser_ctx_t *ctx, void **ret) if(*ctx->ptr == '0' && !('0' <= ctx->ptr[1] && ctx->ptr[1] <= '9') && ctx->ptr[1] != '.') return *ctx->ptr++; - while(ctx->ptr < ctx->end && isdigitW(*ctx->ptr)) { + while(ctx->ptr < ctx->end && iswdigit(*ctx->ptr)) { hlp = d*10 + *(ctx->ptr++) - '0'; if(d>MAXLONGLONG/10 || hlp<0) { exp++; @@ -279,7 +282,7 @@ static int parse_numeric_literal(parser_ctx_t *ctx, void **ret) else d = hlp; } - while(ctx->ptr < ctx->end && isdigitW(*ctx->ptr)) { + while(ctx->ptr < ctx->end && iswdigit(*ctx->ptr)) { exp++; ctx->ptr++; } @@ -288,7 +291,7 @@ static int parse_numeric_literal(parser_ctx_t *ctx, void **ret) use_int = FALSE; ctx->ptr++; - while(ctx->ptr < ctx->end && isdigitW(*ctx->ptr)) { + while(ctx->ptr < ctx->end && iswdigit(*ctx->ptr)) { hlp = d*10 + *(ctx->ptr++) - '0'; if(d>MAXLONGLONG/10 || hlp<0) break; @@ -296,19 +299,22 @@ static int parse_numeric_literal(parser_ctx_t *ctx, void **ret) d = hlp; exp--; } - while(ctx->ptr < ctx->end && isdigitW(*ctx->ptr)) + while(ctx->ptr < ctx->end && iswdigit(*ctx->ptr)) ctx->ptr++; } if(*ctx->ptr == 'e' || *ctx->ptr == 'E') { int e = 0, sign = 1; - if(*++ctx->ptr == '-') { + ctx->ptr++; + if(*ctx->ptr == '-') { ctx->ptr++; sign = -1; + }else if(*ctx->ptr == '+') { + ctx->ptr++; } - if(!isdigitW(*ctx->ptr)) { + if(!iswdigit(*ctx->ptr)) { FIXME("Invalid numeric literal\n"); return 0; } @@ -319,7 +325,7 @@ static int parse_numeric_literal(parser_ctx_t *ctx, void **ret) e = e*10 + *(ctx->ptr++) - '0'; if(sign == -1 && -e+exp < -(INT_MAX/100)) { /* The literal will be rounded to 0 anyway. */ - while(isdigitW(*ctx->ptr)) + while(iswdigit(*ctx->ptr)) ctx->ptr++; *(double*)ret = 0; return tDouble; @@ -329,15 +335,14 @@ static int parse_numeric_literal(parser_ctx_t *ctx, void **ret) FIXME("Invalid numeric literal\n"); return 0; } - } while(isdigitW(*ctx->ptr)); + } while(iswdigit(*ctx->ptr)); exp += sign*e; } if(use_int && (LONG)d == d) { - LONG l = d; - *(LONG*)ret = l; - return (short)l == l ? tShort : tLong; + *(LONG*)ret = d; + return tInt; } r = exp>=0 ? d*pow(10, exp) : d/pow(10, -exp); @@ -378,7 +383,7 @@ static int parse_hex_literal(parser_ctx_t *ctx, LONG *ret) ctx->ptr++; *ret = l; - return (short)l == l ? tShort : tLong; + return tInt; } static void skip_spaces(parser_ctx_t *ctx) @@ -390,7 +395,7 @@ static void skip_spaces(parser_ctx_t *ctx) static int comment_line(parser_ctx_t *ctx) { static const WCHAR newlineW[] = {'\n','\r',0}; - ctx->ptr = strpbrkW(ctx->ptr, newlineW); + ctx->ptr = wcspbrk(ctx->ptr, newlineW); if(ctx->ptr) ctx->ptr++; else @@ -411,8 +416,8 @@ static int parse_next_token(void *lval, parser_ctx_t *ctx) if('0' <= c && c <= '9') return parse_numeric_literal(ctx, lval); - if(isalphaW(c)) { - int ret = check_keywords(ctx); + if(iswalpha(c)) { + int ret = check_keywords(ctx, lval); if(!ret) return parse_identifier(ctx, lval); if(ret != tREM) @@ -492,15 +497,24 @@ int parser_lex(void *lval, parser_ctx_t *ctx) { int ret; + if (ctx->last_token == tEXPRESSION) + { + ctx->last_token = tNL; + return tEXPRESSION; + } + while(1) { ret = parse_next_token(lval, ctx); if(ret == '_') { skip_spaces(ctx); - if(*ctx->ptr != '\n') { + if(*ctx->ptr != '\n' && *ctx->ptr != '\r') { FIXME("'_' not followed by newline\n"); return 0; } - ctx->ptr++; + if(*ctx->ptr == '\r') + ctx->ptr++; + if(*ctx->ptr == '\n') + ctx->ptr++; continue; } if(ret != tNL || ctx->last_token != tNL) diff --git a/dll/win32/vbscript/parse.h b/dll/win32/vbscript/parse.h index 1fc2650748e..6e5188c8c5e 100644 --- a/dll/win32/vbscript/parse.h +++ b/dll/win32/vbscript/parse.h @@ -34,6 +34,7 @@ typedef enum { EXPR_GTEQ, EXPR_IDIV, EXPR_IMP, + EXPR_INT, EXPR_IS, EXPR_LT, EXPR_LTEQ, @@ -51,8 +52,6 @@ typedef enum { EXPR_OR, EXPR_STRING, EXPR_SUB, - EXPR_ULONG, - EXPR_USHORT, EXPR_XOR } expression_type_t; @@ -121,7 +120,8 @@ typedef enum { STAT_STOP, STAT_UNTIL, STAT_WHILE, - STAT_WHILELOOP + STAT_WHILELOOP, + STAT_RETVAL } statement_type_t; typedef struct _statement_t { @@ -251,6 +251,11 @@ typedef struct { case_clausule_t *case_clausules; } select_statement_t; +typedef struct { + statement_t stat; + expression_t *expr; +} retval_statement_t; + typedef struct { const WCHAR *code; const WCHAR *ptr; @@ -271,7 +276,7 @@ typedef struct { heap_pool_t heap; } parser_ctx_t; -HRESULT parse_script(parser_ctx_t*,const WCHAR*,const WCHAR*) DECLSPEC_HIDDEN; +HRESULT parse_script(parser_ctx_t*,const WCHAR*,const WCHAR*,DWORD) DECLSPEC_HIDDEN; void parser_release(parser_ctx_t*) DECLSPEC_HIDDEN; int parser_lex(void*,parser_ctx_t*) DECLSPEC_HIDDEN; void *parser_alloc(parser_ctx_t*,size_t) DECLSPEC_HIDDEN; diff --git a/dll/win32/vbscript/parser.tab.c b/dll/win32/vbscript/parser.tab.c index af2c0448591..cc702c598a9 100644 --- a/dll/win32/vbscript/parser.tab.c +++ b/dll/win32/vbscript/parser.tab.c @@ -1,8 +1,9 @@ -/* A Bison parser, made by GNU Bison 3.0. */ +/* A Bison parser, made by GNU Bison 3.4.1. */ /* Bison implementation for Yacc-like parsers in C - Copyright (C) 1984, 1989-1990, 2000-2013 Free Software Foundation, Inc. + Copyright (C) 1984, 1989-1990, 2000-2015, 2018-2019 Free Software Foundation, + Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -40,11 +41,14 @@ define necessary library symbols; they are noted "INFRINGES ON USER NAME SPACE" below. */ +/* Undocumented macros, especially those whose name start with YY_, + are private implementation details. Do not rely on them. */ + /* Identify Bison output. */ #define YYBISON 1 /* Bison version. */ -#define YYBISON_VERSION "3.0" +#define YYBISON_VERSION "3.4.1" /* Skeleton name. */ #define YYSKELETON_NAME "yacc.c" @@ -67,8 +71,8 @@ #define yynerrs parser_nerrs -/* Copy the first part of user declarations. */ -#line 19 "parser.y" /* yacc.c:339 */ +/* First part of user prologue. */ +#line 19 "parser.y" #include "vbscript.h" @@ -81,6 +85,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(vbscript); static int parser_error(parser_ctx_t *,const char*); static void parse_complete(parser_ctx_t*,BOOL); +static void handle_isexpression_script(parser_ctx_t *ctx, expression_t *expr); static void source_add_statement(parser_ctx_t*,statement_t*); static void source_add_class(parser_ctx_t*,class_decl_t*); @@ -124,21 +129,23 @@ static class_decl_t *add_dim_prop(parser_ctx_t*,class_decl_t*,dim_decl_t*,unsign static statement_t *link_statements(statement_t*,statement_t*); -static const WCHAR propertyW[] = {'p','r','o','p','e','r','t','y',0}; - #define STORAGE_IS_PRIVATE 1 #define STORAGE_IS_DEFAULT 2 #define CHECK_ERROR if(((parser_ctx_t*)ctx)->hres != S_OK) YYABORT -#line 136 "parser.tab.c" /* yacc.c:339 */ +#line 139 "parser.tab.c" -# ifndef YY_NULL -# if defined __cplusplus && 201103L <= __cplusplus -# define YY_NULL nullptr +# ifndef YY_NULLPTR +# if defined __cplusplus +# if 201103L <= __cplusplus +# define YY_NULLPTR nullptr +# else +# define YY_NULLPTR 0 +# endif # else -# define YY_NULL 0 +# define YY_NULLPTR ((void*)0) # endif # endif @@ -150,8 +157,8 @@ static const WCHAR propertyW[] = {'p','r','o','p','e','r','t','y',0}; # define YYERROR_VERBOSE 0 #endif -/* In a future release of Bison, this section will be replaced - by #include "parser.tab.h". */ +/* Use api.header.include to #include this header + instead of duplicating it here. */ #ifndef YY_PARSER_E_REACTOSSYNC_GCC_DLL_WIN32_VBSCRIPT_PARSER_TAB_H_INCLUDED # define YY_PARSER_E_REACTOSSYNC_GCC_DLL_WIN32_VBSCRIPT_PARSER_TAB_H_INCLUDED /* Debug traces. */ @@ -167,83 +174,82 @@ extern int parser_debug; # define YYTOKENTYPE enum yytokentype { - tEOF = 258, - tNL = 259, - tREM = 260, + tEXPRESSION = 258, + tEOF = 259, + tNL = 260, tEMPTYBRACKETS = 261, - tTRUE = 262, - tFALSE = 263, - tNOT = 264, - tAND = 265, - tOR = 266, - tXOR = 267, - tEQV = 268, - tIMP = 269, - tNEQ = 270, - tIS = 271, - tLTEQ = 272, - tGTEQ = 273, - tMOD = 274, - tCALL = 275, - tDIM = 276, - tSUB = 277, - tFUNCTION = 278, - tPROPERTY = 279, - tGET = 280, - tLET = 281, - tCONST = 282, - tIF = 283, - tELSE = 284, - tELSEIF = 285, - tEND = 286, - tTHEN = 287, - tEXIT = 288, - tWHILE = 289, - tWEND = 290, - tDO = 291, - tLOOP = 292, - tUNTIL = 293, - tFOR = 294, - tTO = 295, - tSTEP = 296, - tEACH = 297, - tIN = 298, - tSELECT = 299, - tCASE = 300, - tBYREF = 301, - tBYVAL = 302, - tOPTION = 303, - tEXPLICIT = 304, - tSTOP = 305, - tNOTHING = 306, - tEMPTY = 307, - tNULL = 308, - tCLASS = 309, - tSET = 310, - tNEW = 311, - tPUBLIC = 312, - tPRIVATE = 313, - tDEFAULT = 314, - tME = 315, - tERROR = 316, - tNEXT = 317, - tON = 318, - tRESUME = 319, - tGOTO = 320, - tIdentifier = 321, - tString = 322, - tLong = 323, - tShort = 324, + tLTEQ = 262, + tGTEQ = 263, + tNEQ = 264, + tSTOP = 265, + tME = 266, + tREM = 267, + tTRUE = 268, + tFALSE = 269, + tNOT = 270, + tAND = 271, + tOR = 272, + tXOR = 273, + tEQV = 274, + tIMP = 275, + tIS = 276, + tMOD = 277, + tCALL = 278, + tDIM = 279, + tSUB = 280, + tFUNCTION = 281, + tGET = 282, + tLET = 283, + tCONST = 284, + tIF = 285, + tELSE = 286, + tELSEIF = 287, + tEND = 288, + tTHEN = 289, + tEXIT = 290, + tWHILE = 291, + tWEND = 292, + tDO = 293, + tLOOP = 294, + tUNTIL = 295, + tFOR = 296, + tTO = 297, + tEACH = 298, + tIN = 299, + tSELECT = 300, + tCASE = 301, + tBYREF = 302, + tBYVAL = 303, + tOPTION = 304, + tNOTHING = 305, + tEMPTY = 306, + tNULL = 307, + tCLASS = 308, + tSET = 309, + tNEW = 310, + tPUBLIC = 311, + tPRIVATE = 312, + tNEXT = 313, + tON = 314, + tRESUME = 315, + tGOTO = 316, + tIdentifier = 317, + tString = 318, + tDEFAULT = 319, + tERROR = 320, + tEXPLICIT = 321, + tPROPERTY = 322, + tSTEP = 323, + tInt = 324, tDouble = 325 }; #endif /* Value type. */ #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED -typedef union YYSTYPE YYSTYPE; union YYSTYPE { -#line 88 "parser.y" /* yacc.c:355 */ +#line 87 "parser.y" const WCHAR *string; statement_t *statement; @@ -258,12 +264,14 @@ union YYSTYPE const_decl_t *const_decl; case_clausule_t *case_clausule; unsigned uint; - LONG lng; + LONG integer; BOOL boolean; double dbl; -#line 266 "parser.tab.c" /* yacc.c:355 */ +#line 272 "parser.tab.c" + }; +typedef union YYSTYPE YYSTYPE; # define YYSTYPE_IS_TRIVIAL 1 # define YYSTYPE_IS_DECLARED 1 #endif @@ -274,9 +282,7 @@ int parser_parse (parser_ctx_t *ctx); #endif /* !YY_PARSER_E_REACTOSSYNC_GCC_DLL_WIN32_VBSCRIPT_PARSER_TAB_H_INCLUDED */ -/* Copy the second part of user declarations. */ -#line 280 "parser.tab.c" /* yacc.c:358 */ #ifdef short # undef short @@ -297,13 +303,13 @@ typedef signed char yytype_int8; #ifdef YYTYPE_UINT16 typedef YYTYPE_UINT16 yytype_uint16; #else -typedef unsigned short int yytype_uint16; +typedef unsigned short yytype_uint16; #endif #ifdef YYTYPE_INT16 typedef YYTYPE_INT16 yytype_int16; #else -typedef short int yytype_int16; +typedef short yytype_int16; #endif #ifndef YYSIZE_T @@ -315,7 +321,7 @@ typedef short int yytype_int16; # include /* INFRINGES ON USER NAME SPACE */ # define YYSIZE_T size_t # else -# define YYSIZE_T unsigned int +# define YYSIZE_T unsigned # endif #endif @@ -333,14 +339,24 @@ typedef short int yytype_int16; # endif #endif -#ifndef __attribute__ -/* This feature is available in gcc versions 2.5 and later. */ -# if (! defined __GNUC__ || __GNUC__ < 2 \ - || (__GNUC__ == 2 && __GNUC_MINOR__ < 5)) -# define __attribute__(Spec) /* empty */ +#ifndef YY_ATTRIBUTE +# if (defined __GNUC__ \ + && (2 < __GNUC__ || (__GNUC__ == 2 && 96 <= __GNUC_MINOR__))) \ + || defined __SUNPRO_C && 0x5110 <= __SUNPRO_C +# define YY_ATTRIBUTE(Spec) __attribute__(Spec) +# else +# define YY_ATTRIBUTE(Spec) /* empty */ # endif #endif +#ifndef YY_ATTRIBUTE_PURE +# define YY_ATTRIBUTE_PURE YY_ATTRIBUTE ((__pure__)) +#endif + +#ifndef YY_ATTRIBUTE_UNUSED +# define YY_ATTRIBUTE_UNUSED YY_ATTRIBUTE ((__unused__)) +#endif + /* Suppress unused-variable warnings by "using" E. */ #if ! defined lint || defined __GNUC__ # define YYUSE(E) ((void) (E)) @@ -348,7 +364,7 @@ typedef short int yytype_int16; # define YYUSE(E) /* empty */ #endif -#if defined __GNUC__ && 407 <= __GNUC__ * 100 + __GNUC_MINOR__ +#if defined __GNUC__ && ! defined __ICC && 407 <= __GNUC__ * 100 + __GNUC_MINOR__ /* Suppress an incorrect diagnostic about yylval being uninitialized. */ # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \ _Pragma ("GCC diagnostic push") \ @@ -368,6 +384,8 @@ typedef short int yytype_int16; #endif +#define YY_ASSERT(E) ((void) (0 && (E))) + #if ! defined yyoverflow || YYERROR_VERBOSE /* The parser invokes alloca or malloc; define the necessary symbols. */ @@ -497,29 +515,29 @@ union yyalloc #endif /* !YYCOPY_NEEDED */ /* YYFINAL -- State number of the termination state. */ -#define YYFINAL 5 +#define YYFINAL 48 /* YYLAST -- Last index in YYTABLE. */ -#define YYLAST 944 +#define YYLAST 1153 /* YYNTOKENS -- Number of terminals. */ #define YYNTOKENS 87 /* YYNNTS -- Number of nonterminals. */ -#define YYNNTS 60 +#define YYNNTS 63 /* YYNRULES -- Number of rules. */ -#define YYNRULES 169 +#define YYNRULES 232 /* YYNSTATES -- Number of states. */ -#define YYNSTATES 343 +#define YYNSTATES 405 -/* YYTRANSLATE[YYX] -- Symbol number corresponding to YYX as returned - by yylex, with out-of-bounds checking. */ #define YYUNDEFTOK 2 #define YYMAXUTOK 325 +/* YYTRANSLATE(TOKEN-NUM) -- Symbol number corresponding to TOKEN-NUM + as returned by yylex, with out-of-bounds checking. */ #define YYTRANSLATE(YYX) \ - ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) + ((unsigned) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) /* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM - as returned by yylex, without out-of-bounds checking. */ + as returned by yylex. */ static const yytype_uint8 yytranslate[] = { 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, @@ -561,23 +579,30 @@ static const yytype_uint8 yytranslate[] = /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */ static const yytype_uint16 yyrline[] = { - 0, 147, 147, 150, 151, 153, 155, 156, 159, 160, - 163, 164, 167, 170, 171, 172, 173, 174, 177, 178, - 179, 181, 182, 183, 185, 188, 191, 192, 193, 194, - 195, 196, 197, 198, 200, 201, 202, 203, 204, 206, - 208, 212, 213, 216, 217, 220, 221, 222, 225, 226, - 229, 230, 233, 236, 237, 240, 241, 244, 245, 248, - 250, 251, 254, 256, 259, 260, 263, 264, 267, 271, - 272, 275, 276, 277, 281, 282, 285, 286, 289, 290, - 291, 293, 295, 298, 299, 302, 303, 306, 307, 310, - 311, 314, 315, 318, 319, 322, 323, 326, 327, 328, - 329, 330, 331, 332, 333, 336, 337, 340, 341, 342, - 345, 346, 349, 350, 354, 355, 357, 361, 362, 365, - 366, 367, 368, 371, 372, 375, 376, 377, 378, 379, - 380, 381, 384, 385, 386, 387, 390, 391, 392, 395, - 396, 399, 402, 403, 405, 407, 408, 411, 413, 415, - 419, 421, 425, 426, 429, 430, 431, 434, 435, 438, - 439, 442, 443, 444, 448, 449, 453, 454, 455, 456 + 0, 148, 148, 149, 152, 153, 156, 157, 158, 161, + 162, 165, 166, 167, 170, 171, 174, 175, 178, 181, + 182, 183, 184, 185, 188, 189, 190, 192, 193, 194, + 196, 199, 202, 203, 204, 205, 206, 207, 208, 209, + 211, 212, 213, 214, 215, 217, 219, 223, 224, 227, + 228, 231, 232, 233, 236, 237, 240, 241, 244, 247, + 248, 251, 252, 255, 256, 259, 261, 262, 266, 267, + 270, 271, 274, 275, 278, 282, 283, 286, 287, 288, + 292, 293, 296, 297, 300, 301, 302, 305, 306, 309, + 310, 313, 314, 317, 318, 321, 322, 325, 326, 329, + 330, 333, 334, 337, 338, 339, 340, 341, 342, 343, + 344, 347, 348, 351, 352, 353, 356, 357, 360, 361, + 365, 366, 368, 372, 373, 376, 377, 378, 379, 380, + 383, 384, 387, 388, 389, 390, 391, 392, 393, 396, + 397, 398, 401, 402, 405, 406, 409, 412, 413, 414, + 416, 418, 420, 421, 422, 423, 426, 428, 430, 434, + 436, 440, 441, 444, 445, 446, 449, 450, 453, 454, + 457, 458, 459, 463, 464, 465, 466, 467, 468, 472, + 473, 474, 475, 476, 477, 478, 479, 480, 481, 482, + 483, 484, 485, 486, 487, 488, 489, 490, 491, 492, + 493, 494, 495, 496, 497, 498, 499, 500, 501, 502, + 503, 504, 505, 506, 507, 508, 509, 510, 511, 512, + 513, 514, 515, 516, 517, 518, 519, 520, 521, 525, + 526, 527, 528 }; #endif @@ -586,23 +611,24 @@ static const yytype_uint16 yyrline[] = First, the terminals, then, starting at YYNTOKENS, nonterminals. */ static const char *const yytname[] = { - "$end", "error", "$undefined", "tEOF", "tNL", "tREM", "tEMPTYBRACKETS", - "tTRUE", "tFALSE", "tNOT", "tAND", "tOR", "tXOR", "tEQV", "tIMP", "tNEQ", - "tIS", "tLTEQ", "tGTEQ", "tMOD", "tCALL", "tDIM", "tSUB", "tFUNCTION", - "tPROPERTY", "tGET", "tLET", "tCONST", "tIF", "tELSE", "tELSEIF", "tEND", - "tTHEN", "tEXIT", "tWHILE", "tWEND", "tDO", "tLOOP", "tUNTIL", "tFOR", - "tTO", "tSTEP", "tEACH", "tIN", "tSELECT", "tCASE", "tBYREF", "tBYVAL", - "tOPTION", "tEXPLICIT", "tSTOP", "tNOTHING", "tEMPTY", "tNULL", "tCLASS", - "tSET", "tNEW", "tPUBLIC", "tPRIVATE", "tDEFAULT", "tME", "tERROR", - "tNEXT", "tON", "tRESUME", "tGOTO", "tIdentifier", "tString", "tLong", - "tShort", "tDouble", "':'", "'='", "'0'", "'.'", "','", "'('", "')'", - "'-'", "'>'", "'<'", "'&'", "'+'", "'\\\\'", "'*'", "'/'", "'^'", - "$accept", "Program", "OptionExplicit_opt", "SourceElements", - "StatementsNl_opt", "StatementsNl", "StatementNl", "Statement", - "SimpleStatement", "MemberExpression", "DimDeclList", "DimDecl", - "DimList", "ConstDeclList", "ConstDecl", "ConstExpression", "DoType", - "Step_opt", "IfStatement", "EndIf_opt", "ElseIfs_opt", "ElseIfs", - "ElseIf", "Else_opt", "CaseClausules", "Arguments_opt", + "$end", "error", "$undefined", "tEXPRESSION", "tEOF", "tNL", + "tEMPTYBRACKETS", "tLTEQ", "tGTEQ", "tNEQ", "tSTOP", "tME", "tREM", + "tTRUE", "tFALSE", "tNOT", "tAND", "tOR", "tXOR", "tEQV", "tIMP", "tIS", + "tMOD", "tCALL", "tDIM", "tSUB", "tFUNCTION", "tGET", "tLET", "tCONST", + "tIF", "tELSE", "tELSEIF", "tEND", "tTHEN", "tEXIT", "tWHILE", "tWEND", + "tDO", "tLOOP", "tUNTIL", "tFOR", "tTO", "tEACH", "tIN", "tSELECT", + "tCASE", "tBYREF", "tBYVAL", "tOPTION", "tNOTHING", "tEMPTY", "tNULL", + "tCLASS", "tSET", "tNEW", "tPUBLIC", "tPRIVATE", "tNEXT", "tON", + "tRESUME", "tGOTO", "tIdentifier", "tString", "tDEFAULT", "tERROR", + "tEXPLICIT", "tPROPERTY", "tSTEP", "tInt", "tDouble", "':'", "'='", + "'0'", "'.'", "','", "'('", "')'", "'-'", "'>'", "'<'", "'&'", "'+'", + "'\\\\'", "'*'", "'/'", "'^'", "$accept", "Program", + "OptionExplicit_opt", "SourceElements", "ExpressionNl_opt", + "BodyStatements", "StatementsNl_opt", "StatementsNl", "StatementNl", + "Statement", "SimpleStatement", "MemberExpression", "DimDeclList", + "DimDecl", "DimList", "ConstDeclList", "ConstDecl", "ConstExpression", + "DoType", "Step_opt", "IfStatement", "EndIf_opt", "ElseIfs_opt", + "ElseIfs", "ElseIf", "Else_opt", "CaseClausules", "Arguments_opt", "ArgumentList_opt", "ArgumentList", "EmptyBrackets_opt", "ExpressionList", "Expression", "EqvExpression", "XorExpression", "OrExpression", "AndExpression", "NotExpression", "EqualityExpression", @@ -612,7 +638,7 @@ static const char *const yytname[] = "NumericLiteralExpression", "IntegerValue", "PrimaryExpression", "ClassDeclaration", "ClassBody", "PropertyDecl", "FunctionDecl", "Storage_opt", "Storage", "ArgumentsDecl_opt", "ArgumentDeclList", - "ArgumentDecl", "Identifier", "StSep", YY_NULL + "ArgumentDecl", "Identifier", "DotIdentifier", "StSep", YY_NULLPTR }; #endif @@ -633,12 +659,12 @@ static const yytype_uint16 yytoknum[] = }; # endif -#define YYPACT_NINF -205 +#define YYPACT_NINF -294 #define yypact_value_is_default(Yystate) \ - (!!((Yystate) == (-205))) + (!!((Yystate) == (-294))) -#define YYTABLE_NINF -153 +#define YYTABLE_NINF -162 #define yytable_value_is_error(Yytable_value) \ 0 @@ -647,41 +673,47 @@ static const yytype_uint16 yytoknum[] = STATE-NUM. */ static const yytype_int16 yypact[] = { - -12, -8, 47, -205, 22, -205, 346, 22, 22, -205, - -205, 34, 35, -205, 35, 537, 134, 537, 12, 32, - 60, -205, 35, 34, -10, -205, -205, 65, -205, 639, - 537, -205, 57, 2, 427, -205, 85, -205, -205, -205, - 109, -205, -205, -205, -205, 4, -205, 33, 5, -205, - 46, 81, -205, -205, 537, -205, -205, -205, 35, -205, - -205, -205, -205, -205, 571, 4, 16, 126, 155, 160, - 168, -205, 37, 117, 29, 181, 119, 79, 130, -205, - 85, -205, -205, -205, -205, -205, -205, -205, 18, -205, - -205, 537, 680, 35, 146, 537, 22, 4, -205, 121, - -205, 13, -205, 639, -205, 457, 457, 147, -205, -205, - 77, 0, 35, 35, 35, 457, 148, -205, 35, -205, - 111, 35, 601, -205, -205, -205, -205, 537, 387, 537, - 537, 537, 537, 571, 571, 571, 571, 571, 571, 571, - 571, 571, 571, 571, 571, 571, 571, 571, 733, 18, - 183, -205, 639, 178, 537, 18, 8, 152, 165, 156, - -205, -205, -205, 151, 1, 537, 457, -205, 6, 6, - -205, -205, -205, -205, 154, 157, -205, 136, -205, -205, - 126, 639, 143, 155, 160, 168, -205, 117, 117, 117, - 117, 117, 117, 117, 29, 181, 181, 119, 79, 130, - 130, -205, 198, 680, 95, -205, 537, 28, 189, 35, - 204, 22, 22, 96, 170, 537, -205, -205, -205, 223, - -205, -3, -205, 22, 22, -205, 111, -205, 210, 868, - 214, -205, -205, 212, 537, 18, 537, 507, 221, 22, - 199, 8, 8, 70, 22, 223, 35, 35, 177, 180, - 253, 774, 774, -205, 537, 231, -205, 210, 230, -205, - -205, 223, 815, 71, 22, 22, 17, 219, 8, 22, - -205, -205, 201, 202, 206, 8, 253, 253, -205, -3, - -205, 234, 239, 19, 269, 243, -205, -205, 213, 537, - 22, 868, 639, 537, -205, -205, -205, 6, 200, 203, - -205, -205, -205, -205, 255, 257, 274, 774, 254, -205, - 223, 815, -205, 189, -205, 22, -3, -3, -205, -205, - 639, -205, -205, 222, -205, 774, 216, 220, -205, -205, - 250, 22, 22, 259, 774, 774, -205, 267, 268, 266, - 278, -205, -205 + 34, 617, -19, 50, -294, -294, -294, -294, 617, -294, + -294, -294, 166, -294, -294, -294, -294, -294, -294, -294, + -294, -294, -294, 617, 660, 660, 30, 2, 16, 43, + 96, 51, 111, -294, 37, 53, -17, 110, 100, 41, + 65, -294, 119, -294, -294, -294, -294, 15, -294, 466, + -294, -294, 19, -294, -294, -294, -294, 545, -294, -294, + -294, 617, 617, 617, 617, 617, 660, 660, 660, 660, + 660, 660, 660, 660, 660, 660, 660, 660, 660, 660, + 660, 1085, 15, 15, -294, -294, -294, 368, 166, 166, + 617, 117, 617, 20, 107, 163, 166, 368, 126, -294, + 149, 721, -294, 212, 152, 391, -294, 119, -294, -294, + 131, -294, -294, 545, 147, -8, 43, 96, 51, 111, + -294, 53, 53, 53, 53, 53, 53, 53, -17, 110, + 110, 100, 41, 65, 65, -294, -294, -294, -294, -294, + -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, + -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, + -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, + -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, + -294, -294, -294, -294, -294, -294, -294, -294, -294, 2, + -294, 154, 11, -294, 160, 164, 18, -294, -294, -294, + -294, -294, 9, -294, -294, 617, 771, 166, 169, 617, + 15, 2, -294, 144, -294, -294, 721, 545, 172, -294, + -294, -32, 166, 166, -294, -294, 545, 171, 166, -294, + 68, 166, 116, 516, 821, 9, 199, -294, 721, 202, + 617, 9, 82, 175, 190, 176, -294, 4, 617, 13, + 13, -294, -294, -294, -294, 173, 177, -294, -16, -294, + -294, 721, 66, 216, 771, 142, -294, 617, 104, 211, + 166, 227, 15, 15, 85, 201, 617, -294, -294, 241, + 97, -294, 15, 15, -294, 68, -294, 234, 1021, 237, + -294, -294, 230, 617, 9, 617, 588, 238, 15, 221, + 82, 82, -5, 15, 241, 166, 166, 200, 203, 270, + 871, 871, -294, 617, 249, -294, 234, 248, -294, -294, + 241, 921, 7, 15, 15, 10, 239, 82, 15, -294, + -294, 224, 225, 226, 82, 270, 270, -294, 97, -294, + 250, 871, 212, 256, 113, 285, 258, -294, -294, 243, + 617, 15, 1021, 721, 617, -294, -294, -294, 13, 228, + 229, -294, -294, -294, -294, 267, -294, 271, 305, 971, + 283, -294, 241, 921, -294, 211, -294, 15, 97, 97, + -294, -294, 721, -294, -294, 257, -294, 871, 240, 242, + -294, -294, 281, 15, 15, 251, 871, 871, -294, 287, + 288, 255, 261, -294, -294 }; /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM. @@ -689,63 +721,71 @@ static const yytype_int16 yypact[] = means the default is an error. */ static const yytype_uint8 yydefact[] = { - 3, 0, 0, 5, 0, 1, 152, 166, 167, 4, - 2, 0, 0, 165, 0, 0, 0, 0, 0, 0, - 0, 34, 0, 0, 155, 156, 140, 0, 164, 13, - 0, 6, 0, 15, 81, 22, 0, 123, 7, 27, - 0, 153, 41, 168, 169, 81, 21, 43, 45, 37, - 50, 0, 125, 126, 0, 131, 129, 130, 0, 127, - 134, 132, 135, 133, 0, 81, 0, 85, 87, 89, - 91, 93, 95, 97, 105, 107, 110, 112, 114, 117, - 120, 119, 128, 32, 30, 31, 28, 29, 0, 55, - 56, 0, 152, 0, 0, 0, 0, 81, 154, 0, - 14, 0, 12, 17, 82, 0, 0, 124, 18, 77, - 76, 78, 0, 0, 0, 0, 19, 74, 0, 47, - 0, 0, 0, 96, 121, 122, 124, 0, 152, 0, + 4, 9, 0, 0, 6, 145, 132, 133, 0, 138, + 136, 137, 0, 173, 134, 174, 175, 176, 177, 178, + 140, 141, 139, 0, 0, 0, 0, 87, 0, 91, + 93, 95, 97, 99, 101, 103, 111, 113, 116, 118, + 120, 123, 126, 125, 135, 130, 47, 0, 1, 161, + 102, 127, 0, 128, 129, 3, 88, 0, 131, 80, + 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 152, 0, - 0, 9, 10, 0, 0, 0, 152, 124, 0, 0, - 139, 16, 80, 0, 0, 0, 0, 42, 81, 81, - 44, 138, 136, 137, 0, 48, 51, 0, 52, 53, - 86, 8, 62, 88, 90, 92, 94, 99, 104, 103, - 102, 98, 100, 101, 106, 109, 108, 111, 113, 115, - 116, 118, 0, 152, 26, 11, 0, 0, 71, 0, - 0, 0, 0, 0, 153, 0, 35, 36, 75, 20, - 79, 0, 157, 0, 0, 46, 0, 54, 64, 152, - 0, 60, 23, 0, 0, 0, 0, 0, 0, 0, - 0, 152, 152, 0, 0, 33, 0, 0, 0, 159, - 81, 152, 152, 49, 0, 69, 65, 66, 62, 63, - 24, 25, 152, 57, 0, 0, 83, 0, 152, 0, - 146, 143, 0, 0, 0, 152, 81, 81, 158, 0, - 161, 0, 0, 0, 0, 0, 67, 61, 0, 0, - 0, 152, 8, 0, 40, 145, 141, 81, 0, 0, - 144, 162, 163, 160, 0, 0, 0, 152, 0, 39, - 58, 152, 72, 71, 84, 0, 0, 0, 150, 151, - 8, 70, 59, 0, 73, 152, 0, 0, 68, 38, - 0, 0, 0, 0, 152, 152, 147, 0, 0, 0, - 0, 148, 149 + 0, 0, 229, 230, 5, 2, 40, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 164, 165, + 0, 19, 7, 0, 21, 87, 28, 0, 8, 33, + 0, 162, 144, 0, 0, 84, 92, 94, 96, 98, + 100, 109, 108, 105, 110, 104, 106, 107, 112, 115, + 114, 117, 119, 121, 122, 124, 180, 181, 182, 183, + 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, + 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, + 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, + 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, + 224, 225, 226, 227, 228, 179, 48, 231, 232, 87, + 27, 49, 51, 43, 56, 0, 0, 38, 36, 34, + 35, 37, 0, 61, 62, 0, 161, 0, 0, 0, + 0, 87, 163, 0, 20, 18, 23, 0, 131, 24, + 83, 82, 0, 0, 86, 81, 0, 25, 0, 53, + 0, 0, 0, 161, 161, 0, 0, 15, 16, 0, + 0, 0, 161, 131, 0, 0, 22, 0, 0, 87, + 87, 85, 50, 143, 142, 0, 54, 57, 0, 58, + 59, 14, 68, 0, 161, 32, 17, 0, 0, 77, + 0, 0, 154, 148, 0, 162, 0, 41, 42, 26, + 0, 166, 0, 0, 52, 0, 60, 70, 161, 0, + 66, 29, 0, 0, 0, 0, 0, 0, 152, 0, + 161, 161, 0, 150, 39, 0, 0, 0, 168, 87, + 161, 161, 55, 0, 75, 71, 72, 68, 69, 30, + 31, 161, 63, 0, 0, 89, 0, 161, 0, 155, + 149, 0, 0, 0, 161, 87, 87, 167, 0, 170, + 0, 161, 12, 0, 0, 0, 0, 73, 67, 0, + 0, 0, 161, 14, 0, 46, 153, 146, 87, 0, + 0, 151, 171, 172, 169, 0, 13, 0, 0, 161, + 0, 45, 64, 161, 78, 77, 90, 0, 0, 0, + 159, 160, 14, 76, 65, 0, 79, 161, 0, 0, + 74, 44, 0, 0, 0, 0, 161, 161, 156, 0, + 0, 0, 0, 157, 158 }; /* YYPGOTO[NTERM-NUM]. */ static const yytype_int16 yypgoto[] = { - -205, -205, -205, -205, -124, -148, 298, -26, -205, -6, - 188, 99, 83, 190, -205, -205, 106, -205, -205, 54, - -205, 58, -205, -205, 7, -25, -205, -21, -33, 20, - 135, 191, 193, 194, 192, -45, -205, 56, 185, 66, - 195, 182, 67, -56, -4, 211, 158, -205, -205, -205, - -204, -205, -138, -128, -87, -163, 53, -102, 48, 27 + -294, -294, -294, -294, -294, -293, -233, -231, -38, -85, + -294, -46, 101, 54, 40, 99, -294, -294, 69, -294, + -294, 23, -294, 22, -294, -294, -40, -99, -294, -103, + -96, -11, 3, 276, 282, 284, 290, 27, -294, 130, + 272, 102, 279, 269, 128, 39, 21, 120, 90, -294, + -294, -294, -268, -294, -229, -227, -199, -245, 25, -157, + -12, -294, 98 }; /* YYDEFGOTO[NTERM-NUM]. */ static const yytype_int16 yydefgoto[] = { - -1, 2, 3, 6, 150, 151, 152, 32, 33, 65, - 46, 47, 174, 49, 50, 178, 91, 290, 35, 231, - 255, 256, 257, 285, 238, 107, 108, 163, 117, 265, - 111, 67, 68, 69, 70, 71, 72, 73, 74, 75, - 76, 77, 78, 79, 80, 81, 82, 175, 37, 38, - 210, 211, 39, 40, 41, 223, 248, 249, 42, 9 + -1, 3, 4, 49, 26, 340, 236, 237, 238, 103, + 104, 27, 190, 191, 255, 193, 194, 259, 205, 351, + 106, 290, 314, 315, 316, 346, 297, 58, 219, 114, + 59, 324, 115, 29, 30, 31, 32, 33, 34, 35, + 36, 37, 38, 39, 40, 41, 42, 43, 44, 256, + 45, 108, 271, 272, 109, 110, 111, 282, 307, 308, + 46, 186, 84 }; /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If @@ -753,285 +793,347 @@ static const yytype_int16 yydefgoto[] = number is the opposite. If YYTABLE_NINF, syntax error. */ static const yytype_int16 yytable[] = { - 34, 110, 36, 100, 205, 45, 224, 36, 125, 123, - 104, 119, 104, 109, 127, 127, 7, 97, 212, 36, - 116, 13, 7, 34, 202, 36, 7, 127, 213, 209, - 127, 127, 127, 127, 43, 44, 1, 270, 271, -142, - 126, 4, 127, 246, 247, 92, 89, 5, 128, 98, - 90, 306, 133, 134, 135, 136, 13, 228, 13, 13, - 48, 102, 51, 28, 295, 24, 25, 94, 236, 214, - 96, 300, 157, 103, 93, 166, 166, 161, 160, 233, - 115, 120, 221, 8, 162, 127, 34, 186, 36, 8, - 160, 201, 293, 8, 26, 272, 273, 34, 28, 36, - 28, 28, 182, 212, 212, 95, 124, 141, 118, 137, - 30, 142, 289, 213, 213, 148, 138, 139, 113, 114, - 243, 121, 34, 156, 36, 274, 99, 281, 282, 89, - 212, 113, 114, 90, 315, 222, 222, 212, 288, 129, - 213, 153, 34, 312, 36, 220, 34, 213, 36, -74, - 66, -74, 88, 122, 214, 214, 83, 84, 85, 112, - 167, 168, 169, 145, 146, 101, 48, 130, 313, 51, - 86, 131, 229, 87, 230, 34, 203, 36, 132, 171, - 172, 214, 208, 321, 173, 158, 159, 323, 214, 187, - 188, 189, 190, 191, 192, 193, 328, 34, 140, 36, - 143, 330, 144, 258, 60, 61, 62, 195, 196, 63, - 337, 338, 199, 200, 326, 327, 147, 280, 154, 165, - 204, 206, -124, 34, 215, 36, 149, 216, 218, 217, - 155, 225, 226, 232, 237, 240, 244, 127, 241, 242, - 254, 164, 259, 301, 302, 34, 34, 36, 36, 260, - 251, 252, 267, 269, 278, 279, 34, 48, 36, 104, - 284, 230, 262, 294, 222, 304, 268, 297, 298, 250, - 305, 275, 299, 307, 308, 309, 316, 318, 320, 317, - 319, 333, 322, 336, 329, 34, 34, 36, 36, 207, - 341, 291, 292, 331, 276, 277, 296, 332, 339, 340, - 219, 34, 342, 36, 31, 34, 170, 36, 239, 253, - 234, 176, 287, 314, 34, 286, 36, 311, 180, 34, - 324, 36, 183, 185, 184, 194, 198, 250, 34, 34, - 36, 36, 303, 179, 0, 227, 0, 0, 197, 0, - 0, 235, 325, 0, 0, 0, 0, 0, 0, 10, - 245, 0, 0, 0, 0, 0, 0, 0, 334, 335, - 0, 0, 0, 0, 250, 250, 11, 12, 0, 261, - 13, 263, 266, 14, 15, 0, 0, 0, 0, 16, - 17, 0, 18, 0, 0, 19, 0, 0, 0, 283, - 20, 181, 0, 0, 0, 0, 21, 0, 0, 0, - 22, 23, 0, 24, 25, 0, 26, 11, 12, 27, - 0, 13, 28, 0, 14, 15, 0, 29, 0, 0, - 16, 17, 30, 18, 310, 0, 19, 0, 266, 0, - 0, 20, 0, 104, 52, 53, 54, 21, 0, 0, - 0, 0, 23, 0, 24, 25, 0, 26, 0, 0, - 27, 13, 0, 28, 0, 0, 0, 0, 29, 0, - 0, 0, 0, 30, 52, 53, 54, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 55, 56, - 57, 13, 0, 58, 0, 0, 0, 26, 0, 0, - 0, 0, 0, 28, 59, 60, 61, 62, 0, 0, - 63, 0, 105, 106, 0, 64, 0, 0, 55, 56, - 57, 0, 0, 58, 52, 53, 54, 26, 0, 0, - 0, 0, 0, 28, 59, 60, 61, 62, 0, 0, - 63, 13, 105, 30, 0, 64, 264, 0, 0, 0, - 0, 0, 0, 0, 52, 53, 54, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 55, 56, - 57, 13, 0, 58, 0, 0, 0, 26, 0, 0, - 0, 0, 0, 28, 59, 60, 61, 62, 52, 53, - 63, 0, 0, 30, 0, 64, 0, 0, 55, 56, - 57, 0, 0, 58, 0, 13, 0, 26, 0, 0, - 0, 0, 0, 28, 59, 60, 61, 62, 52, 53, - 63, 0, 0, 30, 0, 64, 0, 0, 0, 0, - 0, 0, 55, 56, 57, 0, 0, 58, 0, 0, - 0, 26, 0, 0, 0, 0, 0, 28, 59, 60, - 61, 62, 0, 0, 63, 0, 0, 30, 0, 64, - 0, 0, 55, 56, 57, 0, 0, 0, 0, 11, - 12, -152, -152, 13, 0, 0, 14, 15, 59, 60, - 61, 62, 16, 17, 63, 18, 0, 0, 19, 177, - 0, 0, 0, 20, 0, 0, 0, 0, 0, 21, - 0, 0, 0, 0, 23, 0, 24, 25, 0, 26, - 11, 12, 27, 0, 13, 28, 0, 14, 15, 0, - 29, 0, 0, 16, 17, 30, 18, -8, 0, 19, - 0, 0, 0, 0, 20, 0, 0, 0, 0, 0, - 21, 0, 0, 0, 0, 23, 0, 24, 25, 0, - 26, 0, 0, 27, 0, 0, 28, 0, 0, 0, - 0, 29, 0, 11, 12, 0, 30, 13, 0, 0, - 14, 15, 0, 0, 0, 0, 16, 17, -8, 18, - 0, 0, 19, 0, 0, 0, 0, 20, 0, 0, - 0, 0, 0, 21, 0, 0, 0, 0, 23, 0, - 24, 25, 0, 26, 11, 12, 27, 0, 13, 28, - 0, 14, 15, 0, 29, -8, 0, 16, 17, 30, - 18, 0, 0, 19, 0, 0, 0, 0, 20, 0, - 0, 0, 0, 0, 21, 0, 0, 0, 0, 23, - 0, 24, 25, 0, 26, 11, 12, 27, 0, 13, - 28, 0, 14, 15, 0, 29, 0, 0, 16, 17, - 30, 18, 0, 0, 19, 0, 0, 0, 0, 20, - 0, 0, 0, 0, 0, 21, 0, 0, 0, 0, - 23, 0, 24, 25, 0, 26, 0, -8, 27, 0, - 0, 28, 0, 0, 0, 0, 29, 0, 11, 12, - 0, 30, 13, 0, 0, 14, 15, 0, 0, 0, - 0, 16, 17, 0, 18, 0, 0, 19, 0, 0, - 0, 0, 20, 0, 0, 0, 0, 0, 21, 0, - 0, 0, 0, 23, 0, 24, 25, 0, 26, 0, - 0, 27, 0, 0, 28, 0, 0, 0, 0, 29, - 0, 0, 0, 0, 30 + 51, 263, 220, 105, 28, 283, 218, 266, 56, 221, + 224, 102, 61, 273, 82, 274, 214, 229, 343, 56, + 82, 60, 331, 332, 61, 82, 52, 61, 287, 61, + 61, 292, 329, 330, 55, 50, 61, 1, 61, 61, + -80, 189, -80, 275, 66, 67, 68, 47, 366, 333, + 48, 211, 233, 20, 21, 105, 203, 22, 69, 356, + 204, 74, 62, 53, 54, 75, 361, 226, 64, 185, + 107, 273, 273, 274, 274, 350, 192, 195, 57, 226, + 83, 112, 208, 2, 210, 354, 83, 230, 349, 280, + 227, 83, 120, 196, 392, 202, 112, 288, 273, 289, + 274, 275, 275, 399, 400, 273, 270, 274, 107, 70, + 222, 223, 243, 377, 63, -147, 71, 72, 107, 135, + 375, 374, 107, 251, 61, 78, 79, 65, 275, 6, + 7, 246, 76, 61, 73, 275, 383, 253, 98, 99, + 385, 254, 197, 198, 305, 306, 295, 368, 262, 390, + 207, 80, 302, 281, 281, 199, 222, 223, 200, 13, + 105, 15, 16, 17, 18, 19, 9, 10, 11, 13, + 105, 15, 16, 17, 18, 19, 129, 130, 203, 14, + 187, 188, 204, 77, 201, 20, 21, 105, 105, 22, + 212, 206, 105, 81, 258, 239, 121, 122, 123, 124, + 125, 126, 127, 317, 244, 245, 133, 134, 235, 209, + 249, 250, 241, 339, 213, 105, 192, 215, 105, 195, + 247, 388, 389, 216, 225, 342, 342, 107, 13, 228, + 15, 16, 17, 18, 19, 231, 232, 107, 265, 362, + 363, 240, 105, 268, 248, -131, 267, 276, 277, 278, + 284, 279, 285, 291, 107, 107, 342, 296, 192, 107, + 299, 61, 281, 303, 105, 105, 313, 318, 309, 319, + 294, 326, 341, 341, 328, 105, 56, 337, 338, 304, + 345, 289, 107, 365, 355, 107, 358, 359, 360, 367, + 369, 370, 380, 335, 336, 105, 320, 381, 322, 325, + 234, 371, 342, 341, 378, 379, 105, 105, 242, 107, + 382, 342, 342, 384, 395, 391, 344, 393, 398, 394, + 401, 402, 403, 105, 298, 312, 309, 105, 404, 252, + 257, 107, 107, 264, 293, 386, 105, 116, 347, 269, + 348, 105, 107, 376, 117, 128, 132, 118, 286, 341, + 105, 105, 260, 372, 119, 131, 0, 325, 341, 341, + 0, 0, 107, 364, 0, 0, 309, 309, 0, 0, + 300, 301, 0, 107, 107, 0, 0, 0, 0, 5, + 310, 311, 0, 0, 0, 0, 0, 0, 0, 0, + 107, 0, 321, 0, 107, 0, 327, 56, 0, 0, + 0, 334, 5, 107, 6, 7, 8, 0, 107, 0, + 0, 0, 0, 0, 0, 0, 0, 107, 107, 0, + 0, 352, 353, 0, 0, 0, 357, 0, 0, 0, + 13, 0, 15, 16, 17, 18, 19, 0, 0, 0, + 0, 9, 10, 11, 23, 0, 12, 0, 0, 373, + 0, 0, 0, 13, 14, 15, 16, 17, 18, 19, + 20, 21, 0, 0, 22, 0, 113, 217, 0, 24, + 85, 0, 0, 25, 0, 387, 86, 5, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 87, + 88, 396, 397, 0, 0, 89, 90, 0, 0, 0, + 0, 91, 92, 0, 93, 0, 0, 94, 0, 0, + 0, 95, 0, 0, 0, 0, 0, 0, 0, 96, + 97, 261, 98, 99, 0, 100, 86, 5, 13, 0, + 15, 16, 17, 18, 19, 0, 0, 101, 0, 87, + 88, 0, 23, 0, 0, 89, 90, 0, 0, 0, + 0, 91, 92, 0, 93, 0, 5, 94, 6, 7, + 8, 95, 0, 0, 0, 0, 0, 0, 0, 0, + 97, 0, 98, 99, 0, 100, 0, 0, 13, 0, + 15, 16, 17, 18, 19, 0, 0, 101, 0, 0, + 0, 0, 23, 0, 0, 9, 10, 11, 0, 5, + 12, 6, 7, 8, 0, 0, 0, 13, 14, 15, + 16, 17, 18, 19, 20, 21, 0, 0, 22, 323, + 113, 23, 0, 24, 0, 0, 0, 25, 5, 0, + 6, 7, 8, 0, 0, 0, 0, 0, 9, 10, + 11, 0, 0, 12, 0, 0, 0, 0, 0, 0, + 13, 14, 15, 16, 17, 18, 19, 20, 21, 0, + 0, 22, 0, 0, 23, 0, 24, 9, 10, 11, + 25, 5, 12, 6, 7, 0, 0, 0, 0, 13, + 14, 15, 16, 17, 18, 19, 20, 21, 0, 0, + 22, 0, 0, 23, 0, 24, 0, 0, 0, 25, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 9, 10, 11, 0, 0, 12, 0, 0, 0, 0, + 0, 0, 13, 14, 15, 16, 17, 18, 19, 20, + 21, 86, 5, 22, 0, 0, 23, 0, 24, 0, + 0, 0, 25, 0, 87, 88, -161, -161, 0, 0, + 89, 90, 0, 0, 0, 0, 91, 92, 0, 93, + 0, 0, 94, 0, 0, 0, 95, 0, 0, 0, + 0, 0, 0, 0, 0, 97, 0, 98, 99, 0, + 100, 86, 5, 13, 0, 15, 16, 17, 18, 19, + 0, 0, 101, 0, 87, 88, 0, 23, 0, 0, + 89, 90, 0, 0, 0, 0, 91, 92, 0, 93, + -14, 0, 94, 0, 0, 0, 95, 0, 0, 0, + 0, 0, 0, 0, 0, 97, 0, 98, 99, 0, + 100, 86, 5, 13, 0, 15, 16, 17, 18, 19, + 0, 0, 101, 0, 87, 88, 0, 23, 0, 0, + 89, 90, 0, 0, 0, 0, 91, 92, -14, 93, + 0, 0, 94, 0, 0, 0, 95, 0, 0, 0, + 0, 0, 0, 0, 0, 97, 0, 98, 99, 0, + 100, 86, 5, 13, 0, 15, 16, 17, 18, 19, + 0, 0, 101, 0, 87, 88, 0, 23, 0, 0, + 89, 90, 0, 0, -11, 0, 91, 92, 0, 93, + 0, 0, 94, 0, 0, 0, 95, 0, 0, 0, + 0, 0, 0, 0, 0, 97, 0, 98, 99, 0, + 100, 86, 5, 13, 0, 15, 16, 17, 18, 19, + 0, 0, 101, 0, 87, 88, 0, 23, 0, 0, + 89, 90, 0, 0, 0, 0, 91, 92, 0, 93, + 0, 0, 94, 0, 0, 0, 95, 0, 0, 0, + 0, 0, 0, 0, 0, 97, 0, 98, 99, -14, + 100, 86, 5, 13, 0, 15, 16, 17, 18, 19, + 0, 0, 101, 0, 87, 88, 0, 23, 0, 0, + 89, 90, 0, 0, -14, 0, 91, 92, 0, 93, + 0, 0, 94, 0, 0, 0, 95, 0, 0, 0, + 0, 0, 0, 0, 0, 97, 0, 98, 99, 0, + 100, 86, 5, 13, 0, 15, 16, 17, 18, 19, + 0, 0, 101, 0, 87, 88, 0, 23, 0, 0, + 89, 90, 0, 0, 0, 0, 91, 92, 0, 93, + 0, 0, 94, 0, 0, 0, 95, 0, 0, 0, + 0, 0, 0, 0, 0, 97, 0, 98, 99, 0, + 100, 0, 0, 13, 0, 15, 16, 17, 18, 19, + 0, 0, 101, 0, 0, 0, 0, 23, 136, 137, + 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, + 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, + 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, + 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, + 178, 179, 180, 181, 182, 183, 184, 13, 0, 15, + 16, 17, 18, 19 }; static const yytype_int16 yycheck[] = { - 6, 34, 6, 29, 152, 11, 169, 11, 64, 54, - 6, 6, 6, 34, 14, 14, 4, 23, 156, 23, - 45, 24, 4, 29, 148, 29, 4, 14, 156, 21, - 14, 14, 14, 14, 7, 8, 48, 241, 242, 31, - 65, 49, 14, 46, 47, 18, 34, 0, 32, 59, - 38, 32, 15, 16, 17, 18, 24, 181, 24, 24, - 12, 4, 14, 66, 268, 57, 58, 19, 40, 156, - 22, 275, 97, 71, 42, 75, 75, 103, 77, 203, - 76, 76, 76, 71, 105, 14, 92, 132, 92, 71, - 77, 147, 75, 71, 60, 25, 26, 103, 66, 103, - 66, 66, 128, 241, 242, 45, 58, 78, 75, 72, - 76, 82, 41, 241, 242, 88, 79, 80, 22, 23, - 24, 75, 128, 96, 128, 55, 61, 251, 252, 34, - 268, 22, 23, 38, 297, 168, 169, 275, 262, 13, - 268, 93, 148, 291, 148, 166, 152, 275, 152, 72, - 15, 74, 17, 72, 241, 242, 22, 23, 24, 74, - 112, 113, 114, 84, 85, 30, 118, 12, 292, 121, - 36, 11, 29, 39, 31, 181, 149, 181, 10, 68, - 69, 268, 155, 307, 73, 64, 65, 311, 275, 133, - 134, 135, 136, 137, 138, 139, 320, 203, 81, 203, - 19, 325, 83, 229, 68, 69, 70, 141, 142, 73, - 334, 335, 145, 146, 316, 317, 86, 250, 72, 72, - 37, 43, 74, 229, 72, 229, 91, 62, 77, 73, - 95, 77, 75, 35, 45, 31, 66, 14, 211, 212, - 30, 106, 28, 276, 277, 251, 252, 251, 252, 37, - 223, 224, 31, 54, 77, 75, 262, 209, 262, 6, - 29, 31, 235, 44, 297, 31, 239, 66, 66, 221, - 31, 244, 66, 4, 31, 62, 76, 22, 4, 76, - 23, 31, 28, 24, 62, 291, 292, 291, 292, 154, - 24, 264, 265, 77, 246, 247, 269, 77, 31, 31, - 165, 307, 24, 307, 6, 311, 118, 311, 209, 226, - 204, 121, 258, 293, 320, 257, 320, 290, 127, 325, - 313, 325, 129, 131, 130, 140, 144, 279, 334, 335, - 334, 335, 279, 122, -1, 177, -1, -1, 143, -1, - -1, 206, 315, -1, -1, -1, -1, -1, -1, 3, - 215, -1, -1, -1, -1, -1, -1, -1, 331, 332, - -1, -1, -1, -1, 316, 317, 20, 21, -1, 234, - 24, 236, 237, 27, 28, -1, -1, -1, -1, 33, - 34, -1, 36, -1, -1, 39, -1, -1, -1, 254, - 44, 4, -1, -1, -1, -1, 50, -1, -1, -1, - 54, 55, -1, 57, 58, -1, 60, 20, 21, 63, - -1, 24, 66, -1, 27, 28, -1, 71, -1, -1, - 33, 34, 76, 36, 289, -1, 39, -1, 293, -1, - -1, 44, -1, 6, 7, 8, 9, 50, -1, -1, - -1, -1, 55, -1, 57, 58, -1, 60, -1, -1, - 63, 24, -1, 66, -1, -1, -1, -1, 71, -1, - -1, -1, -1, 76, 7, 8, 9, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 51, 52, - 53, 24, -1, 56, -1, -1, -1, 60, -1, -1, - -1, -1, -1, 66, 67, 68, 69, 70, -1, -1, - 73, -1, 75, 76, -1, 78, -1, -1, 51, 52, - 53, -1, -1, 56, 7, 8, 9, 60, -1, -1, - -1, -1, -1, 66, 67, 68, 69, 70, -1, -1, - 73, 24, 75, 76, -1, 78, 29, -1, -1, -1, - -1, -1, -1, -1, 7, 8, 9, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 51, 52, - 53, 24, -1, 56, -1, -1, -1, 60, -1, -1, - -1, -1, -1, 66, 67, 68, 69, 70, 7, 8, - 73, -1, -1, 76, -1, 78, -1, -1, 51, 52, - 53, -1, -1, 56, -1, 24, -1, 60, -1, -1, - -1, -1, -1, 66, 67, 68, 69, 70, 7, 8, - 73, -1, -1, 76, -1, 78, -1, -1, -1, -1, - -1, -1, 51, 52, 53, -1, -1, 56, -1, -1, - -1, 60, -1, -1, -1, -1, -1, 66, 67, 68, - 69, 70, -1, -1, 73, -1, -1, 76, -1, 78, - -1, -1, 51, 52, 53, -1, -1, -1, -1, 20, - 21, 22, 23, 24, -1, -1, 27, 28, 67, 68, - 69, 70, 33, 34, 73, 36, -1, -1, 39, 78, - -1, -1, -1, 44, -1, -1, -1, -1, -1, 50, - -1, -1, -1, -1, 55, -1, 57, 58, -1, 60, - 20, 21, 63, -1, 24, 66, -1, 27, 28, -1, - 71, -1, -1, 33, 34, 76, 36, 37, -1, 39, - -1, -1, -1, -1, 44, -1, -1, -1, -1, -1, - 50, -1, -1, -1, -1, 55, -1, 57, 58, -1, - 60, -1, -1, 63, -1, -1, 66, -1, -1, -1, - -1, 71, -1, 20, 21, -1, 76, 24, -1, -1, - 27, 28, -1, -1, -1, -1, 33, 34, 35, 36, - -1, -1, 39, -1, -1, -1, -1, 44, -1, -1, - -1, -1, -1, 50, -1, -1, -1, -1, 55, -1, - 57, 58, -1, 60, 20, 21, 63, -1, 24, 66, - -1, 27, 28, -1, 71, 31, -1, 33, 34, 76, - 36, -1, -1, 39, -1, -1, -1, -1, 44, -1, - -1, -1, -1, -1, 50, -1, -1, -1, -1, 55, - -1, 57, 58, -1, 60, 20, 21, 63, -1, 24, - 66, -1, 27, 28, -1, 71, -1, -1, 33, 34, - 76, 36, -1, -1, 39, -1, -1, -1, -1, 44, - -1, -1, -1, -1, -1, 50, -1, -1, -1, -1, - 55, -1, 57, 58, -1, 60, -1, 62, 63, -1, - -1, 66, -1, -1, -1, -1, 71, -1, 20, 21, - -1, 76, 24, -1, -1, 27, 28, -1, -1, -1, - -1, 33, 34, -1, 36, -1, -1, 39, -1, -1, - -1, -1, 44, -1, -1, -1, -1, -1, 50, -1, - -1, -1, -1, 55, -1, 57, 58, -1, 60, -1, - -1, 63, -1, -1, 66, -1, -1, -1, -1, 71, - -1, -1, -1, -1, 76 + 12, 234, 105, 49, 1, 250, 105, 238, 6, 105, + 113, 49, 20, 242, 5, 242, 101, 6, 311, 6, + 5, 5, 27, 28, 20, 5, 23, 20, 261, 20, + 20, 264, 300, 301, 4, 8, 20, 3, 20, 20, + 72, 87, 74, 242, 7, 8, 9, 66, 341, 54, + 0, 97, 34, 69, 70, 101, 36, 73, 21, 327, + 40, 78, 19, 24, 25, 82, 334, 75, 17, 81, + 49, 300, 301, 300, 301, 68, 88, 89, 76, 75, + 71, 77, 94, 49, 96, 75, 71, 76, 321, 76, + 189, 71, 65, 90, 387, 92, 77, 31, 327, 33, + 327, 300, 301, 396, 397, 334, 24, 334, 87, 72, + 25, 26, 211, 358, 18, 33, 79, 80, 97, 80, + 353, 352, 101, 226, 20, 84, 85, 16, 327, 13, + 14, 216, 22, 20, 81, 334, 369, 69, 56, 57, + 373, 73, 25, 26, 47, 48, 42, 34, 233, 382, + 43, 86, 67, 249, 250, 38, 25, 26, 41, 62, + 206, 64, 65, 66, 67, 68, 50, 51, 52, 62, + 216, 64, 65, 66, 67, 68, 74, 75, 36, 63, + 82, 83, 40, 83, 67, 69, 70, 233, 234, 73, + 64, 93, 238, 74, 78, 207, 66, 67, 68, 69, + 70, 71, 72, 288, 60, 61, 78, 79, 205, 46, + 222, 223, 209, 309, 65, 261, 228, 5, 264, 231, + 217, 378, 379, 71, 77, 310, 311, 206, 62, 75, + 64, 65, 66, 67, 68, 75, 72, 216, 39, 335, + 336, 72, 288, 240, 72, 74, 44, 72, 58, 73, + 77, 248, 75, 37, 233, 234, 341, 46, 270, 238, + 33, 20, 358, 62, 310, 311, 32, 30, 280, 39, + 267, 33, 310, 311, 53, 321, 6, 77, 75, 276, + 31, 33, 261, 33, 45, 264, 62, 62, 62, 33, + 5, 33, 25, 305, 306, 341, 293, 26, 295, 296, + 202, 58, 387, 341, 76, 76, 352, 353, 210, 288, + 5, 396, 397, 30, 33, 58, 313, 77, 67, 77, + 33, 33, 67, 369, 270, 285, 338, 373, 67, 228, + 231, 310, 311, 235, 265, 375, 382, 61, 316, 241, + 317, 387, 321, 354, 62, 73, 77, 63, 258, 387, + 396, 397, 232, 350, 64, 76, -1, 354, 396, 397, + -1, -1, 341, 338, -1, -1, 378, 379, -1, -1, + 272, 273, -1, 352, 353, -1, -1, -1, -1, 11, + 282, 283, -1, -1, -1, -1, -1, -1, -1, -1, + 369, -1, 294, -1, 373, -1, 298, 6, -1, -1, + -1, 303, 11, 382, 13, 14, 15, -1, 387, -1, + -1, -1, -1, -1, -1, -1, -1, 396, 397, -1, + -1, 323, 324, -1, -1, -1, 328, -1, -1, -1, + 62, -1, 64, 65, 66, 67, 68, -1, -1, -1, + -1, 50, 51, 52, 76, -1, 55, -1, -1, 351, + -1, -1, -1, 62, 63, 64, 65, 66, 67, 68, + 69, 70, -1, -1, 73, -1, 75, 76, -1, 78, + 4, -1, -1, 82, -1, 377, 10, 11, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 23, + 24, 393, 394, -1, -1, 29, 30, -1, -1, -1, + -1, 35, 36, -1, 38, -1, -1, 41, -1, -1, + -1, 45, -1, -1, -1, -1, -1, -1, -1, 53, + 54, 5, 56, 57, -1, 59, 10, 11, 62, -1, + 64, 65, 66, 67, 68, -1, -1, 71, -1, 23, + 24, -1, 76, -1, -1, 29, 30, -1, -1, -1, + -1, 35, 36, -1, 38, -1, 11, 41, 13, 14, + 15, 45, -1, -1, -1, -1, -1, -1, -1, -1, + 54, -1, 56, 57, -1, 59, -1, -1, 62, -1, + 64, 65, 66, 67, 68, -1, -1, 71, -1, -1, + -1, -1, 76, -1, -1, 50, 51, 52, -1, 11, + 55, 13, 14, 15, -1, -1, -1, 62, 63, 64, + 65, 66, 67, 68, 69, 70, -1, -1, 73, 31, + 75, 76, -1, 78, -1, -1, -1, 82, 11, -1, + 13, 14, 15, -1, -1, -1, -1, -1, 50, 51, + 52, -1, -1, 55, -1, -1, -1, -1, -1, -1, + 62, 63, 64, 65, 66, 67, 68, 69, 70, -1, + -1, 73, -1, -1, 76, -1, 78, 50, 51, 52, + 82, 11, 55, 13, 14, -1, -1, -1, -1, 62, + 63, 64, 65, 66, 67, 68, 69, 70, -1, -1, + 73, -1, -1, 76, -1, 78, -1, -1, -1, 82, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 50, 51, 52, -1, -1, 55, -1, -1, -1, -1, + -1, -1, 62, 63, 64, 65, 66, 67, 68, 69, + 70, 10, 11, 73, -1, -1, 76, -1, 78, -1, + -1, -1, 82, -1, 23, 24, 25, 26, -1, -1, + 29, 30, -1, -1, -1, -1, 35, 36, -1, 38, + -1, -1, 41, -1, -1, -1, 45, -1, -1, -1, + -1, -1, -1, -1, -1, 54, -1, 56, 57, -1, + 59, 10, 11, 62, -1, 64, 65, 66, 67, 68, + -1, -1, 71, -1, 23, 24, -1, 76, -1, -1, + 29, 30, -1, -1, -1, -1, 35, 36, -1, 38, + 39, -1, 41, -1, -1, -1, 45, -1, -1, -1, + -1, -1, -1, -1, -1, 54, -1, 56, 57, -1, + 59, 10, 11, 62, -1, 64, 65, 66, 67, 68, + -1, -1, 71, -1, 23, 24, -1, 76, -1, -1, + 29, 30, -1, -1, -1, -1, 35, 36, 37, 38, + -1, -1, 41, -1, -1, -1, 45, -1, -1, -1, + -1, -1, -1, -1, -1, 54, -1, 56, 57, -1, + 59, 10, 11, 62, -1, 64, 65, 66, 67, 68, + -1, -1, 71, -1, 23, 24, -1, 76, -1, -1, + 29, 30, -1, -1, 33, -1, 35, 36, -1, 38, + -1, -1, 41, -1, -1, -1, 45, -1, -1, -1, + -1, -1, -1, -1, -1, 54, -1, 56, 57, -1, + 59, 10, 11, 62, -1, 64, 65, 66, 67, 68, + -1, -1, 71, -1, 23, 24, -1, 76, -1, -1, + 29, 30, -1, -1, -1, -1, 35, 36, -1, 38, + -1, -1, 41, -1, -1, -1, 45, -1, -1, -1, + -1, -1, -1, -1, -1, 54, -1, 56, 57, 58, + 59, 10, 11, 62, -1, 64, 65, 66, 67, 68, + -1, -1, 71, -1, 23, 24, -1, 76, -1, -1, + 29, 30, -1, -1, 33, -1, 35, 36, -1, 38, + -1, -1, 41, -1, -1, -1, 45, -1, -1, -1, + -1, -1, -1, -1, -1, 54, -1, 56, 57, -1, + 59, 10, 11, 62, -1, 64, 65, 66, 67, 68, + -1, -1, 71, -1, 23, 24, -1, 76, -1, -1, + 29, 30, -1, -1, -1, -1, 35, 36, -1, 38, + -1, -1, 41, -1, -1, -1, 45, -1, -1, -1, + -1, -1, -1, -1, -1, 54, -1, 56, 57, -1, + 59, -1, -1, 62, -1, 64, 65, 66, 67, 68, + -1, -1, 71, -1, -1, -1, -1, 76, 13, 14, + 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, + 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, + 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, + 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, + 55, 56, 57, 58, 59, 60, 61, 62, -1, 64, + 65, 66, 67, 68 }; /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing symbol of state STATE-NUM. */ static const yytype_uint8 yystos[] = { - 0, 48, 88, 89, 49, 0, 90, 4, 71, 146, - 3, 20, 21, 24, 27, 28, 33, 34, 36, 39, - 44, 50, 54, 55, 57, 58, 60, 63, 66, 71, - 76, 93, 94, 95, 96, 105, 131, 135, 136, 139, - 140, 141, 145, 146, 146, 96, 97, 98, 145, 100, - 101, 145, 7, 8, 9, 51, 52, 53, 56, 67, - 68, 69, 70, 73, 78, 96, 117, 118, 119, 120, + 0, 3, 49, 88, 89, 11, 13, 14, 15, 50, + 51, 52, 55, 62, 63, 64, 65, 66, 67, 68, + 69, 70, 73, 76, 78, 82, 91, 98, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, - 131, 132, 133, 22, 23, 24, 36, 39, 117, 34, - 38, 103, 146, 42, 145, 45, 145, 96, 59, 61, - 94, 117, 4, 71, 6, 75, 76, 112, 113, 114, - 115, 117, 74, 22, 23, 76, 112, 115, 75, 6, - 76, 75, 72, 122, 145, 130, 112, 14, 32, 13, - 12, 11, 10, 15, 16, 17, 18, 72, 79, 80, - 81, 78, 82, 19, 83, 84, 85, 86, 146, 117, - 91, 92, 93, 145, 72, 117, 146, 112, 64, 65, - 77, 94, 114, 114, 117, 72, 75, 145, 145, 145, - 97, 68, 69, 73, 99, 134, 100, 78, 102, 132, - 118, 4, 94, 119, 120, 121, 122, 124, 124, 124, - 124, 124, 124, 124, 125, 126, 126, 127, 128, 129, - 129, 130, 91, 146, 37, 92, 43, 117, 146, 21, - 137, 138, 139, 140, 141, 72, 62, 73, 77, 117, - 114, 76, 115, 142, 142, 77, 75, 133, 91, 29, - 31, 106, 35, 91, 103, 117, 40, 45, 111, 98, - 31, 146, 146, 24, 66, 117, 46, 47, 143, 144, - 145, 146, 146, 99, 30, 107, 108, 109, 94, 28, - 37, 117, 146, 117, 29, 116, 117, 31, 146, 54, - 137, 137, 25, 26, 55, 146, 145, 145, 77, 75, - 115, 91, 91, 117, 29, 110, 108, 106, 91, 41, - 104, 146, 146, 75, 44, 137, 146, 66, 66, 66, - 137, 115, 115, 143, 31, 31, 32, 4, 31, 62, - 117, 146, 92, 91, 116, 142, 76, 76, 22, 23, - 4, 91, 28, 91, 111, 146, 144, 144, 91, 62, - 91, 77, 77, 31, 146, 146, 24, 91, 91, 31, - 31, 24, 24 + 131, 132, 133, 134, 135, 137, 147, 66, 0, 90, + 124, 147, 119, 132, 132, 4, 6, 76, 114, 117, + 5, 20, 19, 18, 17, 16, 7, 8, 9, 21, + 72, 79, 80, 81, 78, 82, 22, 83, 84, 85, + 86, 74, 5, 71, 149, 4, 10, 23, 24, 29, + 30, 35, 36, 38, 41, 45, 53, 54, 56, 57, + 59, 71, 95, 96, 97, 98, 107, 133, 138, 141, + 142, 143, 77, 75, 116, 119, 120, 121, 122, 123, + 124, 126, 126, 126, 126, 126, 126, 126, 127, 128, + 128, 129, 130, 131, 131, 132, 13, 14, 15, 16, + 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, + 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, + 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, + 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, + 57, 58, 59, 60, 61, 147, 148, 149, 149, 98, + 99, 100, 147, 102, 103, 147, 119, 25, 26, 38, + 41, 67, 119, 36, 40, 105, 149, 43, 147, 46, + 147, 98, 64, 65, 96, 5, 71, 76, 114, 115, + 116, 117, 25, 26, 116, 77, 75, 114, 75, 6, + 76, 75, 72, 34, 149, 119, 93, 94, 95, 147, + 72, 119, 149, 114, 60, 61, 96, 119, 72, 147, + 147, 116, 99, 69, 73, 101, 136, 102, 78, 104, + 134, 5, 96, 93, 149, 39, 94, 44, 119, 149, + 24, 139, 140, 141, 142, 143, 72, 58, 73, 119, + 76, 117, 144, 144, 77, 75, 135, 93, 31, 33, + 108, 37, 93, 105, 119, 42, 46, 113, 100, 33, + 149, 149, 67, 62, 119, 47, 48, 145, 146, 147, + 149, 149, 101, 32, 109, 110, 111, 96, 30, 39, + 119, 149, 119, 31, 118, 119, 33, 149, 53, 139, + 139, 27, 28, 54, 149, 147, 147, 77, 75, 117, + 92, 95, 96, 92, 119, 31, 112, 110, 108, 93, + 68, 106, 149, 149, 75, 45, 139, 149, 62, 62, + 62, 139, 117, 117, 145, 33, 92, 33, 34, 5, + 33, 58, 119, 149, 94, 93, 118, 144, 76, 76, + 25, 26, 5, 93, 30, 93, 113, 149, 146, 146, + 93, 58, 92, 77, 77, 33, 149, 149, 67, 92, + 92, 33, 33, 67, 67 }; /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ static const yytype_uint8 yyr1[] = { - 0, 87, 88, 89, 89, 90, 90, 90, 91, 91, - 92, 92, 93, 94, 94, 94, 94, 94, 95, 95, - 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, - 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, - 95, 96, 96, 97, 97, 98, 98, 98, 99, 99, - 100, 100, 101, 102, 102, 103, 103, 104, 104, 105, - 105, 105, 106, 106, 107, 107, 108, 108, 109, 110, - 110, 111, 111, 111, 112, 112, 113, 113, 114, 114, - 114, 115, 115, 116, 116, 117, 117, 118, 118, 119, - 119, 120, 120, 121, 121, 122, 122, 123, 123, 123, - 123, 123, 123, 123, 123, 124, 124, 125, 125, 125, - 126, 126, 127, 127, 128, 128, 128, 129, 129, 130, + 0, 87, 88, 88, 89, 89, 90, 90, 90, 91, + 91, 92, 92, 92, 93, 93, 94, 94, 95, 96, + 96, 96, 96, 96, 97, 97, 97, 97, 97, 97, + 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, + 97, 97, 97, 97, 97, 97, 97, 98, 98, 99, + 99, 100, 100, 100, 101, 101, 102, 102, 103, 104, + 104, 105, 105, 106, 106, 107, 107, 107, 108, 108, + 109, 109, 110, 110, 111, 112, 112, 113, 113, 113, + 114, 114, 115, 115, 116, 116, 116, 117, 117, 118, + 118, 119, 119, 120, 120, 121, 121, 122, 122, 123, + 123, 124, 124, 125, 125, 125, 125, 125, 125, 125, + 125, 126, 126, 127, 127, 127, 128, 128, 129, 129, 130, 130, 130, 131, 131, 132, 132, 132, 132, 132, - 132, 132, 133, 133, 133, 133, 134, 134, 134, 135, - 135, 136, 137, 137, 137, 137, 137, 138, 138, 138, - 139, 139, 140, 140, 141, 141, 141, 142, 142, 143, - 143, 144, 144, 144, 145, 145, 146, 146, 146, 146 + 133, 133, 134, 134, 134, 134, 134, 134, 134, 135, + 135, 135, 136, 136, 137, 137, 138, 139, 139, 139, + 139, 139, 139, 139, 139, 139, 140, 140, 140, 141, + 141, 142, 142, 143, 143, 143, 144, 144, 145, 145, + 146, 146, 146, 147, 147, 147, 147, 147, 147, 148, + 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, + 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, + 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, + 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, + 148, 148, 148, 148, 148, 148, 148, 148, 148, 149, + 149, 149, 149 }; /* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN. */ static const yytype_uint8 yyr2[] = { - 0, 2, 3, 0, 3, 0, 2, 2, 0, 1, - 1, 2, 2, 1, 2, 1, 3, 2, 2, 3, - 4, 2, 1, 5, 6, 6, 4, 1, 2, 2, - 2, 2, 2, 5, 1, 4, 4, 2, 10, 8, - 7, 1, 3, 1, 3, 1, 4, 2, 1, 3, - 1, 3, 3, 1, 2, 1, 1, 0, 2, 9, - 5, 7, 0, 2, 0, 1, 1, 2, 5, 0, - 3, 0, 4, 5, 1, 3, 1, 1, 1, 3, - 2, 0, 1, 1, 3, 1, 3, 1, 3, 1, - 3, 1, 3, 1, 3, 1, 2, 1, 3, 3, - 3, 3, 3, 3, 3, 1, 3, 1, 3, 3, - 1, 3, 1, 3, 1, 3, 3, 1, 3, 1, - 1, 2, 2, 1, 2, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 3, - 1, 7, 0, 3, 4, 4, 3, 9, 11, 11, - 8, 8, 0, 1, 2, 1, 1, 1, 3, 1, - 3, 2, 3, 3, 1, 1, 1, 1, 2, 2 + 0, 2, 3, 3, 0, 3, 0, 2, 2, 0, + 2, 0, 1, 2, 0, 1, 1, 2, 2, 1, + 2, 1, 3, 2, 2, 3, 4, 2, 1, 5, + 6, 6, 4, 1, 2, 2, 2, 2, 2, 5, + 1, 4, 4, 2, 10, 8, 7, 1, 3, 1, + 3, 1, 4, 2, 1, 3, 1, 3, 3, 1, + 2, 1, 1, 0, 2, 9, 5, 7, 0, 2, + 0, 1, 1, 2, 5, 0, 3, 0, 4, 5, + 1, 3, 1, 1, 1, 3, 2, 0, 1, 1, + 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, + 3, 1, 2, 1, 3, 3, 3, 3, 3, 3, + 3, 1, 3, 1, 3, 3, 1, 3, 1, 3, + 1, 3, 3, 1, 3, 1, 1, 2, 2, 2, + 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 3, 1, 7, 0, 1, 3, + 2, 4, 2, 4, 1, 3, 9, 11, 11, 8, + 8, 0, 1, 2, 1, 1, 1, 3, 1, 3, + 2, 3, 3, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 2, 2 }; @@ -1047,22 +1149,22 @@ static const yytype_uint8 yyr2[] = #define YYRECOVERING() (!!yyerrstatus) -#define YYBACKUP(Token, Value) \ -do \ - if (yychar == YYEMPTY) \ - { \ - yychar = (Token); \ - yylval = (Value); \ - YYPOPSTACK (yylen); \ - yystate = *yyssp; \ - goto yybackup; \ - } \ - else \ - { \ - yyerror (ctx, YY_("syntax error: cannot back up")); \ - YYERROR; \ - } \ -while (0) +#define YYBACKUP(Token, Value) \ + do \ + if (yychar == YYEMPTY) \ + { \ + yychar = (Token); \ + yylval = (Value); \ + YYPOPSTACK (yylen); \ + yystate = *yyssp; \ + goto yybackup; \ + } \ + else \ + { \ + yyerror (ctx, YY_("syntax error: cannot back up")); \ + YYERROR; \ + } \ + while (0) /* Error token number */ #define YYTERROR 1 @@ -1102,38 +1204,38 @@ do { \ } while (0) -/*----------------------------------------. -| Print this symbol's value on YYOUTPUT. | -`----------------------------------------*/ +/*-----------------------------------. +| Print this symbol's value on YYO. | +`-----------------------------------*/ static void -yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, parser_ctx_t *ctx) +yy_symbol_value_print (FILE *yyo, int yytype, YYSTYPE const * const yyvaluep, parser_ctx_t *ctx) { - FILE *yyo = yyoutput; - YYUSE (yyo); + FILE *yyoutput = yyo; + YYUSE (yyoutput); YYUSE (ctx); if (!yyvaluep) return; # ifdef YYPRINT if (yytype < YYNTOKENS) - YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep); + YYPRINT (yyo, yytoknum[yytype], *yyvaluep); # endif YYUSE (yytype); } -/*--------------------------------. -| Print this symbol on YYOUTPUT. | -`--------------------------------*/ +/*---------------------------. +| Print this symbol on YYO. | +`---------------------------*/ static void -yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, parser_ctx_t *ctx) +yy_symbol_print (FILE *yyo, int yytype, YYSTYPE const * const yyvaluep, parser_ctx_t *ctx) { - YYFPRINTF (yyoutput, "%s %s (", + YYFPRINTF (yyo, "%s %s (", yytype < YYNTOKENS ? "token" : "nterm", yytname[yytype]); - yy_symbol_value_print (yyoutput, yytype, yyvaluep, ctx); - YYFPRINTF (yyoutput, ")"); + yy_symbol_value_print (yyo, yytype, yyvaluep, ctx); + YYFPRINTF (yyo, ")"); } /*------------------------------------------------------------------. @@ -1167,7 +1269,7 @@ do { \ static void yy_reduce_print (yytype_int16 *yyssp, YYSTYPE *yyvsp, int yyrule, parser_ctx_t *ctx) { - unsigned long int yylno = yyrline[yyrule]; + unsigned long yylno = yyrline[yyrule]; int yynrhs = yyr2[yyrule]; int yyi; YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n", @@ -1178,7 +1280,7 @@ yy_reduce_print (yytype_int16 *yyssp, YYSTYPE *yyvsp, int yyrule, parser_ctx_t * YYFPRINTF (stderr, " $%d = ", yyi + 1); yy_symbol_print (stderr, yystos[yyssp[yyi + 1 - yynrhs]], - &(yyvsp[(yyi + 1) - (yynrhs)]) + &yyvsp[(yyi + 1) - (yynrhs)] , ctx); YYFPRINTF (stderr, "\n"); } @@ -1282,7 +1384,10 @@ yytnamerr (char *yyres, const char *yystr) case '\\': if (*++yyp != '\\') goto do_not_strip_quotes; - /* Fall through. */ + else + goto append; + + append: default: if (yyres) yyres[yyn] = *yyp; @@ -1300,7 +1405,7 @@ yytnamerr (char *yyres, const char *yystr) if (! yyres) return yystrlen (yystr); - return yystpcpy (yyres, yystr) - yyres; + return (YYSIZE_T) (yystpcpy (yyres, yystr) - yyres); } # endif @@ -1316,11 +1421,11 @@ static int yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg, yytype_int16 *yyssp, int yytoken) { - YYSIZE_T yysize0 = yytnamerr (YY_NULL, yytname[yytoken]); + YYSIZE_T yysize0 = yytnamerr (YY_NULLPTR, yytname[yytoken]); YYSIZE_T yysize = yysize0; enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; /* Internationalized format string. */ - const char *yyformat = YY_NULL; + const char *yyformat = YY_NULLPTR; /* Arguments of yyformat. */ char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; /* Number of reported tokens (one for the "unexpected", one per @@ -1377,11 +1482,11 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg, } yyarg[yycount++] = yytname[yyx]; { - YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULL, yytname[yyx]); - if (! (yysize <= yysize1 - && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) + YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULLPTR, yytname[yyx]); + if (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM) + yysize = yysize1; + else return 2; - yysize = yysize1; } } } @@ -1393,6 +1498,7 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg, case N: \ yyformat = S; \ break + default: /* Avoid compiler warnings. */ YYCASE_(0, YY_("syntax error")); YYCASE_(1, YY_("syntax error, unexpected %s")); YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s")); @@ -1404,9 +1510,10 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg, { YYSIZE_T yysize1 = yysize + yystrlen (yyformat); - if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) + if (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM) + yysize = yysize1; + else return 2; - yysize = yysize1; } if (*yymsg_alloc < yysize) @@ -1537,23 +1644,33 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); yychar = YYEMPTY; /* Cause a token to be read. */ goto yysetstate; + /*------------------------------------------------------------. -| yynewstate -- Push a new state, which is found in yystate. | +| yynewstate -- push a new state, which is found in yystate. | `------------------------------------------------------------*/ - yynewstate: +yynewstate: /* In all cases, when you get here, the value and location stacks have just been pushed. So pushing a state here evens the stacks. */ yyssp++; - yysetstate: - *yyssp = yystate; + +/*--------------------------------------------------------------------. +| yynewstate -- set current state (the top of the stack) to yystate. | +`--------------------------------------------------------------------*/ +yysetstate: + YYDPRINTF ((stderr, "Entering state %d\n", yystate)); + YY_ASSERT (0 <= yystate && yystate < YYNSTATES); + *yyssp = (yytype_int16) yystate; if (yyss + yystacksize - 1 <= yyssp) +#if !defined yyoverflow && !defined YYSTACK_RELOCATE + goto yyexhaustedlab; +#else { /* Get the current used size of the three stacks, in elements. */ - YYSIZE_T yysize = yyssp - yyss + 1; + YYSIZE_T yysize = (YYSIZE_T) (yyssp - yyss + 1); -#ifdef yyoverflow +# if defined yyoverflow { /* Give user a chance to reallocate the stack. Use copies of these so that the &'s don't force the real ones into @@ -1569,14 +1686,10 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); &yyss1, yysize * sizeof (*yyssp), &yyvs1, yysize * sizeof (*yyvsp), &yystacksize); - yyss = yyss1; yyvs = yyvs1; } -#else /* no yyoverflow */ -# ifndef YYSTACK_RELOCATE - goto yyexhaustedlab; -# else +# else /* defined YYSTACK_RELOCATE */ /* Extend the stack our own way. */ if (YYMAXDEPTH <= yystacksize) goto yyexhaustedlab; @@ -1592,35 +1705,33 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); goto yyexhaustedlab; YYSTACK_RELOCATE (yyss_alloc, yyss); YYSTACK_RELOCATE (yyvs_alloc, yyvs); -# undef YYSTACK_RELOCATE +# undef YYSTACK_RELOCATE if (yyss1 != yyssa) YYSTACK_FREE (yyss1); } # endif -#endif /* no yyoverflow */ yyssp = yyss + yysize - 1; yyvsp = yyvs + yysize - 1; YYDPRINTF ((stderr, "Stack size increased to %lu\n", - (unsigned long int) yystacksize)); + (unsigned long) yystacksize)); if (yyss + yystacksize - 1 <= yyssp) YYABORT; } - - YYDPRINTF ((stderr, "Entering state %d\n", yystate)); +#endif /* !defined yyoverflow && !defined YYSTACK_RELOCATE */ if (yystate == YYFINAL) YYACCEPT; goto yybackup; + /*-----------. | yybackup. | `-----------*/ yybackup: - /* Do appropriate processing given the current state. Read a lookahead token if we need one and don't already have one. */ @@ -1678,7 +1789,6 @@ yybackup: YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN *++yyvsp = yylval; YY_IGNORE_MAYBE_UNINITIALIZED_END - goto yynewstate; @@ -1693,7 +1803,7 @@ yydefault: /*-----------------------------. -| yyreduce -- Do a reduction. | +| yyreduce -- do a reduction. | `-----------------------------*/ yyreduce: /* yyn is the number of a rule to reduce with. */ @@ -1713,965 +1823,1345 @@ yyreduce: YY_REDUCE_PRINT (yyn); switch (yyn) { - case 2: -#line 147 "parser.y" /* yacc.c:1646 */ + case 2: +#line 148 "parser.y" { parse_complete(ctx, (yyvsp[-2].boolean)); } -#line 1720 "parser.tab.c" /* yacc.c:1646 */ +#line 1830 "parser.tab.c" break; case 3: -#line 150 "parser.y" /* yacc.c:1646 */ - { (yyval.boolean) = FALSE; } -#line 1726 "parser.tab.c" /* yacc.c:1646 */ +#line 149 "parser.y" + { handle_isexpression_script(ctx, (yyvsp[-1].expression)); } +#line 1836 "parser.tab.c" break; case 4: -#line 151 "parser.y" /* yacc.c:1646 */ - { (yyval.boolean) = TRUE; } -#line 1732 "parser.tab.c" /* yacc.c:1646 */ +#line 152 "parser.y" + { (yyval.boolean) = FALSE; } +#line 1842 "parser.tab.c" break; - case 6: -#line 155 "parser.y" /* yacc.c:1646 */ - { source_add_statement(ctx, (yyvsp[0].statement)); } -#line 1738 "parser.tab.c" /* yacc.c:1646 */ + case 5: +#line 153 "parser.y" + { (yyval.boolean) = TRUE; } +#line 1848 "parser.tab.c" break; case 7: -#line 156 "parser.y" /* yacc.c:1646 */ - { source_add_class(ctx, (yyvsp[0].class_decl)); } -#line 1744 "parser.tab.c" /* yacc.c:1646 */ +#line 157 "parser.y" + { source_add_statement(ctx, (yyvsp[0].statement)); } +#line 1854 "parser.tab.c" break; case 8: -#line 159 "parser.y" /* yacc.c:1646 */ - { (yyval.statement) = NULL; } -#line 1750 "parser.tab.c" /* yacc.c:1646 */ +#line 158 "parser.y" + { source_add_class(ctx, (yyvsp[0].class_decl)); } +#line 1860 "parser.tab.c" break; case 9: -#line 160 "parser.y" /* yacc.c:1646 */ - { (yyval.statement) = (yyvsp[0].statement); } -#line 1756 "parser.tab.c" /* yacc.c:1646 */ +#line 161 "parser.y" + { (yyval.expression) = NULL; } +#line 1866 "parser.tab.c" break; case 10: -#line 163 "parser.y" /* yacc.c:1646 */ - { (yyval.statement) = (yyvsp[0].statement); } -#line 1762 "parser.tab.c" /* yacc.c:1646 */ +#line 162 "parser.y" + { (yyval.expression) = (yyvsp[-1].expression); } +#line 1872 "parser.tab.c" break; case 11: -#line 164 "parser.y" /* yacc.c:1646 */ - { (yyval.statement) = link_statements((yyvsp[-1].statement), (yyvsp[0].statement)); } -#line 1768 "parser.tab.c" /* yacc.c:1646 */ +#line 165 "parser.y" + { (yyval.statement) = NULL; } +#line 1878 "parser.tab.c" break; case 12: -#line 167 "parser.y" /* yacc.c:1646 */ - { (yyval.statement) = (yyvsp[-1].statement); } -#line 1774 "parser.tab.c" /* yacc.c:1646 */ +#line 166 "parser.y" + { (yyval.statement) = (yyvsp[0].statement); } +#line 1884 "parser.tab.c" break; case 13: -#line 170 "parser.y" /* yacc.c:1646 */ - { (yyval.statement) = NULL; } -#line 1780 "parser.tab.c" /* yacc.c:1646 */ +#line 167 "parser.y" + { (yyval.statement) = link_statements((yyvsp[-1].statement), (yyvsp[0].statement)); } +#line 1890 "parser.tab.c" break; case 14: -#line 171 "parser.y" /* yacc.c:1646 */ - { (yyval.statement) = (yyvsp[0].statement); } -#line 1786 "parser.tab.c" /* yacc.c:1646 */ +#line 170 "parser.y" + { (yyval.statement) = NULL; } +#line 1896 "parser.tab.c" break; case 15: -#line 172 "parser.y" /* yacc.c:1646 */ +#line 171 "parser.y" { (yyval.statement) = (yyvsp[0].statement); } -#line 1792 "parser.tab.c" /* yacc.c:1646 */ +#line 1902 "parser.tab.c" break; case 16: -#line 173 "parser.y" /* yacc.c:1646 */ - { (yyvsp[-2].statement)->next = (yyvsp[0].statement); (yyval.statement) = (yyvsp[-2].statement); } -#line 1798 "parser.tab.c" /* yacc.c:1646 */ +#line 174 "parser.y" + { (yyval.statement) = (yyvsp[0].statement); } +#line 1908 "parser.tab.c" break; case 17: -#line 174 "parser.y" /* yacc.c:1646 */ - { (yyval.statement) = (yyvsp[-1].statement); } -#line 1804 "parser.tab.c" /* yacc.c:1646 */ +#line 175 "parser.y" + { (yyval.statement) = link_statements((yyvsp[-1].statement), (yyvsp[0].statement)); } +#line 1914 "parser.tab.c" break; case 18: -#line 177 "parser.y" /* yacc.c:1646 */ - { (yyvsp[-1].member)->args = (yyvsp[0].expression); (yyval.statement) = new_call_statement(ctx, FALSE, (yyvsp[-1].member)); CHECK_ERROR; } -#line 1810 "parser.tab.c" /* yacc.c:1646 */ +#line 178 "parser.y" + { (yyval.statement) = (yyvsp[-1].statement); } +#line 1920 "parser.tab.c" break; case 19: -#line 178 "parser.y" /* yacc.c:1646 */ - { (yyvsp[-1].member)->args = (yyvsp[0].expression); (yyval.statement) = new_call_statement(ctx, TRUE, (yyvsp[-1].member)); CHECK_ERROR; } -#line 1816 "parser.tab.c" /* yacc.c:1646 */ +#line 181 "parser.y" + { (yyval.statement) = NULL; } +#line 1926 "parser.tab.c" break; case 20: -#line 180 "parser.y" /* yacc.c:1646 */ - { (yyvsp[-3].member)->args = (yyvsp[-2].expression); (yyval.statement) = new_assign_statement(ctx, (yyvsp[-3].member), (yyvsp[0].expression)); CHECK_ERROR; } -#line 1822 "parser.tab.c" /* yacc.c:1646 */ +#line 182 "parser.y" + { (yyval.statement) = (yyvsp[0].statement); } +#line 1932 "parser.tab.c" break; case 21: -#line 181 "parser.y" /* yacc.c:1646 */ - { (yyval.statement) = new_dim_statement(ctx, (yyvsp[0].dim_decl)); CHECK_ERROR; } -#line 1828 "parser.tab.c" /* yacc.c:1646 */ +#line 183 "parser.y" + { (yyval.statement) = (yyvsp[0].statement); } +#line 1938 "parser.tab.c" break; case 22: -#line 182 "parser.y" /* yacc.c:1646 */ - { (yyval.statement) = (yyvsp[0].statement); } -#line 1834 "parser.tab.c" /* yacc.c:1646 */ +#line 184 "parser.y" + { (yyvsp[-2].statement)->next = (yyvsp[0].statement); (yyval.statement) = (yyvsp[-2].statement); } +#line 1944 "parser.tab.c" break; case 23: -#line 184 "parser.y" /* yacc.c:1646 */ - { (yyval.statement) = new_while_statement(ctx, STAT_WHILE, (yyvsp[-3].expression), (yyvsp[-1].statement)); CHECK_ERROR; } -#line 1840 "parser.tab.c" /* yacc.c:1646 */ +#line 185 "parser.y" + { (yyval.statement) = (yyvsp[-1].statement); } +#line 1950 "parser.tab.c" break; case 24: -#line 186 "parser.y" /* yacc.c:1646 */ - { (yyval.statement) = new_while_statement(ctx, (yyvsp[-4].boolean) ? STAT_WHILELOOP : STAT_UNTIL, (yyvsp[-3].expression), (yyvsp[-1].statement)); - CHECK_ERROR; } -#line 1847 "parser.tab.c" /* yacc.c:1646 */ +#line 188 "parser.y" + { (yyvsp[-1].member)->args = (yyvsp[0].expression); (yyval.statement) = new_call_statement(ctx, FALSE, (yyvsp[-1].member)); CHECK_ERROR; } +#line 1956 "parser.tab.c" break; case 25: -#line 189 "parser.y" /* yacc.c:1646 */ - { (yyval.statement) = new_while_statement(ctx, (yyvsp[-1].boolean) ? STAT_DOWHILE : STAT_DOUNTIL, (yyvsp[0].expression), (yyvsp[-3].statement)); - CHECK_ERROR; } -#line 1854 "parser.tab.c" /* yacc.c:1646 */ +#line 189 "parser.y" + { (yyvsp[-1].member)->args = (yyvsp[0].expression); (yyval.statement) = new_call_statement(ctx, TRUE, (yyvsp[-1].member)); CHECK_ERROR; } +#line 1962 "parser.tab.c" break; case 26: -#line 191 "parser.y" /* yacc.c:1646 */ - { (yyval.statement) = new_while_statement(ctx, STAT_DOWHILE, NULL, (yyvsp[-1].statement)); CHECK_ERROR; } -#line 1860 "parser.tab.c" /* yacc.c:1646 */ +#line 191 "parser.y" + { (yyvsp[-3].member)->args = (yyvsp[-2].expression); (yyval.statement) = new_assign_statement(ctx, (yyvsp[-3].member), (yyvsp[0].expression)); CHECK_ERROR; } +#line 1968 "parser.tab.c" break; case 27: -#line 192 "parser.y" /* yacc.c:1646 */ - { (yyval.statement) = new_function_statement(ctx, (yyvsp[0].func_decl)); CHECK_ERROR; } -#line 1866 "parser.tab.c" /* yacc.c:1646 */ +#line 192 "parser.y" + { (yyval.statement) = new_dim_statement(ctx, (yyvsp[0].dim_decl)); CHECK_ERROR; } +#line 1974 "parser.tab.c" break; case 28: -#line 193 "parser.y" /* yacc.c:1646 */ - { (yyval.statement) = new_statement(ctx, STAT_EXITDO, 0); CHECK_ERROR; } -#line 1872 "parser.tab.c" /* yacc.c:1646 */ +#line 193 "parser.y" + { (yyval.statement) = (yyvsp[0].statement); } +#line 1980 "parser.tab.c" break; case 29: -#line 194 "parser.y" /* yacc.c:1646 */ - { (yyval.statement) = new_statement(ctx, STAT_EXITFOR, 0); CHECK_ERROR; } -#line 1878 "parser.tab.c" /* yacc.c:1646 */ +#line 195 "parser.y" + { (yyval.statement) = new_while_statement(ctx, STAT_WHILE, (yyvsp[-3].expression), (yyvsp[-1].statement)); CHECK_ERROR; } +#line 1986 "parser.tab.c" break; case 30: -#line 195 "parser.y" /* yacc.c:1646 */ - { (yyval.statement) = new_statement(ctx, STAT_EXITFUNC, 0); CHECK_ERROR; } -#line 1884 "parser.tab.c" /* yacc.c:1646 */ +#line 197 "parser.y" + { (yyval.statement) = new_while_statement(ctx, (yyvsp[-4].boolean) ? STAT_WHILELOOP : STAT_UNTIL, (yyvsp[-3].expression), (yyvsp[-1].statement)); + CHECK_ERROR; } +#line 1993 "parser.tab.c" break; case 31: -#line 196 "parser.y" /* yacc.c:1646 */ - { (yyval.statement) = new_statement(ctx, STAT_EXITPROP, 0); CHECK_ERROR; } -#line 1890 "parser.tab.c" /* yacc.c:1646 */ +#line 200 "parser.y" + { (yyval.statement) = new_while_statement(ctx, (yyvsp[-1].boolean) ? STAT_DOWHILE : STAT_DOUNTIL, (yyvsp[0].expression), (yyvsp[-3].statement)); + CHECK_ERROR; } +#line 2000 "parser.tab.c" break; case 32: -#line 197 "parser.y" /* yacc.c:1646 */ - { (yyval.statement) = new_statement(ctx, STAT_EXITSUB, 0); CHECK_ERROR; } -#line 1896 "parser.tab.c" /* yacc.c:1646 */ +#line 202 "parser.y" + { (yyval.statement) = new_while_statement(ctx, STAT_DOWHILE, NULL, (yyvsp[-1].statement)); CHECK_ERROR; } +#line 2006 "parser.tab.c" break; case 33: -#line 199 "parser.y" /* yacc.c:1646 */ - { (yyvsp[-3].member)->args = (yyvsp[-2].expression); (yyval.statement) = new_set_statement(ctx, (yyvsp[-3].member), (yyvsp[0].expression)); CHECK_ERROR; } -#line 1902 "parser.tab.c" /* yacc.c:1646 */ +#line 203 "parser.y" + { (yyval.statement) = new_function_statement(ctx, (yyvsp[0].func_decl)); CHECK_ERROR; } +#line 2012 "parser.tab.c" break; case 34: -#line 200 "parser.y" /* yacc.c:1646 */ - { (yyval.statement) = new_statement(ctx, STAT_STOP, 0); CHECK_ERROR; } -#line 1908 "parser.tab.c" /* yacc.c:1646 */ +#line 204 "parser.y" + { (yyval.statement) = new_statement(ctx, STAT_EXITDO, 0); CHECK_ERROR; } +#line 2018 "parser.tab.c" break; case 35: -#line 201 "parser.y" /* yacc.c:1646 */ - { (yyval.statement) = new_onerror_statement(ctx, TRUE); CHECK_ERROR; } -#line 1914 "parser.tab.c" /* yacc.c:1646 */ +#line 205 "parser.y" + { (yyval.statement) = new_statement(ctx, STAT_EXITFOR, 0); CHECK_ERROR; } +#line 2024 "parser.tab.c" break; case 36: -#line 202 "parser.y" /* yacc.c:1646 */ - { (yyval.statement) = new_onerror_statement(ctx, FALSE); CHECK_ERROR; } -#line 1920 "parser.tab.c" /* yacc.c:1646 */ +#line 206 "parser.y" + { (yyval.statement) = new_statement(ctx, STAT_EXITFUNC, 0); CHECK_ERROR; } +#line 2030 "parser.tab.c" break; case 37: -#line 203 "parser.y" /* yacc.c:1646 */ - { (yyval.statement) = new_const_statement(ctx, (yyvsp[0].const_decl)); CHECK_ERROR; } -#line 1926 "parser.tab.c" /* yacc.c:1646 */ +#line 207 "parser.y" + { (yyval.statement) = new_statement(ctx, STAT_EXITPROP, 0); CHECK_ERROR; } +#line 2036 "parser.tab.c" break; case 38: -#line 205 "parser.y" /* yacc.c:1646 */ - { (yyval.statement) = new_forto_statement(ctx, (yyvsp[-8].string), (yyvsp[-6].expression), (yyvsp[-4].expression), (yyvsp[-3].expression), (yyvsp[-1].statement)); CHECK_ERROR; } -#line 1932 "parser.tab.c" /* yacc.c:1646 */ +#line 208 "parser.y" + { (yyval.statement) = new_statement(ctx, STAT_EXITSUB, 0); CHECK_ERROR; } +#line 2042 "parser.tab.c" break; case 39: -#line 207 "parser.y" /* yacc.c:1646 */ - { (yyval.statement) = new_foreach_statement(ctx, (yyvsp[-5].string), (yyvsp[-3].expression), (yyvsp[-1].statement)); } -#line 1938 "parser.tab.c" /* yacc.c:1646 */ +#line 210 "parser.y" + { (yyvsp[-3].member)->args = (yyvsp[-2].expression); (yyval.statement) = new_set_statement(ctx, (yyvsp[-3].member), (yyvsp[0].expression)); CHECK_ERROR; } +#line 2048 "parser.tab.c" break; case 40: -#line 209 "parser.y" /* yacc.c:1646 */ - { (yyval.statement) = new_select_statement(ctx, (yyvsp[-4].expression), (yyvsp[-2].case_clausule)); } -#line 1944 "parser.tab.c" /* yacc.c:1646 */ +#line 211 "parser.y" + { (yyval.statement) = new_statement(ctx, STAT_STOP, 0); CHECK_ERROR; } +#line 2054 "parser.tab.c" break; case 41: -#line 212 "parser.y" /* yacc.c:1646 */ - { (yyval.member) = new_member_expression(ctx, NULL, (yyvsp[0].string)); CHECK_ERROR; } -#line 1950 "parser.tab.c" /* yacc.c:1646 */ +#line 212 "parser.y" + { (yyval.statement) = new_onerror_statement(ctx, TRUE); CHECK_ERROR; } +#line 2060 "parser.tab.c" break; case 42: -#line 213 "parser.y" /* yacc.c:1646 */ - { (yyval.member) = new_member_expression(ctx, (yyvsp[-2].expression), (yyvsp[0].string)); CHECK_ERROR; } -#line 1956 "parser.tab.c" /* yacc.c:1646 */ +#line 213 "parser.y" + { (yyval.statement) = new_onerror_statement(ctx, FALSE); CHECK_ERROR; } +#line 2066 "parser.tab.c" break; case 43: -#line 216 "parser.y" /* yacc.c:1646 */ - { (yyval.dim_decl) = (yyvsp[0].dim_decl); } -#line 1962 "parser.tab.c" /* yacc.c:1646 */ +#line 214 "parser.y" + { (yyval.statement) = new_const_statement(ctx, (yyvsp[0].const_decl)); CHECK_ERROR; } +#line 2072 "parser.tab.c" break; case 44: -#line 217 "parser.y" /* yacc.c:1646 */ - { (yyvsp[-2].dim_decl)->next = (yyvsp[0].dim_decl); (yyval.dim_decl) = (yyvsp[-2].dim_decl); } -#line 1968 "parser.tab.c" /* yacc.c:1646 */ +#line 216 "parser.y" + { (yyval.statement) = new_forto_statement(ctx, (yyvsp[-8].string), (yyvsp[-6].expression), (yyvsp[-4].expression), (yyvsp[-3].expression), (yyvsp[-1].statement)); CHECK_ERROR; } +#line 2078 "parser.tab.c" break; case 45: -#line 220 "parser.y" /* yacc.c:1646 */ - { (yyval.dim_decl) = new_dim_decl(ctx, (yyvsp[0].string), FALSE, NULL); CHECK_ERROR; } -#line 1974 "parser.tab.c" /* yacc.c:1646 */ +#line 218 "parser.y" + { (yyval.statement) = new_foreach_statement(ctx, (yyvsp[-5].string), (yyvsp[-3].expression), (yyvsp[-1].statement)); } +#line 2084 "parser.tab.c" break; case 46: -#line 221 "parser.y" /* yacc.c:1646 */ - { (yyval.dim_decl) = new_dim_decl(ctx, (yyvsp[-3].string), TRUE, (yyvsp[-1].dim_list)); CHECK_ERROR; } -#line 1980 "parser.tab.c" /* yacc.c:1646 */ +#line 220 "parser.y" + { (yyval.statement) = new_select_statement(ctx, (yyvsp[-4].expression), (yyvsp[-2].case_clausule)); } +#line 2090 "parser.tab.c" break; case 47: -#line 222 "parser.y" /* yacc.c:1646 */ - { (yyval.dim_decl) = new_dim_decl(ctx, (yyvsp[-1].string), TRUE, NULL); CHECK_ERROR; } -#line 1986 "parser.tab.c" /* yacc.c:1646 */ +#line 223 "parser.y" + { (yyval.member) = new_member_expression(ctx, NULL, (yyvsp[0].string)); CHECK_ERROR; } +#line 2096 "parser.tab.c" break; case 48: -#line 225 "parser.y" /* yacc.c:1646 */ - { (yyval.dim_list) = new_dim(ctx, (yyvsp[0].uint), NULL); } -#line 1992 "parser.tab.c" /* yacc.c:1646 */ +#line 224 "parser.y" + { (yyval.member) = new_member_expression(ctx, (yyvsp[-2].expression), (yyvsp[0].string)); CHECK_ERROR; } +#line 2102 "parser.tab.c" break; case 49: -#line 226 "parser.y" /* yacc.c:1646 */ - { (yyval.dim_list) = new_dim(ctx, (yyvsp[-2].uint), (yyvsp[0].dim_list)); } -#line 1998 "parser.tab.c" /* yacc.c:1646 */ +#line 227 "parser.y" + { (yyval.dim_decl) = (yyvsp[0].dim_decl); } +#line 2108 "parser.tab.c" break; case 50: -#line 229 "parser.y" /* yacc.c:1646 */ - { (yyval.const_decl) = (yyvsp[0].const_decl); } -#line 2004 "parser.tab.c" /* yacc.c:1646 */ +#line 228 "parser.y" + { (yyvsp[-2].dim_decl)->next = (yyvsp[0].dim_decl); (yyval.dim_decl) = (yyvsp[-2].dim_decl); } +#line 2114 "parser.tab.c" break; case 51: -#line 230 "parser.y" /* yacc.c:1646 */ - { (yyvsp[-2].const_decl)->next = (yyvsp[0].const_decl); (yyval.const_decl) = (yyvsp[-2].const_decl); } -#line 2010 "parser.tab.c" /* yacc.c:1646 */ +#line 231 "parser.y" + { (yyval.dim_decl) = new_dim_decl(ctx, (yyvsp[0].string), FALSE, NULL); CHECK_ERROR; } +#line 2120 "parser.tab.c" break; case 52: -#line 233 "parser.y" /* yacc.c:1646 */ - { (yyval.const_decl) = new_const_decl(ctx, (yyvsp[-2].string), (yyvsp[0].expression)); CHECK_ERROR; } -#line 2016 "parser.tab.c" /* yacc.c:1646 */ +#line 232 "parser.y" + { (yyval.dim_decl) = new_dim_decl(ctx, (yyvsp[-3].string), TRUE, (yyvsp[-1].dim_list)); CHECK_ERROR; } +#line 2126 "parser.tab.c" break; case 53: -#line 236 "parser.y" /* yacc.c:1646 */ - { (yyval.expression) = (yyvsp[0].expression); } -#line 2022 "parser.tab.c" /* yacc.c:1646 */ +#line 233 "parser.y" + { (yyval.dim_decl) = new_dim_decl(ctx, (yyvsp[-1].string), TRUE, NULL); CHECK_ERROR; } +#line 2132 "parser.tab.c" break; case 54: -#line 237 "parser.y" /* yacc.c:1646 */ - { (yyval.expression) = new_unary_expression(ctx, EXPR_NEG, (yyvsp[0].expression)); CHECK_ERROR; } -#line 2028 "parser.tab.c" /* yacc.c:1646 */ +#line 236 "parser.y" + { (yyval.dim_list) = new_dim(ctx, (yyvsp[0].uint), NULL); } +#line 2138 "parser.tab.c" break; case 55: -#line 240 "parser.y" /* yacc.c:1646 */ - { (yyval.boolean) = TRUE; } -#line 2034 "parser.tab.c" /* yacc.c:1646 */ +#line 237 "parser.y" + { (yyval.dim_list) = new_dim(ctx, (yyvsp[-2].uint), (yyvsp[0].dim_list)); } +#line 2144 "parser.tab.c" break; case 56: -#line 241 "parser.y" /* yacc.c:1646 */ - { (yyval.boolean) = FALSE; } -#line 2040 "parser.tab.c" /* yacc.c:1646 */ +#line 240 "parser.y" + { (yyval.const_decl) = (yyvsp[0].const_decl); } +#line 2150 "parser.tab.c" break; case 57: -#line 244 "parser.y" /* yacc.c:1646 */ - { (yyval.expression) = NULL;} -#line 2046 "parser.tab.c" /* yacc.c:1646 */ +#line 241 "parser.y" + { (yyvsp[-2].const_decl)->next = (yyvsp[0].const_decl); (yyval.const_decl) = (yyvsp[-2].const_decl); } +#line 2156 "parser.tab.c" break; case 58: -#line 245 "parser.y" /* yacc.c:1646 */ - { (yyval.expression) = (yyvsp[0].expression); } -#line 2052 "parser.tab.c" /* yacc.c:1646 */ +#line 244 "parser.y" + { (yyval.const_decl) = new_const_decl(ctx, (yyvsp[-2].string), (yyvsp[0].expression)); CHECK_ERROR; } +#line 2162 "parser.tab.c" break; case 59: -#line 249 "parser.y" /* yacc.c:1646 */ - { (yyval.statement) = new_if_statement(ctx, (yyvsp[-7].expression), (yyvsp[-4].statement), (yyvsp[-3].elseif), (yyvsp[-2].statement)); CHECK_ERROR; } -#line 2058 "parser.tab.c" /* yacc.c:1646 */ +#line 247 "parser.y" + { (yyval.expression) = (yyvsp[0].expression); } +#line 2168 "parser.tab.c" break; case 60: -#line 250 "parser.y" /* yacc.c:1646 */ - { (yyval.statement) = new_if_statement(ctx, (yyvsp[-3].expression), (yyvsp[-1].statement), NULL, NULL); CHECK_ERROR; } -#line 2064 "parser.tab.c" /* yacc.c:1646 */ +#line 248 "parser.y" + { (yyval.expression) = new_unary_expression(ctx, EXPR_NEG, (yyvsp[0].expression)); CHECK_ERROR; } +#line 2174 "parser.tab.c" break; case 61: -#line 252 "parser.y" /* yacc.c:1646 */ - { (yyval.statement) = new_if_statement(ctx, (yyvsp[-5].expression), (yyvsp[-3].statement), NULL, (yyvsp[-1].statement)); CHECK_ERROR; } -#line 2070 "parser.tab.c" /* yacc.c:1646 */ +#line 251 "parser.y" + { (yyval.boolean) = TRUE; } +#line 2180 "parser.tab.c" + break; + + case 62: +#line 252 "parser.y" + { (yyval.boolean) = FALSE; } +#line 2186 "parser.tab.c" + break; + + case 63: +#line 255 "parser.y" + { (yyval.expression) = NULL;} +#line 2192 "parser.tab.c" break; case 64: -#line 259 "parser.y" /* yacc.c:1646 */ - { (yyval.elseif) = NULL; } -#line 2076 "parser.tab.c" /* yacc.c:1646 */ +#line 256 "parser.y" + { (yyval.expression) = (yyvsp[0].expression); } +#line 2198 "parser.tab.c" break; case 65: -#line 260 "parser.y" /* yacc.c:1646 */ - { (yyval.elseif) = (yyvsp[0].elseif); } -#line 2082 "parser.tab.c" /* yacc.c:1646 */ +#line 260 "parser.y" + { (yyval.statement) = new_if_statement(ctx, (yyvsp[-7].expression), (yyvsp[-4].statement), (yyvsp[-3].elseif), (yyvsp[-2].statement)); CHECK_ERROR; } +#line 2204 "parser.tab.c" break; case 66: -#line 263 "parser.y" /* yacc.c:1646 */ - { (yyval.elseif) = (yyvsp[0].elseif); } -#line 2088 "parser.tab.c" /* yacc.c:1646 */ +#line 261 "parser.y" + { (yyval.statement) = new_if_statement(ctx, (yyvsp[-3].expression), (yyvsp[-1].statement), NULL, NULL); CHECK_ERROR; } +#line 2210 "parser.tab.c" break; case 67: -#line 264 "parser.y" /* yacc.c:1646 */ - { (yyvsp[-1].elseif)->next = (yyvsp[0].elseif); (yyval.elseif) = (yyvsp[-1].elseif); } -#line 2094 "parser.tab.c" /* yacc.c:1646 */ - break; - - case 68: -#line 268 "parser.y" /* yacc.c:1646 */ - { (yyval.elseif) = new_elseif_decl(ctx, (yyvsp[-3].expression), (yyvsp[0].statement)); } -#line 2100 "parser.tab.c" /* yacc.c:1646 */ - break; - - case 69: -#line 271 "parser.y" /* yacc.c:1646 */ - { (yyval.statement) = NULL; } -#line 2106 "parser.tab.c" /* yacc.c:1646 */ +#line 263 "parser.y" + { (yyval.statement) = new_if_statement(ctx, (yyvsp[-5].expression), (yyvsp[-3].statement), NULL, (yyvsp[-1].statement)); CHECK_ERROR; } +#line 2216 "parser.tab.c" break; case 70: -#line 272 "parser.y" /* yacc.c:1646 */ - { (yyval.statement) = (yyvsp[0].statement); } -#line 2112 "parser.tab.c" /* yacc.c:1646 */ +#line 270 "parser.y" + { (yyval.elseif) = NULL; } +#line 2222 "parser.tab.c" break; case 71: -#line 275 "parser.y" /* yacc.c:1646 */ - { (yyval.case_clausule) = NULL; } -#line 2118 "parser.tab.c" /* yacc.c:1646 */ +#line 271 "parser.y" + { (yyval.elseif) = (yyvsp[0].elseif); } +#line 2228 "parser.tab.c" break; case 72: -#line 276 "parser.y" /* yacc.c:1646 */ - { (yyval.case_clausule) = new_case_clausule(ctx, NULL, (yyvsp[0].statement), NULL); } -#line 2124 "parser.tab.c" /* yacc.c:1646 */ +#line 274 "parser.y" + { (yyval.elseif) = (yyvsp[0].elseif); } +#line 2234 "parser.tab.c" break; case 73: -#line 278 "parser.y" /* yacc.c:1646 */ - { (yyval.case_clausule) = new_case_clausule(ctx, (yyvsp[-3].expression), (yyvsp[-1].statement), (yyvsp[0].case_clausule)); } -#line 2130 "parser.tab.c" /* yacc.c:1646 */ +#line 275 "parser.y" + { (yyvsp[-1].elseif)->next = (yyvsp[0].elseif); (yyval.elseif) = (yyvsp[-1].elseif); } +#line 2240 "parser.tab.c" break; case 74: -#line 281 "parser.y" /* yacc.c:1646 */ - { (yyval.expression) = NULL; } -#line 2136 "parser.tab.c" /* yacc.c:1646 */ +#line 279 "parser.y" + { (yyval.elseif) = new_elseif_decl(ctx, (yyvsp[-3].expression), (yyvsp[0].statement)); } +#line 2246 "parser.tab.c" break; case 75: -#line 282 "parser.y" /* yacc.c:1646 */ - { (yyval.expression) = (yyvsp[-1].expression); } -#line 2142 "parser.tab.c" /* yacc.c:1646 */ +#line 282 "parser.y" + { (yyval.statement) = NULL; } +#line 2252 "parser.tab.c" break; case 76: -#line 285 "parser.y" /* yacc.c:1646 */ - { (yyval.expression) = NULL; } -#line 2148 "parser.tab.c" /* yacc.c:1646 */ +#line 283 "parser.y" + { (yyval.statement) = (yyvsp[0].statement); } +#line 2258 "parser.tab.c" break; case 77: -#line 286 "parser.y" /* yacc.c:1646 */ - { (yyval.expression) = (yyvsp[0].expression); } -#line 2154 "parser.tab.c" /* yacc.c:1646 */ +#line 286 "parser.y" + { (yyval.case_clausule) = NULL; } +#line 2264 "parser.tab.c" break; case 78: -#line 289 "parser.y" /* yacc.c:1646 */ - { (yyval.expression) = (yyvsp[0].expression); } -#line 2160 "parser.tab.c" /* yacc.c:1646 */ +#line 287 "parser.y" + { (yyval.case_clausule) = new_case_clausule(ctx, NULL, (yyvsp[0].statement), NULL); } +#line 2270 "parser.tab.c" break; case 79: -#line 290 "parser.y" /* yacc.c:1646 */ - { (yyvsp[-2].expression)->next = (yyvsp[0].expression); (yyval.expression) = (yyvsp[-2].expression); } -#line 2166 "parser.tab.c" /* yacc.c:1646 */ +#line 289 "parser.y" + { (yyval.case_clausule) = new_case_clausule(ctx, (yyvsp[-3].expression), (yyvsp[-1].statement), (yyvsp[0].case_clausule)); } +#line 2276 "parser.tab.c" break; case 80: -#line 291 "parser.y" /* yacc.c:1646 */ - { (yyval.expression) = new_expression(ctx, EXPR_NOARG, 0); CHECK_ERROR; (yyval.expression)->next = (yyvsp[0].expression); } -#line 2172 "parser.tab.c" /* yacc.c:1646 */ +#line 292 "parser.y" + { (yyval.expression) = NULL; } +#line 2282 "parser.tab.c" + break; + + case 81: +#line 293 "parser.y" + { (yyval.expression) = (yyvsp[-1].expression); } +#line 2288 "parser.tab.c" + break; + + case 82: +#line 296 "parser.y" + { (yyval.expression) = NULL; } +#line 2294 "parser.tab.c" break; case 83: -#line 298 "parser.y" /* yacc.c:1646 */ +#line 297 "parser.y" { (yyval.expression) = (yyvsp[0].expression); } -#line 2178 "parser.tab.c" /* yacc.c:1646 */ +#line 2300 "parser.tab.c" break; case 84: -#line 299 "parser.y" /* yacc.c:1646 */ - { (yyvsp[-2].expression)->next = (yyvsp[0].expression); (yyval.expression) = (yyvsp[-2].expression); } -#line 2184 "parser.tab.c" /* yacc.c:1646 */ +#line 300 "parser.y" + { (yyval.expression) = (yyvsp[0].expression); } +#line 2306 "parser.tab.c" break; case 85: -#line 302 "parser.y" /* yacc.c:1646 */ - { (yyval.expression) = (yyvsp[0].expression); } -#line 2190 "parser.tab.c" /* yacc.c:1646 */ +#line 301 "parser.y" + { (yyvsp[-2].expression)->next = (yyvsp[0].expression); (yyval.expression) = (yyvsp[-2].expression); } +#line 2312 "parser.tab.c" break; case 86: -#line 303 "parser.y" /* yacc.c:1646 */ - { (yyval.expression) = new_binary_expression(ctx, EXPR_IMP, (yyvsp[-2].expression), (yyvsp[0].expression)); CHECK_ERROR; } -#line 2196 "parser.tab.c" /* yacc.c:1646 */ - break; - - case 87: -#line 306 "parser.y" /* yacc.c:1646 */ - { (yyval.expression) = (yyvsp[0].expression); } -#line 2202 "parser.tab.c" /* yacc.c:1646 */ - break; - - case 88: -#line 307 "parser.y" /* yacc.c:1646 */ - { (yyval.expression) = new_binary_expression(ctx, EXPR_EQV, (yyvsp[-2].expression), (yyvsp[0].expression)); CHECK_ERROR; } -#line 2208 "parser.tab.c" /* yacc.c:1646 */ +#line 302 "parser.y" + { (yyval.expression) = new_expression(ctx, EXPR_NOARG, 0); CHECK_ERROR; (yyval.expression)->next = (yyvsp[0].expression); } +#line 2318 "parser.tab.c" break; case 89: -#line 310 "parser.y" /* yacc.c:1646 */ +#line 309 "parser.y" { (yyval.expression) = (yyvsp[0].expression); } -#line 2214 "parser.tab.c" /* yacc.c:1646 */ +#line 2324 "parser.tab.c" break; case 90: -#line 311 "parser.y" /* yacc.c:1646 */ - { (yyval.expression) = new_binary_expression(ctx, EXPR_XOR, (yyvsp[-2].expression), (yyvsp[0].expression)); CHECK_ERROR; } -#line 2220 "parser.tab.c" /* yacc.c:1646 */ +#line 310 "parser.y" + { (yyvsp[-2].expression)->next = (yyvsp[0].expression); (yyval.expression) = (yyvsp[-2].expression); } +#line 2330 "parser.tab.c" break; case 91: -#line 314 "parser.y" /* yacc.c:1646 */ +#line 313 "parser.y" { (yyval.expression) = (yyvsp[0].expression); } -#line 2226 "parser.tab.c" /* yacc.c:1646 */ +#line 2336 "parser.tab.c" break; case 92: -#line 315 "parser.y" /* yacc.c:1646 */ - { (yyval.expression) = new_binary_expression(ctx, EXPR_OR, (yyvsp[-2].expression), (yyvsp[0].expression)); CHECK_ERROR; } -#line 2232 "parser.tab.c" /* yacc.c:1646 */ +#line 314 "parser.y" + { (yyval.expression) = new_binary_expression(ctx, EXPR_IMP, (yyvsp[-2].expression), (yyvsp[0].expression)); CHECK_ERROR; } +#line 2342 "parser.tab.c" break; case 93: -#line 318 "parser.y" /* yacc.c:1646 */ +#line 317 "parser.y" { (yyval.expression) = (yyvsp[0].expression); } -#line 2238 "parser.tab.c" /* yacc.c:1646 */ +#line 2348 "parser.tab.c" break; case 94: -#line 319 "parser.y" /* yacc.c:1646 */ - { (yyval.expression) = new_binary_expression(ctx, EXPR_AND, (yyvsp[-2].expression), (yyvsp[0].expression)); CHECK_ERROR; } -#line 2244 "parser.tab.c" /* yacc.c:1646 */ +#line 318 "parser.y" + { (yyval.expression) = new_binary_expression(ctx, EXPR_EQV, (yyvsp[-2].expression), (yyvsp[0].expression)); CHECK_ERROR; } +#line 2354 "parser.tab.c" break; case 95: -#line 322 "parser.y" /* yacc.c:1646 */ +#line 321 "parser.y" { (yyval.expression) = (yyvsp[0].expression); } -#line 2250 "parser.tab.c" /* yacc.c:1646 */ +#line 2360 "parser.tab.c" break; case 96: -#line 323 "parser.y" /* yacc.c:1646 */ - { (yyval.expression) = new_unary_expression(ctx, EXPR_NOT, (yyvsp[0].expression)); CHECK_ERROR; } -#line 2256 "parser.tab.c" /* yacc.c:1646 */ +#line 322 "parser.y" + { (yyval.expression) = new_binary_expression(ctx, EXPR_XOR, (yyvsp[-2].expression), (yyvsp[0].expression)); CHECK_ERROR; } +#line 2366 "parser.tab.c" break; case 97: -#line 326 "parser.y" /* yacc.c:1646 */ +#line 325 "parser.y" { (yyval.expression) = (yyvsp[0].expression); } -#line 2262 "parser.tab.c" /* yacc.c:1646 */ +#line 2372 "parser.tab.c" break; case 98: -#line 327 "parser.y" /* yacc.c:1646 */ - { (yyval.expression) = new_binary_expression(ctx, EXPR_EQUAL, (yyvsp[-2].expression), (yyvsp[0].expression)); CHECK_ERROR; } -#line 2268 "parser.tab.c" /* yacc.c:1646 */ +#line 326 "parser.y" + { (yyval.expression) = new_binary_expression(ctx, EXPR_OR, (yyvsp[-2].expression), (yyvsp[0].expression)); CHECK_ERROR; } +#line 2378 "parser.tab.c" break; case 99: -#line 328 "parser.y" /* yacc.c:1646 */ - { (yyval.expression) = new_binary_expression(ctx, EXPR_NEQUAL, (yyvsp[-2].expression), (yyvsp[0].expression)); CHECK_ERROR; } -#line 2274 "parser.tab.c" /* yacc.c:1646 */ +#line 329 "parser.y" + { (yyval.expression) = (yyvsp[0].expression); } +#line 2384 "parser.tab.c" break; case 100: -#line 329 "parser.y" /* yacc.c:1646 */ - { (yyval.expression) = new_binary_expression(ctx, EXPR_GT, (yyvsp[-2].expression), (yyvsp[0].expression)); CHECK_ERROR; } -#line 2280 "parser.tab.c" /* yacc.c:1646 */ +#line 330 "parser.y" + { (yyval.expression) = new_binary_expression(ctx, EXPR_AND, (yyvsp[-2].expression), (yyvsp[0].expression)); CHECK_ERROR; } +#line 2390 "parser.tab.c" break; case 101: -#line 330 "parser.y" /* yacc.c:1646 */ - { (yyval.expression) = new_binary_expression(ctx, EXPR_LT, (yyvsp[-2].expression), (yyvsp[0].expression)); CHECK_ERROR; } -#line 2286 "parser.tab.c" /* yacc.c:1646 */ +#line 333 "parser.y" + { (yyval.expression) = (yyvsp[0].expression); } +#line 2396 "parser.tab.c" break; case 102: -#line 331 "parser.y" /* yacc.c:1646 */ - { (yyval.expression) = new_binary_expression(ctx, EXPR_GTEQ, (yyvsp[-2].expression), (yyvsp[0].expression)); CHECK_ERROR; } -#line 2292 "parser.tab.c" /* yacc.c:1646 */ +#line 334 "parser.y" + { (yyval.expression) = new_unary_expression(ctx, EXPR_NOT, (yyvsp[0].expression)); CHECK_ERROR; } +#line 2402 "parser.tab.c" break; case 103: -#line 332 "parser.y" /* yacc.c:1646 */ - { (yyval.expression) = new_binary_expression(ctx, EXPR_LTEQ, (yyvsp[-2].expression), (yyvsp[0].expression)); CHECK_ERROR; } -#line 2298 "parser.tab.c" /* yacc.c:1646 */ +#line 337 "parser.y" + { (yyval.expression) = (yyvsp[0].expression); } +#line 2408 "parser.tab.c" break; case 104: -#line 333 "parser.y" /* yacc.c:1646 */ - { (yyval.expression) = new_binary_expression(ctx, EXPR_IS, (yyvsp[-2].expression), (yyvsp[0].expression)); CHECK_ERROR; } -#line 2304 "parser.tab.c" /* yacc.c:1646 */ +#line 338 "parser.y" + { (yyval.expression) = new_binary_expression(ctx, EXPR_EQUAL, (yyvsp[-2].expression), (yyvsp[0].expression)); CHECK_ERROR; } +#line 2414 "parser.tab.c" break; case 105: -#line 336 "parser.y" /* yacc.c:1646 */ - { (yyval.expression) = (yyvsp[0].expression); } -#line 2310 "parser.tab.c" /* yacc.c:1646 */ +#line 339 "parser.y" + { (yyval.expression) = new_binary_expression(ctx, EXPR_NEQUAL, (yyvsp[-2].expression), (yyvsp[0].expression)); CHECK_ERROR; } +#line 2420 "parser.tab.c" break; case 106: -#line 337 "parser.y" /* yacc.c:1646 */ - { (yyval.expression) = new_binary_expression(ctx, EXPR_CONCAT, (yyvsp[-2].expression), (yyvsp[0].expression)); CHECK_ERROR; } -#line 2316 "parser.tab.c" /* yacc.c:1646 */ +#line 340 "parser.y" + { (yyval.expression) = new_binary_expression(ctx, EXPR_GT, (yyvsp[-2].expression), (yyvsp[0].expression)); CHECK_ERROR; } +#line 2426 "parser.tab.c" break; case 107: -#line 340 "parser.y" /* yacc.c:1646 */ - { (yyval.expression) = (yyvsp[0].expression); } -#line 2322 "parser.tab.c" /* yacc.c:1646 */ +#line 341 "parser.y" + { (yyval.expression) = new_binary_expression(ctx, EXPR_LT, (yyvsp[-2].expression), (yyvsp[0].expression)); CHECK_ERROR; } +#line 2432 "parser.tab.c" break; case 108: -#line 341 "parser.y" /* yacc.c:1646 */ - { (yyval.expression) = new_binary_expression(ctx, EXPR_ADD, (yyvsp[-2].expression), (yyvsp[0].expression)); CHECK_ERROR; } -#line 2328 "parser.tab.c" /* yacc.c:1646 */ +#line 342 "parser.y" + { (yyval.expression) = new_binary_expression(ctx, EXPR_GTEQ, (yyvsp[-2].expression), (yyvsp[0].expression)); CHECK_ERROR; } +#line 2438 "parser.tab.c" break; case 109: -#line 342 "parser.y" /* yacc.c:1646 */ - { (yyval.expression) = new_binary_expression(ctx, EXPR_SUB, (yyvsp[-2].expression), (yyvsp[0].expression)); CHECK_ERROR; } -#line 2334 "parser.tab.c" /* yacc.c:1646 */ +#line 343 "parser.y" + { (yyval.expression) = new_binary_expression(ctx, EXPR_LTEQ, (yyvsp[-2].expression), (yyvsp[0].expression)); CHECK_ERROR; } +#line 2444 "parser.tab.c" break; case 110: -#line 345 "parser.y" /* yacc.c:1646 */ - { (yyval.expression) = (yyvsp[0].expression); } -#line 2340 "parser.tab.c" /* yacc.c:1646 */ +#line 344 "parser.y" + { (yyval.expression) = new_binary_expression(ctx, EXPR_IS, (yyvsp[-2].expression), (yyvsp[0].expression)); CHECK_ERROR; } +#line 2450 "parser.tab.c" break; case 111: -#line 346 "parser.y" /* yacc.c:1646 */ - { (yyval.expression) = new_binary_expression(ctx, EXPR_MOD, (yyvsp[-2].expression), (yyvsp[0].expression)); CHECK_ERROR; } -#line 2346 "parser.tab.c" /* yacc.c:1646 */ +#line 347 "parser.y" + { (yyval.expression) = (yyvsp[0].expression); } +#line 2456 "parser.tab.c" break; case 112: -#line 349 "parser.y" /* yacc.c:1646 */ - { (yyval.expression) = (yyvsp[0].expression); } -#line 2352 "parser.tab.c" /* yacc.c:1646 */ +#line 348 "parser.y" + { (yyval.expression) = new_binary_expression(ctx, EXPR_CONCAT, (yyvsp[-2].expression), (yyvsp[0].expression)); CHECK_ERROR; } +#line 2462 "parser.tab.c" break; case 113: -#line 351 "parser.y" /* yacc.c:1646 */ - { (yyval.expression) = new_binary_expression(ctx, EXPR_IDIV, (yyvsp[-2].expression), (yyvsp[0].expression)); CHECK_ERROR; } -#line 2358 "parser.tab.c" /* yacc.c:1646 */ +#line 351 "parser.y" + { (yyval.expression) = (yyvsp[0].expression); } +#line 2468 "parser.tab.c" break; case 114: -#line 354 "parser.y" /* yacc.c:1646 */ - { (yyval.expression) = (yyvsp[0].expression); } -#line 2364 "parser.tab.c" /* yacc.c:1646 */ +#line 352 "parser.y" + { (yyval.expression) = new_binary_expression(ctx, EXPR_ADD, (yyvsp[-2].expression), (yyvsp[0].expression)); CHECK_ERROR; } +#line 2474 "parser.tab.c" break; case 115: -#line 356 "parser.y" /* yacc.c:1646 */ - { (yyval.expression) = new_binary_expression(ctx, EXPR_MUL, (yyvsp[-2].expression), (yyvsp[0].expression)); CHECK_ERROR; } -#line 2370 "parser.tab.c" /* yacc.c:1646 */ +#line 353 "parser.y" + { (yyval.expression) = new_binary_expression(ctx, EXPR_SUB, (yyvsp[-2].expression), (yyvsp[0].expression)); CHECK_ERROR; } +#line 2480 "parser.tab.c" break; case 116: -#line 358 "parser.y" /* yacc.c:1646 */ - { (yyval.expression) = new_binary_expression(ctx, EXPR_DIV, (yyvsp[-2].expression), (yyvsp[0].expression)); CHECK_ERROR; } -#line 2376 "parser.tab.c" /* yacc.c:1646 */ +#line 356 "parser.y" + { (yyval.expression) = (yyvsp[0].expression); } +#line 2486 "parser.tab.c" break; case 117: -#line 361 "parser.y" /* yacc.c:1646 */ - { (yyval.expression) = (yyvsp[0].expression); } -#line 2382 "parser.tab.c" /* yacc.c:1646 */ +#line 357 "parser.y" + { (yyval.expression) = new_binary_expression(ctx, EXPR_MOD, (yyvsp[-2].expression), (yyvsp[0].expression)); CHECK_ERROR; } +#line 2492 "parser.tab.c" break; case 118: -#line 362 "parser.y" /* yacc.c:1646 */ - { (yyval.expression) = new_binary_expression(ctx, EXPR_EXP, (yyvsp[-2].expression), (yyvsp[0].expression)); CHECK_ERROR; } -#line 2388 "parser.tab.c" /* yacc.c:1646 */ +#line 360 "parser.y" + { (yyval.expression) = (yyvsp[0].expression); } +#line 2498 "parser.tab.c" break; case 119: -#line 365 "parser.y" /* yacc.c:1646 */ - { (yyval.expression) = (yyvsp[0].expression); } -#line 2394 "parser.tab.c" /* yacc.c:1646 */ +#line 362 "parser.y" + { (yyval.expression) = new_binary_expression(ctx, EXPR_IDIV, (yyvsp[-2].expression), (yyvsp[0].expression)); CHECK_ERROR; } +#line 2504 "parser.tab.c" break; case 120: -#line 366 "parser.y" /* yacc.c:1646 */ +#line 365 "parser.y" { (yyval.expression) = (yyvsp[0].expression); } -#line 2400 "parser.tab.c" /* yacc.c:1646 */ +#line 2510 "parser.tab.c" break; case 121: -#line 367 "parser.y" /* yacc.c:1646 */ - { (yyval.expression) = new_new_expression(ctx, (yyvsp[0].string)); CHECK_ERROR; } -#line 2406 "parser.tab.c" /* yacc.c:1646 */ +#line 367 "parser.y" + { (yyval.expression) = new_binary_expression(ctx, EXPR_MUL, (yyvsp[-2].expression), (yyvsp[0].expression)); CHECK_ERROR; } +#line 2516 "parser.tab.c" break; case 122: -#line 368 "parser.y" /* yacc.c:1646 */ - { (yyval.expression) = new_unary_expression(ctx, EXPR_NEG, (yyvsp[0].expression)); CHECK_ERROR; } -#line 2412 "parser.tab.c" /* yacc.c:1646 */ +#line 369 "parser.y" + { (yyval.expression) = new_binary_expression(ctx, EXPR_DIV, (yyvsp[-2].expression), (yyvsp[0].expression)); CHECK_ERROR; } +#line 2522 "parser.tab.c" break; case 123: -#line 371 "parser.y" /* yacc.c:1646 */ +#line 372 "parser.y" { (yyval.expression) = (yyvsp[0].expression); } -#line 2418 "parser.tab.c" /* yacc.c:1646 */ +#line 2528 "parser.tab.c" break; case 124: -#line 372 "parser.y" /* yacc.c:1646 */ - { (yyvsp[-1].member)->args = (yyvsp[0].expression); (yyval.expression) = &(yyvsp[-1].member)->expr; } -#line 2424 "parser.tab.c" /* yacc.c:1646 */ +#line 373 "parser.y" + { (yyval.expression) = new_binary_expression(ctx, EXPR_EXP, (yyvsp[-2].expression), (yyvsp[0].expression)); CHECK_ERROR; } +#line 2534 "parser.tab.c" break; case 125: -#line 375 "parser.y" /* yacc.c:1646 */ - { (yyval.expression) = new_bool_expression(ctx, VARIANT_TRUE); CHECK_ERROR; } -#line 2430 "parser.tab.c" /* yacc.c:1646 */ +#line 376 "parser.y" + { (yyval.expression) = (yyvsp[0].expression); } +#line 2540 "parser.tab.c" break; case 126: -#line 376 "parser.y" /* yacc.c:1646 */ - { (yyval.expression) = new_bool_expression(ctx, VARIANT_FALSE); CHECK_ERROR; } -#line 2436 "parser.tab.c" /* yacc.c:1646 */ +#line 377 "parser.y" + { (yyval.expression) = (yyvsp[0].expression); } +#line 2546 "parser.tab.c" break; case 127: -#line 377 "parser.y" /* yacc.c:1646 */ - { (yyval.expression) = new_string_expression(ctx, (yyvsp[0].string)); CHECK_ERROR; } -#line 2442 "parser.tab.c" /* yacc.c:1646 */ +#line 378 "parser.y" + { (yyval.expression) = new_new_expression(ctx, (yyvsp[0].string)); CHECK_ERROR; } +#line 2552 "parser.tab.c" break; case 128: -#line 378 "parser.y" /* yacc.c:1646 */ - { (yyval.expression) = (yyvsp[0].expression); } -#line 2448 "parser.tab.c" /* yacc.c:1646 */ +#line 379 "parser.y" + { (yyval.expression) = new_unary_expression(ctx, EXPR_NEG, (yyvsp[0].expression)); CHECK_ERROR; } +#line 2558 "parser.tab.c" break; case 129: -#line 379 "parser.y" /* yacc.c:1646 */ - { (yyval.expression) = new_expression(ctx, EXPR_EMPTY, 0); CHECK_ERROR; } -#line 2454 "parser.tab.c" /* yacc.c:1646 */ +#line 380 "parser.y" + { (yyval.expression) = (yyvsp[0].expression); } +#line 2564 "parser.tab.c" break; case 130: -#line 380 "parser.y" /* yacc.c:1646 */ - { (yyval.expression) = new_expression(ctx, EXPR_NULL, 0); CHECK_ERROR; } -#line 2460 "parser.tab.c" /* yacc.c:1646 */ +#line 383 "parser.y" + { (yyval.expression) = (yyvsp[0].expression); } +#line 2570 "parser.tab.c" break; case 131: -#line 381 "parser.y" /* yacc.c:1646 */ - { (yyval.expression) = new_expression(ctx, EXPR_NOTHING, 0); CHECK_ERROR; } -#line 2466 "parser.tab.c" /* yacc.c:1646 */ +#line 384 "parser.y" + { (yyvsp[-1].member)->args = (yyvsp[0].expression); (yyval.expression) = &(yyvsp[-1].member)->expr; } +#line 2576 "parser.tab.c" break; case 132: -#line 384 "parser.y" /* yacc.c:1646 */ - { (yyval.expression) = new_long_expression(ctx, EXPR_USHORT, (yyvsp[0].lng)); CHECK_ERROR; } -#line 2472 "parser.tab.c" /* yacc.c:1646 */ +#line 387 "parser.y" + { (yyval.expression) = new_bool_expression(ctx, VARIANT_TRUE); CHECK_ERROR; } +#line 2582 "parser.tab.c" break; case 133: -#line 385 "parser.y" /* yacc.c:1646 */ - { (yyval.expression) = new_long_expression(ctx, EXPR_USHORT, 0); CHECK_ERROR; } -#line 2478 "parser.tab.c" /* yacc.c:1646 */ +#line 388 "parser.y" + { (yyval.expression) = new_bool_expression(ctx, VARIANT_FALSE); CHECK_ERROR; } +#line 2588 "parser.tab.c" break; case 134: -#line 386 "parser.y" /* yacc.c:1646 */ - { (yyval.expression) = new_long_expression(ctx, EXPR_ULONG, (yyvsp[0].lng)); CHECK_ERROR; } -#line 2484 "parser.tab.c" /* yacc.c:1646 */ +#line 389 "parser.y" + { (yyval.expression) = new_string_expression(ctx, (yyvsp[0].string)); CHECK_ERROR; } +#line 2594 "parser.tab.c" break; case 135: -#line 387 "parser.y" /* yacc.c:1646 */ - { (yyval.expression) = new_double_expression(ctx, (yyvsp[0].dbl)); CHECK_ERROR; } -#line 2490 "parser.tab.c" /* yacc.c:1646 */ +#line 390 "parser.y" + { (yyval.expression) = (yyvsp[0].expression); } +#line 2600 "parser.tab.c" break; case 136: -#line 390 "parser.y" /* yacc.c:1646 */ - { (yyval.uint) = (yyvsp[0].lng); } -#line 2496 "parser.tab.c" /* yacc.c:1646 */ +#line 391 "parser.y" + { (yyval.expression) = new_expression(ctx, EXPR_EMPTY, 0); CHECK_ERROR; } +#line 2606 "parser.tab.c" break; case 137: -#line 391 "parser.y" /* yacc.c:1646 */ - { (yyval.uint) = 0; } -#line 2502 "parser.tab.c" /* yacc.c:1646 */ +#line 392 "parser.y" + { (yyval.expression) = new_expression(ctx, EXPR_NULL, 0); CHECK_ERROR; } +#line 2612 "parser.tab.c" break; case 138: -#line 392 "parser.y" /* yacc.c:1646 */ - { (yyval.uint) = (yyvsp[0].lng); } -#line 2508 "parser.tab.c" /* yacc.c:1646 */ +#line 393 "parser.y" + { (yyval.expression) = new_expression(ctx, EXPR_NOTHING, 0); CHECK_ERROR; } +#line 2618 "parser.tab.c" break; case 139: -#line 395 "parser.y" /* yacc.c:1646 */ - { (yyval.expression) = new_unary_expression(ctx, EXPR_BRACKETS, (yyvsp[-1].expression)); } -#line 2514 "parser.tab.c" /* yacc.c:1646 */ +#line 396 "parser.y" + { (yyval.expression) = new_long_expression(ctx, EXPR_INT, 0); CHECK_ERROR; } +#line 2624 "parser.tab.c" break; case 140: -#line 396 "parser.y" /* yacc.c:1646 */ - { (yyval.expression) = new_expression(ctx, EXPR_ME, 0); CHECK_ERROR; } -#line 2520 "parser.tab.c" /* yacc.c:1646 */ +#line 397 "parser.y" + { (yyval.expression) = new_long_expression(ctx, EXPR_INT, (yyvsp[0].integer)); CHECK_ERROR; } +#line 2630 "parser.tab.c" break; case 141: -#line 399 "parser.y" /* yacc.c:1646 */ - { (yyvsp[-3].class_decl)->name = (yyvsp[-5].string); (yyval.class_decl) = (yyvsp[-3].class_decl); } -#line 2526 "parser.tab.c" /* yacc.c:1646 */ +#line 398 "parser.y" + { (yyval.expression) = new_double_expression(ctx, (yyvsp[0].dbl)); CHECK_ERROR; } +#line 2636 "parser.tab.c" break; case 142: -#line 402 "parser.y" /* yacc.c:1646 */ - { (yyval.class_decl) = new_class_decl(ctx); } -#line 2532 "parser.tab.c" /* yacc.c:1646 */ +#line 401 "parser.y" + { (yyval.uint) = 0; } +#line 2642 "parser.tab.c" break; case 143: -#line 403 "parser.y" /* yacc.c:1646 */ - { (yyval.class_decl) = add_class_function(ctx, (yyvsp[0].class_decl), (yyvsp[-2].func_decl)); CHECK_ERROR; } -#line 2538 "parser.tab.c" /* yacc.c:1646 */ +#line 402 "parser.y" + { (yyval.uint) = (yyvsp[0].integer); } +#line 2648 "parser.tab.c" break; case 144: -#line 405 "parser.y" /* yacc.c:1646 */ - { dim_decl_t *dim_decl = new_dim_decl(ctx, (yyvsp[-2].string), FALSE, NULL); CHECK_ERROR; - (yyval.class_decl) = add_dim_prop(ctx, (yyvsp[0].class_decl), dim_decl, (yyvsp[-3].uint)); CHECK_ERROR; } -#line 2545 "parser.tab.c" /* yacc.c:1646 */ +#line 405 "parser.y" + { (yyval.expression) = new_unary_expression(ctx, EXPR_BRACKETS, (yyvsp[-1].expression)); } +#line 2654 "parser.tab.c" break; case 145: -#line 407 "parser.y" /* yacc.c:1646 */ - { (yyval.class_decl) = add_dim_prop(ctx, (yyvsp[0].class_decl), (yyvsp[-2].dim_decl), 0); CHECK_ERROR; } -#line 2551 "parser.tab.c" /* yacc.c:1646 */ +#line 406 "parser.y" + { (yyval.expression) = new_expression(ctx, EXPR_ME, 0); CHECK_ERROR; } +#line 2660 "parser.tab.c" break; case 146: -#line 408 "parser.y" /* yacc.c:1646 */ - { (yyval.class_decl) = add_class_function(ctx, (yyvsp[0].class_decl), (yyvsp[-2].func_decl)); CHECK_ERROR; } -#line 2557 "parser.tab.c" /* yacc.c:1646 */ +#line 409 "parser.y" + { (yyvsp[-3].class_decl)->name = (yyvsp[-5].string); (yyval.class_decl) = (yyvsp[-3].class_decl); } +#line 2666 "parser.tab.c" break; case 147: -#line 412 "parser.y" /* yacc.c:1646 */ - { (yyval.func_decl) = new_function_decl(ctx, (yyvsp[-5].string), FUNC_PROPGET, (yyvsp[-8].uint), (yyvsp[-4].arg_decl), (yyvsp[-2].statement)); CHECK_ERROR; } -#line 2563 "parser.tab.c" /* yacc.c:1646 */ +#line 412 "parser.y" + { (yyval.class_decl) = new_class_decl(ctx); } +#line 2672 "parser.tab.c" break; case 148: -#line 414 "parser.y" /* yacc.c:1646 */ - { (yyval.func_decl) = new_function_decl(ctx, (yyvsp[-7].string), FUNC_PROPLET, (yyvsp[-10].uint), (yyvsp[-5].arg_decl), (yyvsp[-2].statement)); CHECK_ERROR; } -#line 2569 "parser.tab.c" /* yacc.c:1646 */ +#line 413 "parser.y" + { (yyval.class_decl) = add_class_function(ctx, new_class_decl(ctx), (yyvsp[0].func_decl)); CHECK_ERROR; } +#line 2678 "parser.tab.c" break; case 149: -#line 416 "parser.y" /* yacc.c:1646 */ - { (yyval.func_decl) = new_function_decl(ctx, (yyvsp[-7].string), FUNC_PROPSET, (yyvsp[-10].uint), (yyvsp[-5].arg_decl), (yyvsp[-2].statement)); CHECK_ERROR; } -#line 2575 "parser.tab.c" /* yacc.c:1646 */ +#line 414 "parser.y" + { (yyval.class_decl) = add_class_function(ctx, (yyvsp[0].class_decl), (yyvsp[-2].func_decl)); CHECK_ERROR; } +#line 2684 "parser.tab.c" break; case 150: -#line 420 "parser.y" /* yacc.c:1646 */ - { (yyval.func_decl) = new_function_decl(ctx, (yyvsp[-5].string), FUNC_SUB, (yyvsp[-7].uint), (yyvsp[-4].arg_decl), (yyvsp[-2].statement)); CHECK_ERROR; } -#line 2581 "parser.tab.c" /* yacc.c:1646 */ +#line 416 "parser.y" + { dim_decl_t *dim_decl = new_dim_decl(ctx, (yyvsp[0].string), FALSE, NULL); CHECK_ERROR; + (yyval.class_decl) = add_dim_prop(ctx, new_class_decl(ctx), dim_decl, (yyvsp[-1].uint)); CHECK_ERROR; } +#line 2691 "parser.tab.c" break; case 151: -#line 422 "parser.y" /* yacc.c:1646 */ - { (yyval.func_decl) = new_function_decl(ctx, (yyvsp[-5].string), FUNC_FUNCTION, (yyvsp[-7].uint), (yyvsp[-4].arg_decl), (yyvsp[-2].statement)); CHECK_ERROR; } -#line 2587 "parser.tab.c" /* yacc.c:1646 */ +#line 418 "parser.y" + { dim_decl_t *dim_decl = new_dim_decl(ctx, (yyvsp[-2].string), FALSE, NULL); CHECK_ERROR; + (yyval.class_decl) = add_dim_prop(ctx, (yyvsp[0].class_decl), dim_decl, (yyvsp[-3].uint)); CHECK_ERROR; } +#line 2698 "parser.tab.c" break; case 152: -#line 425 "parser.y" /* yacc.c:1646 */ - { (yyval.uint) = 0; } -#line 2593 "parser.tab.c" /* yacc.c:1646 */ +#line 420 "parser.y" + { (yyval.class_decl) = add_dim_prop(ctx, new_class_decl(ctx), (yyvsp[0].dim_decl), 0); CHECK_ERROR; } +#line 2704 "parser.tab.c" break; case 153: -#line 426 "parser.y" /* yacc.c:1646 */ - { (yyval.uint) = (yyvsp[0].uint); } -#line 2599 "parser.tab.c" /* yacc.c:1646 */ +#line 421 "parser.y" + { (yyval.class_decl) = add_dim_prop(ctx, (yyvsp[0].class_decl), (yyvsp[-2].dim_decl), 0); CHECK_ERROR; } +#line 2710 "parser.tab.c" break; case 154: -#line 429 "parser.y" /* yacc.c:1646 */ - { (yyval.uint) = STORAGE_IS_DEFAULT; } -#line 2605 "parser.tab.c" /* yacc.c:1646 */ +#line 422 "parser.y" + { (yyval.class_decl) = add_class_function(ctx, new_class_decl(ctx), (yyvsp[0].func_decl)); CHECK_ERROR; } +#line 2716 "parser.tab.c" break; case 155: -#line 430 "parser.y" /* yacc.c:1646 */ - { (yyval.uint) = 0; } -#line 2611 "parser.tab.c" /* yacc.c:1646 */ +#line 423 "parser.y" + { (yyval.class_decl) = add_class_function(ctx, (yyvsp[0].class_decl), (yyvsp[-2].func_decl)); CHECK_ERROR; } +#line 2722 "parser.tab.c" break; case 156: -#line 431 "parser.y" /* yacc.c:1646 */ - { (yyval.uint) = STORAGE_IS_PRIVATE; } -#line 2617 "parser.tab.c" /* yacc.c:1646 */ +#line 427 "parser.y" + { (yyval.func_decl) = new_function_decl(ctx, (yyvsp[-5].string), FUNC_PROPGET, (yyvsp[-8].uint), (yyvsp[-4].arg_decl), (yyvsp[-2].statement)); CHECK_ERROR; } +#line 2728 "parser.tab.c" break; case 157: -#line 434 "parser.y" /* yacc.c:1646 */ - { (yyval.arg_decl) = NULL; } -#line 2623 "parser.tab.c" /* yacc.c:1646 */ +#line 429 "parser.y" + { (yyval.func_decl) = new_function_decl(ctx, (yyvsp[-7].string), FUNC_PROPLET, (yyvsp[-10].uint), (yyvsp[-5].arg_decl), (yyvsp[-2].statement)); CHECK_ERROR; } +#line 2734 "parser.tab.c" break; case 158: -#line 435 "parser.y" /* yacc.c:1646 */ - { (yyval.arg_decl) = (yyvsp[-1].arg_decl); } -#line 2629 "parser.tab.c" /* yacc.c:1646 */ +#line 431 "parser.y" + { (yyval.func_decl) = new_function_decl(ctx, (yyvsp[-7].string), FUNC_PROPSET, (yyvsp[-10].uint), (yyvsp[-5].arg_decl), (yyvsp[-2].statement)); CHECK_ERROR; } +#line 2740 "parser.tab.c" break; case 159: -#line 438 "parser.y" /* yacc.c:1646 */ - { (yyval.arg_decl) = (yyvsp[0].arg_decl); } -#line 2635 "parser.tab.c" /* yacc.c:1646 */ +#line 435 "parser.y" + { (yyval.func_decl) = new_function_decl(ctx, (yyvsp[-5].string), FUNC_SUB, (yyvsp[-7].uint), (yyvsp[-4].arg_decl), (yyvsp[-2].statement)); CHECK_ERROR; } +#line 2746 "parser.tab.c" break; case 160: -#line 439 "parser.y" /* yacc.c:1646 */ - { (yyvsp[-2].arg_decl)->next = (yyvsp[0].arg_decl); (yyval.arg_decl) = (yyvsp[-2].arg_decl); } -#line 2641 "parser.tab.c" /* yacc.c:1646 */ +#line 437 "parser.y" + { (yyval.func_decl) = new_function_decl(ctx, (yyvsp[-5].string), FUNC_FUNCTION, (yyvsp[-7].uint), (yyvsp[-4].arg_decl), (yyvsp[-2].statement)); CHECK_ERROR; } +#line 2752 "parser.tab.c" break; case 161: -#line 442 "parser.y" /* yacc.c:1646 */ - { (yyval.arg_decl) = new_argument_decl(ctx, (yyvsp[-1].string), TRUE); } -#line 2647 "parser.tab.c" /* yacc.c:1646 */ +#line 440 "parser.y" + { (yyval.uint) = 0; } +#line 2758 "parser.tab.c" break; case 162: -#line 443 "parser.y" /* yacc.c:1646 */ - { (yyval.arg_decl) = new_argument_decl(ctx, (yyvsp[-1].string), TRUE); } -#line 2653 "parser.tab.c" /* yacc.c:1646 */ +#line 441 "parser.y" + { (yyval.uint) = (yyvsp[0].uint); } +#line 2764 "parser.tab.c" break; case 163: -#line 444 "parser.y" /* yacc.c:1646 */ - { (yyval.arg_decl) = new_argument_decl(ctx, (yyvsp[-1].string), FALSE); } -#line 2659 "parser.tab.c" /* yacc.c:1646 */ +#line 444 "parser.y" + { (yyval.uint) = STORAGE_IS_DEFAULT; } +#line 2770 "parser.tab.c" break; case 164: -#line 448 "parser.y" /* yacc.c:1646 */ - { (yyval.string) = (yyvsp[0].string); } -#line 2665 "parser.tab.c" /* yacc.c:1646 */ +#line 445 "parser.y" + { (yyval.uint) = 0; } +#line 2776 "parser.tab.c" break; case 165: -#line 449 "parser.y" /* yacc.c:1646 */ - { (yyval.string) = propertyW; } -#line 2671 "parser.tab.c" /* yacc.c:1646 */ +#line 446 "parser.y" + { (yyval.uint) = STORAGE_IS_PRIVATE; } +#line 2782 "parser.tab.c" + break; + + case 166: +#line 449 "parser.y" + { (yyval.arg_decl) = NULL; } +#line 2788 "parser.tab.c" + break; + + case 167: +#line 450 "parser.y" + { (yyval.arg_decl) = (yyvsp[-1].arg_decl); } +#line 2794 "parser.tab.c" + break; + + case 168: +#line 453 "parser.y" + { (yyval.arg_decl) = (yyvsp[0].arg_decl); } +#line 2800 "parser.tab.c" + break; + + case 169: +#line 454 "parser.y" + { (yyvsp[-2].arg_decl)->next = (yyvsp[0].arg_decl); (yyval.arg_decl) = (yyvsp[-2].arg_decl); } +#line 2806 "parser.tab.c" + break; + + case 170: +#line 457 "parser.y" + { (yyval.arg_decl) = new_argument_decl(ctx, (yyvsp[-1].string), TRUE); } +#line 2812 "parser.tab.c" + break; + + case 171: +#line 458 "parser.y" + { (yyval.arg_decl) = new_argument_decl(ctx, (yyvsp[-1].string), TRUE); } +#line 2818 "parser.tab.c" + break; + + case 172: +#line 459 "parser.y" + { (yyval.arg_decl) = new_argument_decl(ctx, (yyvsp[-1].string), FALSE); } +#line 2824 "parser.tab.c" + break; + + case 173: +#line 463 "parser.y" + { (yyval.string) = (yyvsp[0].string); } +#line 2830 "parser.tab.c" + break; + + case 174: +#line 464 "parser.y" + { (yyval.string) = (yyvsp[0].string); } +#line 2836 "parser.tab.c" + break; + + case 175: +#line 465 "parser.y" + { (yyval.string) = (yyvsp[0].string); } +#line 2842 "parser.tab.c" + break; + + case 176: +#line 466 "parser.y" + { (yyval.string) = (yyvsp[0].string); } +#line 2848 "parser.tab.c" + break; + + case 177: +#line 467 "parser.y" + { (yyval.string) = (yyvsp[0].string); } +#line 2854 "parser.tab.c" + break; + + case 178: +#line 468 "parser.y" + { (yyval.string) = (yyvsp[0].string); } +#line 2860 "parser.tab.c" + break; + + case 179: +#line 472 "parser.y" + { (yyval.string) = (yyvsp[0].string); } +#line 2866 "parser.tab.c" + break; + + case 180: +#line 473 "parser.y" + { (yyval.string) = (yyvsp[0].string); } +#line 2872 "parser.tab.c" + break; + + case 181: +#line 474 "parser.y" + { (yyval.string) = (yyvsp[0].string); } +#line 2878 "parser.tab.c" + break; + + case 182: +#line 475 "parser.y" + { (yyval.string) = (yyvsp[0].string); } +#line 2884 "parser.tab.c" + break; + + case 183: +#line 476 "parser.y" + { (yyval.string) = (yyvsp[0].string); } +#line 2890 "parser.tab.c" + break; + + case 184: +#line 477 "parser.y" + { (yyval.string) = (yyvsp[0].string); } +#line 2896 "parser.tab.c" + break; + + case 185: +#line 478 "parser.y" + { (yyval.string) = (yyvsp[0].string); } +#line 2902 "parser.tab.c" + break; + + case 186: +#line 479 "parser.y" + { (yyval.string) = (yyvsp[0].string); } +#line 2908 "parser.tab.c" + break; + + case 187: +#line 480 "parser.y" + { (yyval.string) = (yyvsp[0].string); } +#line 2914 "parser.tab.c" + break; + + case 188: +#line 481 "parser.y" + { (yyval.string) = (yyvsp[0].string); } +#line 2920 "parser.tab.c" + break; + + case 189: +#line 482 "parser.y" + { (yyval.string) = (yyvsp[0].string); } +#line 2926 "parser.tab.c" + break; + + case 190: +#line 483 "parser.y" + { (yyval.string) = (yyvsp[0].string); } +#line 2932 "parser.tab.c" + break; + + case 191: +#line 484 "parser.y" + { (yyval.string) = (yyvsp[0].string); } +#line 2938 "parser.tab.c" + break; + + case 192: +#line 485 "parser.y" + { (yyval.string) = (yyvsp[0].string); } +#line 2944 "parser.tab.c" + break; + + case 193: +#line 486 "parser.y" + { (yyval.string) = (yyvsp[0].string); } +#line 2950 "parser.tab.c" + break; + + case 194: +#line 487 "parser.y" + { (yyval.string) = (yyvsp[0].string); } +#line 2956 "parser.tab.c" + break; + + case 195: +#line 488 "parser.y" + { (yyval.string) = (yyvsp[0].string); } +#line 2962 "parser.tab.c" + break; + + case 196: +#line 489 "parser.y" + { (yyval.string) = (yyvsp[0].string); } +#line 2968 "parser.tab.c" + break; + + case 197: +#line 490 "parser.y" + { (yyval.string) = (yyvsp[0].string); } +#line 2974 "parser.tab.c" + break; + + case 198: +#line 491 "parser.y" + { (yyval.string) = (yyvsp[0].string); } +#line 2980 "parser.tab.c" + break; + + case 199: +#line 492 "parser.y" + { (yyval.string) = (yyvsp[0].string); } +#line 2986 "parser.tab.c" + break; + + case 200: +#line 493 "parser.y" + { (yyval.string) = (yyvsp[0].string); } +#line 2992 "parser.tab.c" + break; + + case 201: +#line 494 "parser.y" + { (yyval.string) = (yyvsp[0].string); } +#line 2998 "parser.tab.c" + break; + + case 202: +#line 495 "parser.y" + { (yyval.string) = (yyvsp[0].string); } +#line 3004 "parser.tab.c" + break; + + case 203: +#line 496 "parser.y" + { (yyval.string) = (yyvsp[0].string); } +#line 3010 "parser.tab.c" + break; + + case 204: +#line 497 "parser.y" + { (yyval.string) = (yyvsp[0].string); } +#line 3016 "parser.tab.c" + break; + + case 205: +#line 498 "parser.y" + { (yyval.string) = (yyvsp[0].string); } +#line 3022 "parser.tab.c" + break; + + case 206: +#line 499 "parser.y" + { (yyval.string) = (yyvsp[0].string); } +#line 3028 "parser.tab.c" + break; + + case 207: +#line 500 "parser.y" + { (yyval.string) = (yyvsp[0].string); } +#line 3034 "parser.tab.c" + break; + + case 208: +#line 501 "parser.y" + { (yyval.string) = (yyvsp[0].string); } +#line 3040 "parser.tab.c" + break; + + case 209: +#line 502 "parser.y" + { (yyval.string) = (yyvsp[0].string); } +#line 3046 "parser.tab.c" + break; + + case 210: +#line 503 "parser.y" + { (yyval.string) = (yyvsp[0].string); } +#line 3052 "parser.tab.c" + break; + + case 211: +#line 504 "parser.y" + { (yyval.string) = (yyvsp[0].string); } +#line 3058 "parser.tab.c" + break; + + case 212: +#line 505 "parser.y" + { (yyval.string) = (yyvsp[0].string); } +#line 3064 "parser.tab.c" + break; + + case 213: +#line 506 "parser.y" + { (yyval.string) = (yyvsp[0].string); } +#line 3070 "parser.tab.c" + break; + + case 214: +#line 507 "parser.y" + { (yyval.string) = (yyvsp[0].string); } +#line 3076 "parser.tab.c" + break; + + case 215: +#line 508 "parser.y" + { (yyval.string) = (yyvsp[0].string); } +#line 3082 "parser.tab.c" + break; + + case 216: +#line 509 "parser.y" + { (yyval.string) = (yyvsp[0].string); } +#line 3088 "parser.tab.c" + break; + + case 217: +#line 510 "parser.y" + { (yyval.string) = (yyvsp[0].string); } +#line 3094 "parser.tab.c" + break; + + case 218: +#line 511 "parser.y" + { (yyval.string) = (yyvsp[0].string); } +#line 3100 "parser.tab.c" + break; + + case 219: +#line 512 "parser.y" + { (yyval.string) = (yyvsp[0].string); } +#line 3106 "parser.tab.c" + break; + + case 220: +#line 513 "parser.y" + { (yyval.string) = (yyvsp[0].string); } +#line 3112 "parser.tab.c" + break; + + case 221: +#line 514 "parser.y" + { (yyval.string) = (yyvsp[0].string); } +#line 3118 "parser.tab.c" + break; + + case 222: +#line 515 "parser.y" + { (yyval.string) = (yyvsp[0].string); } +#line 3124 "parser.tab.c" + break; + + case 223: +#line 516 "parser.y" + { (yyval.string) = (yyvsp[0].string); } +#line 3130 "parser.tab.c" + break; + + case 224: +#line 517 "parser.y" + { (yyval.string) = (yyvsp[0].string); } +#line 3136 "parser.tab.c" + break; + + case 225: +#line 518 "parser.y" + { (yyval.string) = (yyvsp[0].string); } +#line 3142 "parser.tab.c" + break; + + case 226: +#line 519 "parser.y" + { (yyval.string) = (yyvsp[0].string); } +#line 3148 "parser.tab.c" + break; + + case 227: +#line 520 "parser.y" + { (yyval.string) = (yyvsp[0].string); } +#line 3154 "parser.tab.c" + break; + + case 228: +#line 521 "parser.y" + { (yyval.string) = (yyvsp[0].string); } +#line 3160 "parser.tab.c" break; -#line 2675 "parser.tab.c" /* yacc.c:1646 */ +#line 3164 "parser.tab.c" + default: break; } /* User semantic actions sometimes alter yychar, and that requires @@ -2696,14 +3186,13 @@ yyreduce: /* Now 'shift' the result of the reduction. Determine what state that goes to, based on the state we popped back to and the rule number reduced by. */ - - yyn = yyr1[yyn]; - - yystate = yypgoto[yyn - YYNTOKENS] + *yyssp; - if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp) - yystate = yytable[yystate]; - else - yystate = yydefgoto[yyn - YYNTOKENS]; + { + const int yylhs = yyr1[yyn] - YYNTOKENS; + const int yyi = yypgoto[yylhs] + *yyssp; + yystate = (0 <= yyi && yyi <= YYLAST && yycheck[yyi] == *yyssp + ? yytable[yyi] + : yydefgoto[yylhs]); + } goto yynewstate; @@ -2786,12 +3275,10 @@ yyerrlab: | yyerrorlab -- error raised explicitly by YYERROR. | `---------------------------------------------------*/ yyerrorlab: - - /* Pacify compilers like GCC when the user code never invokes - YYERROR and the label yyerrorlab therefore never appears in user - code. */ - if (/*CONSTCOND*/ 0) - goto yyerrorlab; + /* Pacify compilers when the user code never invokes YYERROR and the + label yyerrorlab therefore never appears in user code. */ + if (0) + YYERROR; /* Do not reclaim the symbols of the rule whose action triggered this YYERROR. */ @@ -2853,6 +3340,7 @@ yyacceptlab: yyresult = 0; goto yyreturn; + /*-----------------------------------. | yyabortlab -- YYABORT comes here. | `-----------------------------------*/ @@ -2860,6 +3348,7 @@ yyabortlab: yyresult = 1; goto yyreturn; + #if !defined yyoverflow || YYERROR_VERBOSE /*-------------------------------------------------. | yyexhaustedlab -- memory exhaustion comes here. | @@ -2870,6 +3359,10 @@ yyexhaustedlab: /* Fall through. */ #endif + +/*-----------------------------------------------------. +| yyreturn -- parsing is finished, return the result. | +`-----------------------------------------------------*/ yyreturn: if (yychar != YYEMPTY) { @@ -2899,7 +3392,7 @@ yyreturn: #endif return yyresult; } -#line 458 "parser.y" /* yacc.c:1906 */ +#line 530 "parser.y" static int parser_error(parser_ctx_t *ctx, const char *str) @@ -2932,6 +3425,22 @@ static void parse_complete(parser_ctx_t *ctx, BOOL option_explicit) ctx->option_explicit = option_explicit; } +static void handle_isexpression_script(parser_ctx_t *ctx, expression_t *expr) +{ + retval_statement_t *stat; + + ctx->parse_complete = TRUE; + if(!expr) + return; + + stat = new_statement(ctx, STAT_RETVAL, sizeof(*stat)); + if(!stat) + return; + + stat->expr = expr; + ctx->stats = &stat->stat; +} + static void *new_expression(parser_ctx_t *ctx, expression_type_t type, size_t size) { expression_t *expr; @@ -3324,7 +3833,7 @@ static class_decl_t *add_class_function(parser_ctx_t *ctx, class_decl_t *class_d function_decl_t *iter; for(iter = class_decl->funcs; iter; iter = iter->next) { - if(!strcmpiW(iter->name, decl->name)) { + if(!wcsicmp(iter->name, decl->name)) { if(decl->type == FUNC_SUB || decl->type == FUNC_FUNCTION) { FIXME("Redefinition of %s::%s\n", debugstr_w(class_decl->name), debugstr_w(decl->name)); ctx->hres = E_FAIL; @@ -3412,12 +3921,12 @@ void *parser_alloc(parser_ctx_t *ctx, size_t size) return ret; } -HRESULT parse_script(parser_ctx_t *ctx, const WCHAR *code, const WCHAR *delimiter) +HRESULT parse_script(parser_ctx_t *ctx, const WCHAR *code, const WCHAR *delimiter, DWORD flags) { static const WCHAR html_delimiterW[] = {'<','/','s','c','r','i','p','t','>',0}; ctx->code = ctx->ptr = code; - ctx->end = ctx->code + strlenW(ctx->code); + ctx->end = ctx->code + lstrlenW(ctx->code); heap_pool_init(&ctx->heap); @@ -3429,7 +3938,10 @@ HRESULT parse_script(parser_ctx_t *ctx, const WCHAR *code, const WCHAR *delimite ctx->stats = ctx->stats_tail = NULL; ctx->class_decls = NULL; ctx->option_explicit = FALSE; - ctx->is_html = delimiter && !strcmpiW(delimiter, html_delimiterW); + ctx->is_html = delimiter && !wcsicmp(delimiter, html_delimiterW); + + if(flags & SCRIPTTEXT_ISEXPRESSION) + ctx->last_token = tEXPRESSION; parser_parse(ctx); diff --git a/dll/win32/vbscript/parser.tab.h b/dll/win32/vbscript/parser.tab.h index 5ac7e40e663..615800d019a 100644 --- a/dll/win32/vbscript/parser.tab.h +++ b/dll/win32/vbscript/parser.tab.h @@ -1,8 +1,9 @@ -/* A Bison parser, made by GNU Bison 3.0. */ +/* A Bison parser, made by GNU Bison 3.4.1. */ /* Bison interface for Yacc-like parsers in C - Copyright (C) 1984, 1989-1990, 2000-2013 Free Software Foundation, Inc. + Copyright (C) 1984, 1989-1990, 2000-2015, 2018-2019 Free Software Foundation, + Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -30,6 +31,9 @@ This special exception was added by the Free Software Foundation in version 2.2 of Bison. */ +/* Undocumented macros, especially those whose name start with YY_, + are private implementation details. Do not rely on them. */ + #ifndef YY_PARSER_E_REACTOSSYNC_GCC_DLL_WIN32_VBSCRIPT_PARSER_TAB_H_INCLUDED # define YY_PARSER_E_REACTOSSYNC_GCC_DLL_WIN32_VBSCRIPT_PARSER_TAB_H_INCLUDED /* Debug traces. */ @@ -45,83 +49,82 @@ extern int parser_debug; # define YYTOKENTYPE enum yytokentype { - tEOF = 258, - tNL = 259, - tREM = 260, + tEXPRESSION = 258, + tEOF = 259, + tNL = 260, tEMPTYBRACKETS = 261, - tTRUE = 262, - tFALSE = 263, - tNOT = 264, - tAND = 265, - tOR = 266, - tXOR = 267, - tEQV = 268, - tIMP = 269, - tNEQ = 270, - tIS = 271, - tLTEQ = 272, - tGTEQ = 273, - tMOD = 274, - tCALL = 275, - tDIM = 276, - tSUB = 277, - tFUNCTION = 278, - tPROPERTY = 279, - tGET = 280, - tLET = 281, - tCONST = 282, - tIF = 283, - tELSE = 284, - tELSEIF = 285, - tEND = 286, - tTHEN = 287, - tEXIT = 288, - tWHILE = 289, - tWEND = 290, - tDO = 291, - tLOOP = 292, - tUNTIL = 293, - tFOR = 294, - tTO = 295, - tSTEP = 296, - tEACH = 297, - tIN = 298, - tSELECT = 299, - tCASE = 300, - tBYREF = 301, - tBYVAL = 302, - tOPTION = 303, - tEXPLICIT = 304, - tSTOP = 305, - tNOTHING = 306, - tEMPTY = 307, - tNULL = 308, - tCLASS = 309, - tSET = 310, - tNEW = 311, - tPUBLIC = 312, - tPRIVATE = 313, - tDEFAULT = 314, - tME = 315, - tERROR = 316, - tNEXT = 317, - tON = 318, - tRESUME = 319, - tGOTO = 320, - tIdentifier = 321, - tString = 322, - tLong = 323, - tShort = 324, + tLTEQ = 262, + tGTEQ = 263, + tNEQ = 264, + tSTOP = 265, + tME = 266, + tREM = 267, + tTRUE = 268, + tFALSE = 269, + tNOT = 270, + tAND = 271, + tOR = 272, + tXOR = 273, + tEQV = 274, + tIMP = 275, + tIS = 276, + tMOD = 277, + tCALL = 278, + tDIM = 279, + tSUB = 280, + tFUNCTION = 281, + tGET = 282, + tLET = 283, + tCONST = 284, + tIF = 285, + tELSE = 286, + tELSEIF = 287, + tEND = 288, + tTHEN = 289, + tEXIT = 290, + tWHILE = 291, + tWEND = 292, + tDO = 293, + tLOOP = 294, + tUNTIL = 295, + tFOR = 296, + tTO = 297, + tEACH = 298, + tIN = 299, + tSELECT = 300, + tCASE = 301, + tBYREF = 302, + tBYVAL = 303, + tOPTION = 304, + tNOTHING = 305, + tEMPTY = 306, + tNULL = 307, + tCLASS = 308, + tSET = 309, + tNEW = 310, + tPUBLIC = 311, + tPRIVATE = 312, + tNEXT = 313, + tON = 314, + tRESUME = 315, + tGOTO = 316, + tIdentifier = 317, + tString = 318, + tDEFAULT = 319, + tERROR = 320, + tEXPLICIT = 321, + tPROPERTY = 322, + tSTEP = 323, + tInt = 324, tDouble = 325 }; #endif /* Value type. */ #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED -typedef union YYSTYPE YYSTYPE; union YYSTYPE { -#line 88 "parser.y" /* yacc.c:1909 */ +#line 87 "parser.y" const WCHAR *string; statement_t *statement; @@ -136,12 +139,14 @@ union YYSTYPE const_decl_t *const_decl; case_clausule_t *case_clausule; unsigned uint; - LONG lng; + LONG integer; BOOL boolean; double dbl; -#line 144 "parser.tab.h" /* yacc.c:1909 */ +#line 147 "parser.tab.h" + }; +typedef union YYSTYPE YYSTYPE; # define YYSTYPE_IS_TRIVIAL 1 # define YYSTYPE_IS_DECLARED 1 #endif diff --git a/dll/win32/vbscript/parser.y b/dll/win32/vbscript/parser.y index 020109998e8..8ecdf47c08c 100644 --- a/dll/win32/vbscript/parser.y +++ b/dll/win32/vbscript/parser.y @@ -28,6 +28,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(vbscript); static int parser_error(parser_ctx_t *,const char*); static void parse_complete(parser_ctx_t*,BOOL); +static void handle_isexpression_script(parser_ctx_t *ctx, expression_t *expr); static void source_add_statement(parser_ctx_t*,statement_t*); static void source_add_class(parser_ctx_t*,class_decl_t*); @@ -71,8 +72,6 @@ static class_decl_t *add_dim_prop(parser_ctx_t*,class_decl_t*,dim_decl_t*,unsign static statement_t *link_statements(statement_t*,statement_t*); -static const WCHAR propertyW[] = {'p','r','o','p','e','r','t','y',0}; - #define STORAGE_IS_PRIVATE 1 #define STORAGE_IS_DEFAULT 2 @@ -99,31 +98,33 @@ static const WCHAR propertyW[] = {'p','r','o','p','e','r','t','y',0}; const_decl_t *const_decl; case_clausule_t *case_clausule; unsigned uint; - LONG lng; + LONG integer; BOOL boolean; double dbl; } -%token tEOF tNL tREM tEMPTYBRACKETS -%token tTRUE tFALSE -%token tNOT tAND tOR tXOR tEQV tIMP tNEQ -%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 tFOR tTO tSTEP tEACH tIN -%token tSELECT tCASE -%token tBYREF tBYVAL -%token tOPTION tEXPLICIT -%token tSTOP -%token tNOTHING tEMPTY tNULL -%token tCLASS tSET tNEW tPUBLIC tPRIVATE tDEFAULT tME -%token tERROR tNEXT tON tRESUME tGOTO +%token tEXPRESSION tEOF tNL tEMPTYBRACKETS +%token tLTEQ tGTEQ tNEQ +%token tSTOP tME tREM +%token tTRUE tFALSE +%token tNOT tAND tOR tXOR tEQV tIMP +%token tIS tMOD +%token tCALL tDIM tSUB tFUNCTION tGET tLET tCONST +%token tIF tELSE tELSEIF tEND tTHEN tEXIT +%token tWHILE tWEND tDO tLOOP tUNTIL tFOR tTO tEACH tIN +%token tSELECT tCASE +%token tBYREF tBYVAL +%token tOPTION +%token tNOTHING tEMPTY tNULL +%token tCLASS tSET tNEW tPUBLIC tPRIVATE +%token tNEXT tON tRESUME tGOTO %token tIdentifier tString -%token tLong tShort +%token tDEFAULT tERROR tEXPLICIT tPROPERTY tSTEP +%token tInt %token tDouble -%type Statement SimpleStatement StatementNl StatementsNl StatementsNl_opt IfStatement Else_opt -%type Expression LiteralExpression PrimaryExpression EqualityExpression CallExpression +%type Statement SimpleStatement StatementNl StatementsNl StatementsNl_opt BodyStatements IfStatement Else_opt +%type Expression LiteralExpression PrimaryExpression EqualityExpression CallExpression ExpressionNl_opt %type ConcatExpression AdditiveExpression ModExpression IntdivExpression MultiplicativeExpression ExpExpression %type NotExpression UnaryExpression AndExpression OrExpression XorExpression EqvExpression %type ConstExpression NumericLiteralExpression @@ -138,13 +139,14 @@ static const WCHAR propertyW[] = {'p','r','o','p','e','r','t','y',0}; %type DimDeclList DimDecl %type DimList %type ConstDecl ConstDeclList -%type Identifier +%type Identifier DotIdentifier %type CaseClausules %% Program : OptionExplicit_opt SourceElements tEOF { parse_complete(ctx, $1); } + | tEXPRESSION ExpressionNl_opt tEOF { handle_isexpression_script(ctx, $2); } OptionExplicit_opt : /* empty */ { $$ = FALSE; } @@ -155,6 +157,15 @@ SourceElements | SourceElements StatementNl { source_add_statement(ctx, $2); } | SourceElements ClassDeclaration { source_add_class(ctx, $2); } +ExpressionNl_opt + : /* empty */ { $$ = NULL; } + | Expression tNL { $$ = $1; } + +BodyStatements + : /* empty */ { $$ = NULL; } + | Statement { $$ = $1; } + | StatementNl BodyStatements { $$ = link_statements($1, $2); } + StatementsNl_opt : /* empty */ { $$ = NULL; } | StatementsNl { $$ = $1; } @@ -210,7 +221,7 @@ SimpleStatement MemberExpression : Identifier { $$ = new_member_expression(ctx, NULL, $1); CHECK_ERROR; } - | CallExpression '.' Identifier { $$ = new_member_expression(ctx, $1, $3); CHECK_ERROR; } + | CallExpression '.' DotIdentifier { $$ = new_member_expression(ctx, $1, $3); CHECK_ERROR; } DimDeclList : DimDecl { $$ = $1; } @@ -366,6 +377,7 @@ UnaryExpression | CallExpression { $$ = $1; } | tNEW Identifier { $$ = new_new_expression(ctx, $2); CHECK_ERROR; } | '-' UnaryExpression { $$ = new_unary_expression(ctx, EXPR_NEG, $2); CHECK_ERROR; } + | '+' UnaryExpression { $$ = $2; } CallExpression : PrimaryExpression { $$ = $1; } @@ -381,15 +393,13 @@ LiteralExpression | tNOTHING { $$ = new_expression(ctx, EXPR_NOTHING, 0); CHECK_ERROR; } NumericLiteralExpression - : tShort { $$ = new_long_expression(ctx, EXPR_USHORT, $1); CHECK_ERROR; } - | '0' { $$ = new_long_expression(ctx, EXPR_USHORT, 0); CHECK_ERROR; } - | tLong { $$ = new_long_expression(ctx, EXPR_ULONG, $1); CHECK_ERROR; } + : '0' { $$ = new_long_expression(ctx, EXPR_INT, 0); CHECK_ERROR; } + | tInt { $$ = new_long_expression(ctx, EXPR_INT, $1); CHECK_ERROR; } | tDouble { $$ = new_double_expression(ctx, $1); CHECK_ERROR; } IntegerValue - : tShort { $$ = $1; } - | '0' { $$ = 0; } - | tLong { $$ = $1; } + : '0' { $$ = 0; } + | tInt { $$ = $1; } PrimaryExpression : '(' Expression ')' { $$ = new_unary_expression(ctx, EXPR_BRACKETS, $2); } @@ -400,25 +410,30 @@ ClassDeclaration ClassBody : /* empty */ { $$ = new_class_decl(ctx); } + | FunctionDecl { $$ = add_class_function(ctx, new_class_decl(ctx), $1); CHECK_ERROR; } | FunctionDecl StSep ClassBody { $$ = add_class_function(ctx, $3, $1); CHECK_ERROR; } /* FIXME: We should use DimDecl here to support arrays, but that conflicts with PropertyDecl. */ + | Storage tIdentifier { dim_decl_t *dim_decl = new_dim_decl(ctx, $2, FALSE, NULL); CHECK_ERROR; + $$ = add_dim_prop(ctx, new_class_decl(ctx), dim_decl, $1); CHECK_ERROR; } | Storage tIdentifier StSep ClassBody { dim_decl_t *dim_decl = new_dim_decl(ctx, $2, FALSE, NULL); CHECK_ERROR; $$ = add_dim_prop(ctx, $4, dim_decl, $1); CHECK_ERROR; } + | tDIM DimDecl { $$ = add_dim_prop(ctx, new_class_decl(ctx), $2, 0); CHECK_ERROR; } | tDIM DimDecl StSep ClassBody { $$ = add_dim_prop(ctx, $4, $2, 0); CHECK_ERROR; } + | PropertyDecl { $$ = add_class_function(ctx, new_class_decl(ctx), $1); CHECK_ERROR; } | PropertyDecl StSep ClassBody { $$ = add_class_function(ctx, $3, $1); CHECK_ERROR; } PropertyDecl - : Storage_opt tPROPERTY tGET tIdentifier ArgumentsDecl_opt StSep StatementsNl_opt tEND tPROPERTY + : Storage_opt tPROPERTY tGET tIdentifier ArgumentsDecl_opt StSep BodyStatements tEND tPROPERTY { $$ = new_function_decl(ctx, $4, FUNC_PROPGET, $1, $5, $7); CHECK_ERROR; } - | Storage_opt tPROPERTY tLET tIdentifier '(' ArgumentDecl ')' StSep StatementsNl_opt tEND tPROPERTY + | Storage_opt tPROPERTY tLET tIdentifier '(' ArgumentDecl ')' StSep BodyStatements tEND tPROPERTY { $$ = new_function_decl(ctx, $4, FUNC_PROPLET, $1, $6, $9); CHECK_ERROR; } - | Storage_opt tPROPERTY tSET tIdentifier '(' ArgumentDecl ')' StSep StatementsNl_opt tEND tPROPERTY + | Storage_opt tPROPERTY tSET tIdentifier '(' ArgumentDecl ')' StSep BodyStatements tEND tPROPERTY { $$ = new_function_decl(ctx, $4, FUNC_PROPSET, $1, $6, $9); CHECK_ERROR; } FunctionDecl - : Storage_opt tSUB Identifier ArgumentsDecl_opt StSep StatementsNl_opt tEND tSUB + : Storage_opt tSUB Identifier ArgumentsDecl_opt StSep BodyStatements tEND tSUB { $$ = new_function_decl(ctx, $3, FUNC_SUB, $1, $4, $6); CHECK_ERROR; } - | Storage_opt tFUNCTION Identifier ArgumentsDecl_opt StSep StatementsNl_opt tEND tFUNCTION + | Storage_opt tFUNCTION Identifier ArgumentsDecl_opt StSep BodyStatements tEND tFUNCTION { $$ = new_function_decl(ctx, $3, FUNC_FUNCTION, $1, $4, $6); CHECK_ERROR; } Storage_opt @@ -443,10 +458,67 @@ ArgumentDecl | tBYREF Identifier EmptyBrackets_opt { $$ = new_argument_decl(ctx, $2, TRUE); } | tBYVAL Identifier EmptyBrackets_opt { $$ = new_argument_decl(ctx, $2, FALSE); } -/* 'property' may be both keyword and identifier, depending on context */ +/* these keywords may also be an identifier, depending on context */ Identifier : tIdentifier { $$ = $1; } - | tPROPERTY { $$ = propertyW; } + | tDEFAULT { $$ = $1; } + | tERROR { $$ = $1; } + | tEXPLICIT { $$ = $1; } + | tPROPERTY { $$ = $1; } + | tSTEP { $$ = $1; } + +/* most keywords can be an identifier after a dot */ +DotIdentifier + : Identifier { $$ = $1; } + | tTRUE { $$ = $1; } + | tFALSE { $$ = $1; } + | tNOT { $$ = $1; } + | tAND { $$ = $1; } + | tOR { $$ = $1; } + | tXOR { $$ = $1; } + | tEQV { $$ = $1; } + | tIMP { $$ = $1; } + | tIS { $$ = $1; } + | tMOD { $$ = $1; } + | tCALL { $$ = $1; } + | tDIM { $$ = $1; } + | tSUB { $$ = $1; } + | tFUNCTION { $$ = $1; } + | tGET { $$ = $1; } + | tLET { $$ = $1; } + | tCONST { $$ = $1; } + | tIF { $$ = $1; } + | tELSE { $$ = $1; } + | tELSEIF { $$ = $1; } + | tEND { $$ = $1; } + | tTHEN { $$ = $1; } + | tEXIT { $$ = $1; } + | tWHILE { $$ = $1; } + | tWEND { $$ = $1; } + | tDO { $$ = $1; } + | tLOOP { $$ = $1; } + | tUNTIL { $$ = $1; } + | tFOR { $$ = $1; } + | tTO { $$ = $1; } + | tEACH { $$ = $1; } + | tIN { $$ = $1; } + | tSELECT { $$ = $1; } + | tCASE { $$ = $1; } + | tBYREF { $$ = $1; } + | tBYVAL { $$ = $1; } + | tOPTION { $$ = $1; } + | tNOTHING { $$ = $1; } + | tEMPTY { $$ = $1; } + | tNULL { $$ = $1; } + | tCLASS { $$ = $1; } + | tSET { $$ = $1; } + | tNEW { $$ = $1; } + | tPUBLIC { $$ = $1; } + | tPRIVATE { $$ = $1; } + | tNEXT { $$ = $1; } + | tON { $$ = $1; } + | tRESUME { $$ = $1; } + | tGOTO { $$ = $1; } /* Most statements accept both new line and ':' as separators */ StSep @@ -487,6 +559,22 @@ static void parse_complete(parser_ctx_t *ctx, BOOL option_explicit) ctx->option_explicit = option_explicit; } +static void handle_isexpression_script(parser_ctx_t *ctx, expression_t *expr) +{ + retval_statement_t *stat; + + ctx->parse_complete = TRUE; + if(!expr) + return; + + stat = new_statement(ctx, STAT_RETVAL, sizeof(*stat)); + if(!stat) + return; + + stat->expr = expr; + ctx->stats = &stat->stat; +} + static void *new_expression(parser_ctx_t *ctx, expression_type_t type, size_t size) { expression_t *expr; @@ -879,7 +967,7 @@ static class_decl_t *add_class_function(parser_ctx_t *ctx, class_decl_t *class_d function_decl_t *iter; for(iter = class_decl->funcs; iter; iter = iter->next) { - if(!strcmpiW(iter->name, decl->name)) { + if(!wcsicmp(iter->name, decl->name)) { if(decl->type == FUNC_SUB || decl->type == FUNC_FUNCTION) { FIXME("Redefinition of %s::%s\n", debugstr_w(class_decl->name), debugstr_w(decl->name)); ctx->hres = E_FAIL; @@ -967,12 +1055,12 @@ void *parser_alloc(parser_ctx_t *ctx, size_t size) return ret; } -HRESULT parse_script(parser_ctx_t *ctx, const WCHAR *code, const WCHAR *delimiter) +HRESULT parse_script(parser_ctx_t *ctx, const WCHAR *code, const WCHAR *delimiter, DWORD flags) { static const WCHAR html_delimiterW[] = {'<','/','s','c','r','i','p','t','>',0}; ctx->code = ctx->ptr = code; - ctx->end = ctx->code + strlenW(ctx->code); + ctx->end = ctx->code + lstrlenW(ctx->code); heap_pool_init(&ctx->heap); @@ -984,7 +1072,10 @@ HRESULT parse_script(parser_ctx_t *ctx, const WCHAR *code, const WCHAR *delimite ctx->stats = ctx->stats_tail = NULL; ctx->class_decls = NULL; ctx->option_explicit = FALSE; - ctx->is_html = delimiter && !strcmpiW(delimiter, html_delimiterW); + ctx->is_html = delimiter && !wcsicmp(delimiter, html_delimiterW); + + if(flags & SCRIPTTEXT_ISEXPRESSION) + ctx->last_token = tEXPRESSION; parser_parse(ctx); diff --git a/dll/win32/vbscript/regexp.c b/dll/win32/vbscript/regexp.c index 4777d5069e5..33eec2aa848 100644 --- a/dll/win32/vbscript/regexp.c +++ b/dll/win32/vbscript/regexp.c @@ -1142,8 +1142,8 @@ lexHex: for (i = rangeStart; i <= localMax; i++) { WCHAR uch, dch; - uch = toupperW(i); - dch = tolowerW(i); + uch = towupper(i); + dch = towlower(i); if(maxch < uch) maxch = uch; if(maxch < dch) @@ -1988,7 +1988,7 @@ FlatNIMatcher(REGlobalData *gData, match_state_t *x, const WCHAR *matchChars, if (length > (size_t)(gData->cpend - x->cp)) return NULL; for (i = 0; i != length; i++) { - if (toupperW(matchChars[i]) != toupperW(x->cp[i])) + if (towupper(matchChars[i]) != towupper(x->cp[i])) return NULL; } x->cp += length; @@ -2035,7 +2035,7 @@ BackrefMatcher(REGlobalData *gData, match_state_t *x, size_t parenIndex) parenContent = &gData->cpbegin[cap->index]; if (gData->regexp->flags & REG_FOLD) { for (i = 0; i < len; i++) { - if (toupperW(parenContent[i]) != toupperW(x->cp[i])) + if (towupper(parenContent[i]) != towupper(x->cp[i])) return NULL; } } else { @@ -2226,12 +2226,12 @@ ProcessCharSet(REGlobalData *gData, RECharSet *charSet) continue; case 's': for (i = (INT)charSet->length; i >= 0; i--) - if (isspaceW(i)) + if (iswspace(i)) AddCharacterToCharSet(charSet, (WCHAR)i); continue; case 'S': for (i = (INT)charSet->length; i >= 0; i--) - if (!isspaceW(i)) + if (!iswspace(i)) AddCharacterToCharSet(charSet, (WCHAR)i); continue; case 'w': @@ -2263,8 +2263,8 @@ ProcessCharSet(REGlobalData *gData, RECharSet *charSet) WCHAR uch, dch; AddCharacterToCharSet(charSet, i); - uch = toupperW(i); - dch = tolowerW(i); + uch = towupper(i); + dch = towlower(i); if (i != uch) AddCharacterToCharSet(charSet, uch); if (i != dch) @@ -2276,8 +2276,8 @@ ProcessCharSet(REGlobalData *gData, RECharSet *charSet) inRange = FALSE; } else { if (gData->regexp->flags & REG_FOLD) { - AddCharacterToCharSet(charSet, toupperW(thisCh)); - AddCharacterToCharSet(charSet, tolowerW(thisCh)); + AddCharacterToCharSet(charSet, towupper(thisCh)); + AddCharacterToCharSet(charSet, towlower(thisCh)); } else { AddCharacterToCharSet(charSet, thisCh); } @@ -2411,13 +2411,13 @@ SimpleMatch(REGlobalData *gData, match_state_t *x, REOp op, } break; case REOP_SPACE: - if (x->cp != gData->cpend && isspaceW(*x->cp)) { + if (x->cp != gData->cpend && iswspace(*x->cp)) { result = x; result->cp++; } break; case REOP_NONSPACE: - if (x->cp != gData->cpend && !isspaceW(*x->cp)) { + if (x->cp != gData->cpend && !iswspace(*x->cp)) { result = x; result->cp++; } @@ -2463,7 +2463,7 @@ SimpleMatch(REGlobalData *gData, match_state_t *x, REOp op, break; case REOP_FLAT1i: matchCh = *pc++; - if (x->cp != gData->cpend && toupperW(*x->cp) == toupperW(matchCh)) { + if (x->cp != gData->cpend && towupper(*x->cp) == towupper(matchCh)) { result = x; result->cp++; } @@ -2480,7 +2480,7 @@ SimpleMatch(REGlobalData *gData, match_state_t *x, REOp op, case REOP_UCFLAT1i: matchCh = GET_ARG(pc); pc += ARG_LEN; - if (x->cp != gData->cpend && toupperW(*x->cp) == toupperW(matchCh)) { + if (x->cp != gData->cpend && towupper(*x->cp) == towupper(matchCh)) { result = x; result->cp++; } diff --git a/dll/win32/vbscript/vbdisp.c b/dll/win32/vbscript/vbdisp.c index a836b1da7c0..a6896eb0268 100644 --- a/dll/win32/vbscript/vbdisp.c +++ b/dll/win32/vbscript/vbdisp.c @@ -47,7 +47,7 @@ static BOOL get_func_id(vbdisp_t *This, const WCHAR *name, vbdisp_invoke_type_t continue; } - if(!strcmpiW(This->desc->funcs[i].name, name)) { + if(!wcsicmp(This->desc->funcs[i].name, name)) { *id = i; return TRUE; } @@ -67,20 +67,12 @@ HRESULT vbdisp_get_id(vbdisp_t *This, BSTR name, vbdisp_invoke_type_t invoke_typ if(!search_private && !This->desc->props[i].is_public) continue; - if(!strcmpiW(This->desc->props[i].name, name)) { + if(!wcsicmp(This->desc->props[i].name, name)) { *id = i + This->desc->func_cnt; return S_OK; } } - if(This->desc->typeinfo) { - HRESULT hres; - - hres = ITypeInfo_GetIDsOfNames(This->desc->typeinfo, &name, 1, id); - if(SUCCEEDED(hres)) - return S_OK; - } - *id = -1; return DISP_E_UNKNOWNNAME; } @@ -169,83 +161,76 @@ static HRESULT invoke_variant_prop(script_ctx_t *ctx, VARIANT *v, WORD flags, DI return hres; } -static HRESULT invoke_builtin(vbdisp_t *This, const builtin_prop_t *prop, WORD flags, DISPPARAMS *dp, VARIANT *res) +static HRESULT invoke_vbdisp(vbdisp_t *This, DISPID id, DWORD flags, BOOL extern_caller, DISPPARAMS *params, VARIANT *res) { - VARIANT args[8]; - unsigned argn, i; + if(id < 0) + return DISP_E_MEMBERNOTFOUND; - switch(flags) { - case DISPATCH_PROPERTYGET: - if(!(prop->flags & (BP_GET|BP_GETPUT))) { - FIXME("property does not support DISPATCH_PROPERTYGET\n"); - return E_FAIL; - } - break; - case DISPATCH_PROPERTYGET|DISPATCH_METHOD: - if(!prop->proc && prop->flags == BP_GET) { - const int vt = prop->min_args, val = prop->max_args; - switch(vt) { - case VT_I2: - V_VT(res) = VT_I2; - V_I2(res) = val; - break; - case VT_I4: - V_VT(res) = VT_I4; - V_I4(res) = val; - break; - case VT_BSTR: { - const string_constant_t *str = (const string_constant_t*)prop->max_args; - BSTR ret; + if(is_func_id(This, id)) { + function_t *func; - ret = SysAllocStringLen(str->buf, str->len); - if(!ret) - return E_OUTOFMEMORY; + TRACE("%p->%s\n", This, debugstr_w(This->desc->funcs[id].name)); - V_VT(res) = VT_BSTR; - V_BSTR(res) = ret; - break; + switch(flags) { + case DISPATCH_PROPERTYGET: + func = This->desc->funcs[id].entries[VBDISP_CALLGET]; + if(!func || (func->type != FUNC_PROPGET && func->type != FUNC_DEFGET)) { + WARN("no getter\n"); + return DISP_E_MEMBERNOTFOUND; } - DEFAULT_UNREACHABLE; + + return exec_script(This->desc->ctx, extern_caller, func, This, params, res); + + case DISPATCH_METHOD: + case DISPATCH_METHOD|DISPATCH_PROPERTYGET: + func = This->desc->funcs[id].entries[VBDISP_CALLGET]; + if(!func) { + FIXME("no invoke/getter\n"); + return DISP_E_MEMBERNOTFOUND; } - return S_OK; - } - break; - case DISPATCH_METHOD: - if(prop->flags & (BP_GET|BP_GETPUT)) { - FIXME("Call on property\n"); - return E_FAIL; - } - break; - case DISPATCH_PROPERTYPUT: - if(!(prop->flags & BP_GETPUT)) { - FIXME("property does not support DISPATCH_PROPERTYPUT\n"); - return E_FAIL; - } - FIXME("call put\n"); - return E_NOTIMPL; - default: - FIXME("unsupported flags %x\n", flags); - return E_NOTIMPL; + return exec_script(This->desc->ctx, extern_caller, func, This, params, res); + + case DISPATCH_PROPERTYPUT: + case DISPATCH_PROPERTYPUTREF: + case DISPATCH_PROPERTYPUT|DISPATCH_PROPERTYPUTREF: { + DISPPARAMS dp = {NULL, NULL, 1, 0}; + BOOL needs_release; + VARIANT put_val; + HRESULT hres; + + if(arg_cnt(params)) { + FIXME("arguments not implemented\n"); + return E_NOTIMPL; + } + + hres = get_propput_arg(This->desc->ctx, params, flags, &put_val, &needs_release); + if(FAILED(hres)) + return hres; + + dp.rgvarg = &put_val; + func = This->desc->funcs[id].entries[V_VT(&put_val) == VT_DISPATCH ? VBDISP_SET : VBDISP_LET]; + if(!func) { + FIXME("no letter/setter\n"); + return DISP_E_MEMBERNOTFOUND; + } + + hres = exec_script(This->desc->ctx, extern_caller, func, This, &dp, NULL); + if(needs_release) + VariantClear(&put_val); + return hres; + } + default: + FIXME("flags %x\n", flags); + return DISP_E_MEMBERNOTFOUND; + } } - argn = arg_cnt(dp); + if(id >= This->desc->prop_cnt + This->desc->func_cnt) + return DISP_E_MEMBERNOTFOUND; - if(argn < prop->min_args || argn > (prop->max_args ? prop->max_args : prop->min_args)) { - FIXME("invalid number of arguments\n"); - return E_FAIL; - } - - assert(argn < ARRAY_SIZE(args)); - - for(i=0; i < argn; i++) { - if(V_VT(dp->rgvarg+dp->cArgs-i-1) == (VT_BYREF|VT_VARIANT)) - args[i] = *V_VARIANTREF(dp->rgvarg+dp->cArgs-i-1); - else - args[i] = dp->rgvarg[dp->cArgs-i-1]; - } - - return prop->proc(This, args, dp->cArgs, res); + TRACE("%p->%s\n", This, debugstr_w(This->desc->props[id - This->desc->func_cnt].name)); + return invoke_variant_prop(This->desc->ctx, This->props+(id-This->desc->func_cnt), flags, params, res); } static BOOL run_terminator(vbdisp_t *This) @@ -260,7 +245,7 @@ static BOOL run_terminator(vbdisp_t *This) return TRUE; This->ref++; - exec_script(This->desc->ctx, This->desc->funcs[This->desc->class_terminate_id].entries[VBDISP_CALLGET], + exec_script(This->desc->ctx, FALSE, This->desc->funcs[This->desc->class_terminate_id].entries[VBDISP_CALLGET], This, &dp, NULL); return !--This->ref; } @@ -412,84 +397,7 @@ static HRESULT WINAPI DispatchEx_InvokeEx(IDispatchEx *iface, DISPID id, LCID lc if(pvarRes) V_VT(pvarRes) = VT_EMPTY; - if(id < 0) - return DISP_E_MEMBERNOTFOUND; - - if(is_func_id(This, id)) { - function_t *func; - - switch(wFlags) { - case DISPATCH_PROPERTYGET: - func = This->desc->funcs[id].entries[VBDISP_CALLGET]; - if(!func || (func->type != FUNC_PROPGET && func->type != FUNC_DEFGET)) { - WARN("no getter\n"); - return DISP_E_MEMBERNOTFOUND; - } - - return exec_script(This->desc->ctx, func, This, pdp, pvarRes); - - case DISPATCH_METHOD: - case DISPATCH_METHOD|DISPATCH_PROPERTYGET: - func = This->desc->funcs[id].entries[VBDISP_CALLGET]; - if(!func) { - FIXME("no invoke/getter\n"); - return DISP_E_MEMBERNOTFOUND; - } - - return exec_script(This->desc->ctx, func, This, pdp, pvarRes); - case DISPATCH_PROPERTYPUT: - case DISPATCH_PROPERTYPUTREF: - case DISPATCH_PROPERTYPUT|DISPATCH_PROPERTYPUTREF: { - DISPPARAMS dp = {NULL, NULL, 1, 0}; - BOOL needs_release; - VARIANT put_val; - HRESULT hres; - - if(arg_cnt(pdp)) { - FIXME("arguments not implemented\n"); - return E_NOTIMPL; - } - - hres = get_propput_arg(This->desc->ctx, pdp, wFlags, &put_val, &needs_release); - if(FAILED(hres)) - return hres; - - dp.rgvarg = &put_val; - func = This->desc->funcs[id].entries[V_VT(&put_val) == VT_DISPATCH ? VBDISP_SET : VBDISP_LET]; - if(!func) { - FIXME("no letter/setter\n"); - return DISP_E_MEMBERNOTFOUND; - } - - hres = exec_script(This->desc->ctx, func, This, &dp, NULL); - if(needs_release) - VariantClear(&put_val); - return hres; - } - default: - FIXME("flags %x\n", wFlags); - return DISP_E_MEMBERNOTFOUND; - } - } - - if(id < This->desc->prop_cnt + This->desc->func_cnt) - return invoke_variant_prop(This->desc->ctx, This->props+(id-This->desc->func_cnt), wFlags, pdp, pvarRes); - - if(This->desc->builtin_prop_cnt) { - unsigned min = 0, max = This->desc->builtin_prop_cnt-1, i; - - while(min <= max) { - i = (min+max)/2; - if(This->desc->builtin_props[i].id == id) - return invoke_builtin(This, This->desc->builtin_props+i, wFlags, pdp, pvarRes); - if(This->desc->builtin_props[i].id < id) - min = i+1; - else - max = i-1; - } - } - - return DISP_E_MEMBERNOTFOUND; + return invoke_vbdisp(This, id, wFlags, TRUE, pdp, pvarRes); } static HRESULT WINAPI DispatchEx_DeleteMemberByName(IDispatchEx *iface, BSTR bstrName, DWORD grfdex) @@ -605,7 +513,7 @@ HRESULT create_vbdisp(const class_desc_t *desc, vbdisp_t **ret) if(SUCCEEDED(hres) && desc->class_initialize_id) { DISPPARAMS dp = {0}; - hres = exec_script(desc->ctx, desc->funcs[desc->class_initialize_id].entries[VBDISP_CALLGET], + hres = exec_script(desc->ctx, FALSE, desc->funcs[desc->class_initialize_id].entries[VBDISP_CALLGET], vbdisp, &dp, NULL); } @@ -618,52 +526,6 @@ HRESULT create_vbdisp(const class_desc_t *desc, vbdisp_t **ret) return S_OK; } -static HRESULT Procedure_invoke(vbdisp_t *This, VARIANT *args, unsigned args_cnt, VARIANT *res) -{ - script_ctx_t *ctx = This->desc->ctx; - HRESULT hres; - - TRACE("\n"); - - IActiveScriptSite_OnEnterScript(ctx->site); - hres = exec_script(ctx, This->desc->value_func, NULL, NULL, NULL); - IActiveScriptSite_OnLeaveScript(ctx->site); - - return hres; -} - -static const builtin_prop_t procedure_props[] = { - {DISPID_VALUE, Procedure_invoke, 0} -}; - -HRESULT create_procedure_disp(script_ctx_t *ctx, vbscode_t *code, IDispatch **ret) -{ - class_desc_t *desc; - vbdisp_t *vbdisp; - HRESULT hres; - - desc = heap_alloc_zero(sizeof(*desc)); - if(!desc) - return E_OUTOFMEMORY; - - desc->ctx = ctx; - desc->builtin_prop_cnt = ARRAY_SIZE(procedure_props); - desc->builtin_props = procedure_props; - desc->value_func = &code->main_code; - - hres = create_vbdisp(desc, &vbdisp); - if(FAILED(hres)) { - heap_free(desc); - return hres; - } - - desc->next = ctx->procs; - ctx->procs = desc; - - *ret = (IDispatch*)&vbdisp->IDispatchEx_iface; - return S_OK; -} - struct _ident_map_t { const WCHAR *name; BOOL is_var; @@ -823,14 +685,14 @@ static HRESULT WINAPI ScriptDisp_GetDispID(IDispatchEx *iface, BSTR bstrName, DW return E_UNEXPECTED; for(ident = This->ident_map; ident < This->ident_map+This->ident_map_cnt; ident++) { - if(!strcmpiW(ident->name, bstrName)) { + if(!wcsicmp(ident->name, bstrName)) { *pid = ident_to_id(This, ident); return S_OK; } } for(var = This->ctx->global_vars; var; var = var->next) { - if(!strcmpiW(var->name, bstrName)) { + if(!wcsicmp(var->name, bstrName)) { ident = add_ident(This, var->name); if(!ident) return E_OUTOFMEMORY; @@ -843,7 +705,7 @@ static HRESULT WINAPI ScriptDisp_GetDispID(IDispatchEx *iface, BSTR bstrName, DW } for(func = This->ctx->global_funcs; func; func = func->next) { - if(!strcmpiW(func->name, bstrName)) { + if(!wcsicmp(func->name, bstrName)) { ident = add_ident(This, func->name); if(!ident) return E_OUTOFMEMORY; @@ -884,9 +746,7 @@ static HRESULT WINAPI ScriptDisp_InvokeEx(IDispatchEx *iface, DISPID id, LCID lc switch(wFlags) { case DISPATCH_METHOD: case DISPATCH_METHOD|DISPATCH_PROPERTYGET: - IActiveScriptSite_OnEnterScript(This->ctx->site); - hres = exec_script(This->ctx, ident->u.func, NULL, pdp, pvarRes); - IActiveScriptSite_OnLeaveScript(This->ctx->site); + hres = exec_script(This->ctx, TRUE, ident->u.func, NULL, pdp, pvarRes); break; default: FIXME("Unsupported flags %x\n", wFlags); @@ -1079,6 +939,7 @@ HRESULT disp_call(script_ctx_t *ctx, IDispatch *disp, DISPID id, DISPPARAMS *dp, { const WORD flags = DISPATCH_METHOD|(retv ? DISPATCH_PROPERTYGET : 0); IDispatchEx *dispex; + vbdisp_t *vbdisp; EXCEPINFO ei; HRESULT hres; @@ -1086,6 +947,10 @@ HRESULT disp_call(script_ctx_t *ctx, IDispatch *disp, DISPID id, DISPPARAMS *dp, if(retv) V_VT(retv) = VT_EMPTY; + vbdisp = unsafe_impl_from_IDispatch(disp); + if(vbdisp && vbdisp->desc && vbdisp->desc->ctx == ctx) + return invoke_vbdisp(vbdisp, id, flags, FALSE, dp, retv); + hres = IDispatch_QueryInterface(disp, &IID_IDispatchEx, (void**)&dispex); if(FAILED(hres)) { UINT err = 0; @@ -1102,15 +967,22 @@ HRESULT disp_call(script_ctx_t *ctx, IDispatch *disp, DISPID id, DISPPARAMS *dp, HRESULT get_disp_value(script_ctx_t *ctx, IDispatch *disp, VARIANT *v) { DISPPARAMS dp = {NULL}; + if(!disp) + return MAKE_VBSERROR(VBSE_OBJECT_VARIABLE_NOT_SET); return disp_call(ctx, disp, DISPID_VALUE, &dp, v); } HRESULT disp_propput(script_ctx_t *ctx, IDispatch *disp, DISPID id, WORD flags, DISPPARAMS *dp) { IDispatchEx *dispex; + vbdisp_t *vbdisp; EXCEPINFO ei = {0}; HRESULT hres; + vbdisp = unsafe_impl_from_IDispatch(disp); + if(vbdisp && vbdisp->desc && vbdisp->desc->ctx == ctx) + return invoke_vbdisp(vbdisp, id, flags, FALSE, dp, NULL); + hres = IDispatch_QueryInterface(disp, &IID_IDispatchEx, (void**)&dispex); if(SUCCEEDED(hres)) { hres = IDispatchEx_InvokeEx(dispex, id, ctx->lcid, flags, dp, NULL, &ei, NULL /* FIXME! */); diff --git a/dll/win32/vbscript/vbregexp.c b/dll/win32/vbscript/vbregexp.c index 800ea5e74f4..3400e81066d 100644 --- a/dll/win32/vbscript/vbregexp.c +++ b/dll/win32/vbscript/vbregexp.c @@ -1335,7 +1335,7 @@ static HRESULT WINAPI RegExp2_Execute(IRegExp2 *iface, if(!This->regexp) { This->regexp = regexp_new(NULL, &This->pool, This->pattern, - strlenW(This->pattern), This->flags, FALSE); + lstrlenW(This->pattern), This->flags, FALSE); if(!This->regexp) return E_FAIL; }else { @@ -1402,7 +1402,7 @@ static HRESULT WINAPI RegExp2_Test(IRegExp2 *iface, BSTR sourceString, VARIANT_B if(!This->regexp) { This->regexp = regexp_new(NULL, &This->pool, This->pattern, - strlenW(This->pattern), This->flags, FALSE); + lstrlenW(This->pattern), This->flags, FALSE); if(!This->regexp) return E_FAIL; }else { diff --git a/dll/win32/vbscript/vbscript.c b/dll/win32/vbscript/vbscript.c index 06a855b2b37..56c53b40150 100644 --- a/dll/win32/vbscript/vbscript.c +++ b/dll/win32/vbscript/vbscript.c @@ -51,22 +51,26 @@ struct VBScript { LONG ref; - DWORD safeopt; SCRIPTSTATE state; - IActiveScriptSite *site; script_ctx_t *ctx; LONG thread_id; - LCID lcid; + BOOL is_initialized; }; +typedef struct { + IActiveScriptError IActiveScriptError_iface; + LONG ref; + EXCEPINFO ei; +} VBScriptError; + static void change_state(VBScript *This, SCRIPTSTATE state) { if(This->state == state) return; This->state = state; - if(This->site) - IActiveScriptSite_OnStateChange(This->site, state); + if(This->ctx->site) + IActiveScriptSite_OnStateChange(This->ctx->site, state); } static inline BOOL is_started(VBScript *This) @@ -76,17 +80,10 @@ static inline BOOL is_started(VBScript *This) || This->state == SCRIPTSTATE_DISCONNECTED; } -static HRESULT exec_global_code(script_ctx_t *ctx, vbscode_t *code) +static HRESULT exec_global_code(script_ctx_t *ctx, vbscode_t *code, VARIANT *res) { - HRESULT hres; - code->pending_exec = FALSE; - - IActiveScriptSite_OnEnterScript(ctx->site); - hres = exec_script(ctx, &code->main_code, NULL, NULL, NULL); - IActiveScriptSite_OnLeaveScript(ctx->site); - - return hres; + return exec_script(ctx, TRUE, &code->main_code, NULL, NULL, res); } static void exec_queued_code(script_ctx_t *ctx) @@ -95,7 +92,7 @@ static void exec_queued_code(script_ctx_t *ctx) LIST_FOR_EACH_ENTRY(iter, &ctx->code_list, vbscode_t, entry) { if(iter->pending_exec) - exec_global_code(ctx, iter); + exec_global_code(ctx, iter, NULL); } } @@ -105,7 +102,7 @@ IDispatch *lookup_named_item(script_ctx_t *ctx, const WCHAR *name, unsigned flag HRESULT hres; LIST_FOR_EACH_ENTRY(item, &ctx->named_items, named_item_t, entry) { - if((item->flags & flags) == flags && !strcmpiW(item->name, name)) { + if((item->flags & flags) == flags && !wcsicmp(item->name, name)) { if(!item->disp) { IUnknown *unk; @@ -131,28 +128,12 @@ IDispatch *lookup_named_item(script_ctx_t *ctx, const WCHAR *name, unsigned flag return NULL; } -static HRESULT set_ctx_site(VBScript *This) -{ - HRESULT hres; - - This->ctx->lcid = This->lcid; - - hres = init_global(This->ctx); - if(FAILED(hres)) - return hres; - - IActiveScriptSite_AddRef(This->site); - This->ctx->site = This->site; - - change_state(This, SCRIPTSTATE_INITIALIZED); - return S_OK; -} - static void release_script(script_ctx_t *ctx) { class_desc_t *class_desc; collect_objects(ctx); + clear_ei(&ctx->ei); release_dynamic_vars(ctx->global_vars); ctx->global_vars = NULL; @@ -189,16 +170,6 @@ static void release_script(script_ctx_t *ctx) ctx->site = NULL; } - if(ctx->err_obj) { - IDispatchEx_Release(&ctx->err_obj->IDispatchEx_iface); - ctx->err_obj = NULL; - } - - if(ctx->global_obj) { - IDispatchEx_Release(&ctx->global_obj->IDispatchEx_iface); - ctx->global_obj = NULL; - } - if(ctx->script_obj) { ScriptDisp *script_obj = ctx->script_obj; @@ -207,6 +178,7 @@ static void release_script(script_ctx_t *ctx) IDispatchEx_Release(&script_obj->IDispatchEx_iface); } + detach_global_objects(ctx); heap_pool_free(&ctx->heap); heap_pool_init(&ctx->heap); } @@ -238,15 +210,7 @@ static void decrease_state(VBScript *This, SCRIPTSTATE state) case SCRIPTSTATE_INITIALIZED: case SCRIPTSTATE_UNINITIALIZED: change_state(This, state); - - if(This->site) { - IActiveScriptSite_Release(This->site); - This->site = NULL; - } - - if(This->ctx) - release_script(This->ctx); - + release_script(This->ctx); This->thread_id = 0; break; case SCRIPTSTATE_CLOSED: @@ -255,6 +219,118 @@ static void decrease_state(VBScript *This, SCRIPTSTATE state) } } +static inline VBScriptError *impl_from_IActiveScriptError(IActiveScriptError *iface) +{ + return CONTAINING_RECORD(iface, VBScriptError, IActiveScriptError_iface); +} + +static HRESULT WINAPI VBScriptError_QueryInterface(IActiveScriptError *iface, REFIID riid, void **ppv) +{ + VBScriptError *This = impl_from_IActiveScriptError(iface); + + if(IsEqualGUID(riid, &IID_IUnknown)) { + TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv); + *ppv = &This->IActiveScriptError_iface; + }else if(IsEqualGUID(riid, &IID_IActiveScriptError)) { + TRACE("(%p)->(IID_IActiveScriptError %p)\n", This, ppv); + *ppv = &This->IActiveScriptError_iface; + }else { + FIXME("(%p)->(%s %p)\n", This, debugstr_guid(riid), ppv); + *ppv = NULL; + return E_NOINTERFACE; + } + + IUnknown_AddRef((IUnknown*)*ppv); + return S_OK; +} + +static ULONG WINAPI VBScriptError_AddRef(IActiveScriptError *iface) +{ + VBScriptError *This = impl_from_IActiveScriptError(iface); + LONG ref = InterlockedIncrement(&This->ref); + + TRACE("(%p) ref=%d\n", This, ref); + + return ref; +} + +static ULONG WINAPI VBScriptError_Release(IActiveScriptError *iface) +{ + VBScriptError *This = impl_from_IActiveScriptError(iface); + LONG ref = InterlockedDecrement(&This->ref); + + TRACE("(%p) ref=%d\n", This, ref); + + if(!ref) { + heap_free(This); + } + + return ref; +} + +static HRESULT WINAPI VBScriptError_GetExceptionInfo(IActiveScriptError *iface, EXCEPINFO *excepinfo) +{ + VBScriptError *This = impl_from_IActiveScriptError(iface); + + TRACE("(%p)->(%p)\n", This, excepinfo); + + *excepinfo = This->ei; + excepinfo->bstrSource = SysAllocString(This->ei.bstrSource); + excepinfo->bstrDescription = SysAllocString(This->ei.bstrDescription); + excepinfo->bstrHelpFile = SysAllocString(This->ei.bstrHelpFile); + return S_OK; +} + +static HRESULT WINAPI VBScriptError_GetSourcePosition(IActiveScriptError *iface, DWORD *source_context, ULONG *line, LONG *character) +{ + VBScriptError *This = impl_from_IActiveScriptError(iface); + + FIXME("(%p)->(%p %p %p)\n", This, source_context, line, character); + + if(source_context) + *source_context = 0; + if(line) + *line = 0; + if(character) + *character = 0; + return S_OK; +} + +static HRESULT WINAPI VBScriptError_GetSourceLineText(IActiveScriptError *iface, BSTR *source) +{ + VBScriptError *This = impl_from_IActiveScriptError(iface); + FIXME("(%p)->(%p)\n", This, source); + return E_NOTIMPL; +} + +static const IActiveScriptErrorVtbl VBScriptErrorVtbl = { + VBScriptError_QueryInterface, + VBScriptError_AddRef, + VBScriptError_Release, + VBScriptError_GetExceptionInfo, + VBScriptError_GetSourcePosition, + VBScriptError_GetSourceLineText +}; + +HRESULT report_script_error(script_ctx_t *ctx) +{ + VBScriptError *error; + HRESULT hres, result; + + if(!(error = heap_alloc(sizeof(*error)))) + return E_OUTOFMEMORY; + error->IActiveScriptError_iface.lpVtbl = &VBScriptErrorVtbl; + + error->ref = 1; + error->ei = ctx->ei; + memset(&ctx->ei, 0, sizeof(ctx->ei)); + result = error->ei.scode; + + hres = IActiveScriptSite_OnScriptError(ctx->site, &error->IActiveScriptError_iface); + IActiveScriptError_Release(&error->IActiveScriptError_iface); + return hres == S_OK ? SCRIPT_E_REPORTED : result; +} + static inline VBScript *impl_from_IActiveScript(IActiveScript *iface) { return CONTAINING_RECORD(iface, VBScript, IActiveScript_iface); @@ -310,13 +386,8 @@ static ULONG WINAPI VBScript_Release(IActiveScript *iface) TRACE("(%p) ref=%d\n", iface, ref); if(!ref) { - if(This->ctx) { - decrease_state(This, SCRIPTSTATE_CLOSED); - destroy_script(This->ctx); - This->ctx = NULL; - } - if(This->site) - IActiveScriptSite_Release(This->site); + decrease_state(This, SCRIPTSTATE_CLOSED); + destroy_script(This->ctx); heap_free(This); } @@ -334,20 +405,26 @@ static HRESULT WINAPI VBScript_SetScriptSite(IActiveScript *iface, IActiveScript if(!pass) return E_POINTER; - if(This->site) + if(This->ctx->site) return E_UNEXPECTED; if(InterlockedCompareExchange(&This->thread_id, GetCurrentThreadId(), 0)) return E_UNEXPECTED; - This->site = pass; - IActiveScriptSite_AddRef(This->site); + hres = create_script_disp(This->ctx, &This->ctx->script_obj); + if(FAILED(hres)) + return hres; - hres = IActiveScriptSite_GetLCID(This->site, &lcid); + This->ctx->site = pass; + IActiveScriptSite_AddRef(This->ctx->site); + + hres = IActiveScriptSite_GetLCID(This->ctx->site, &lcid); if(hres == S_OK) - This->lcid = lcid; + This->ctx->lcid = lcid; - return This->ctx ? set_ctx_site(This) : S_OK; + if(This->is_initialized) + change_state(This, SCRIPTSTATE_INITIALIZED); + return S_OK; } static HRESULT WINAPI VBScript_GetScriptSite(IActiveScript *iface, REFIID riid, @@ -375,7 +452,7 @@ static HRESULT WINAPI VBScript_SetScriptState(IActiveScript *iface, SCRIPTSTATE return S_OK; } - if(!This->ctx) + if(!This->is_initialized) return E_UNEXPECTED; switch(ss) { @@ -439,13 +516,13 @@ static HRESULT WINAPI VBScript_AddNamedItem(IActiveScript *iface, LPCOLESTR pstr TRACE("(%p)->(%s %x)\n", This, debugstr_w(pstrName), dwFlags); - if(This->thread_id != GetCurrentThreadId() || !This->ctx || This->state == SCRIPTSTATE_CLOSED) + if(This->thread_id != GetCurrentThreadId() || !This->ctx->site) return E_UNEXPECTED; if(dwFlags & SCRIPTITEM_GLOBALMEMBERS) { IUnknown *unk; - hres = IActiveScriptSite_GetItemInfo(This->site, pstrName, SCRIPTINFO_IUNKNOWN, &unk, NULL); + hres = IActiveScriptSite_GetItemInfo(This->ctx->site, pstrName, SCRIPTINFO_IUNKNOWN, &unk, NULL); if(FAILED(hres)) { WARN("GetItemInfo failed: %08x\n", hres); return hres; @@ -502,7 +579,7 @@ static HRESULT WINAPI VBScript_GetScriptDispatch(IActiveScript *iface, LPCOLESTR if(!ppdisp) return E_POINTER; - if(This->thread_id != GetCurrentThreadId() || !This->ctx || !This->ctx->script_obj) { + if(This->thread_id != GetCurrentThreadId() || !This->ctx->script_obj) { *ppdisp = NULL; return E_UNEXPECTED; } @@ -654,30 +731,16 @@ static ULONG WINAPI VBScriptParse_Release(IActiveScriptParse *iface) static HRESULT WINAPI VBScriptParse_InitNew(IActiveScriptParse *iface) { VBScript *This = impl_from_IActiveScriptParse(iface); - script_ctx_t *ctx, *old_ctx; TRACE("(%p)\n", This); - if(This->ctx) + if(This->is_initialized) return E_UNEXPECTED; + This->is_initialized = TRUE; - ctx = heap_alloc_zero(sizeof(script_ctx_t)); - if(!ctx) - return E_OUTOFMEMORY; - - ctx->safeopt = This->safeopt; - heap_pool_init(&ctx->heap); - list_init(&ctx->objects); - list_init(&ctx->code_list); - list_init(&ctx->named_items); - - old_ctx = InterlockedCompareExchangePointer((void**)&This->ctx, ctx, NULL); - if(old_ctx) { - destroy_script(ctx); - return E_UNEXPECTED; - } - - return This->site ? set_ctx_site(This) : S_OK; + if(This->ctx->site) + change_state(This, SCRIPTSTATE_INITIALIZED); + return S_OK; } static HRESULT WINAPI VBScriptParse_AddScriptlet(IActiveScriptParse *iface, @@ -719,19 +782,19 @@ static HRESULT WINAPI VBScriptParse_ParseScriptText(IActiveScriptParse *iface, } } - hres = compile_script(This->ctx, pstrCode, pstrDelimiter, &code); + hres = compile_script(This->ctx, pstrCode, pstrDelimiter, dwFlags, &code); if(FAILED(hres)) return hres; if(context) IDispatch_AddRef(code->context = context); - if(!is_started(This)) { + if(!(dwFlags & SCRIPTTEXT_ISEXPRESSION) && !is_started(This)) { code->pending_exec = TRUE; return S_OK; } - return exec_global_code(This->ctx, code); + return exec_global_code(This->ctx, code, pvarResult); } static const IActiveScriptParseVtbl VBScriptParseVtbl = { @@ -772,7 +835,8 @@ static HRESULT WINAPI VBScriptParseProcedure_ParseProcedureText(IActiveScriptPar CTXARG_T dwSourceContextCookie, ULONG ulStartingLineNumber, DWORD dwFlags, IDispatch **ppdisp) { VBScript *This = impl_from_IActiveScriptParseProcedure2(iface); - vbscode_t *code; + class_desc_t *desc; + vbdisp_t *vbdisp; HRESULT hres; TRACE("(%p)->(%s %s %s %s %p %s %s %u %x %p)\n", This, debugstr_w(pstrCode), debugstr_w(pstrFormalParams), @@ -782,11 +846,16 @@ static HRESULT WINAPI VBScriptParseProcedure_ParseProcedureText(IActiveScriptPar if(This->thread_id != GetCurrentThreadId() || This->state == SCRIPTSTATE_CLOSED) return E_UNEXPECTED; - hres = compile_script(This->ctx, pstrCode, pstrDelimiter, &code); + hres = compile_procedure(This->ctx, pstrCode, pstrDelimiter, dwFlags, &desc); if(FAILED(hres)) return hres; - return create_procedure_disp(This->ctx, code, ppdisp); + hres = create_vbdisp(desc, &vbdisp); + if(FAILED(hres)) + return hres; + + *ppdisp = (IDispatch*)&vbdisp->IDispatchEx_iface; + return S_OK; } static const IActiveScriptParseProcedure2Vtbl VBScriptParseProcedureVtbl = { @@ -832,7 +901,7 @@ static HRESULT WINAPI VBScriptSafety_GetInterfaceSafetyOptions(IObjectSafety *if return E_POINTER; *pdwSupportedOptions = SUPPORTED_OPTIONS; - *pdwEnabledOptions = This->safeopt; + *pdwEnabledOptions = This->ctx->safeopt; return S_OK; } @@ -846,7 +915,7 @@ static HRESULT WINAPI VBScriptSafety_SetInterfaceSafetyOptions(IObjectSafety *if if(dwOptionSetMask & ~SUPPORTED_OPTIONS) return E_FAIL; - This->safeopt = (dwEnabledOptions & dwOptionSetMask) | (This->safeopt & ~dwOptionSetMask) | INTERFACE_USES_DISPEX; + This->ctx->safeopt = (dwEnabledOptions & dwOptionSetMask) | (This->ctx->safeopt & ~dwOptionSetMask) | INTERFACE_USES_DISPEX; return S_OK; } @@ -860,6 +929,7 @@ static const IObjectSafetyVtbl VBScriptSafetyVtbl = { HRESULT WINAPI VBScriptFactory_CreateInstance(IClassFactory *iface, IUnknown *pUnkOuter, REFIID riid, void **ppv) { + script_ctx_t *ctx; VBScript *ret; HRESULT hres; @@ -877,7 +947,24 @@ HRESULT WINAPI VBScriptFactory_CreateInstance(IClassFactory *iface, IUnknown *pU ret->ref = 1; ret->state = SCRIPTSTATE_UNINITIALIZED; - ret->safeopt = INTERFACE_USES_DISPEX; + + ctx = ret->ctx = heap_alloc_zero(sizeof(*ctx)); + if(!ctx) { + heap_free(ret); + return E_OUTOFMEMORY; + } + + ctx->safeopt = INTERFACE_USES_DISPEX; + heap_pool_init(&ctx->heap); + list_init(&ctx->objects); + list_init(&ctx->code_list); + list_init(&ctx->named_items); + + hres = init_global(ctx); + if(FAILED(hres)) { + IActiveScript_Release(&ret->IActiveScript_iface); + return hres; + } hres = IActiveScript_QueryInterface(&ret->IActiveScript_iface, riid, ppv); IActiveScript_Release(&ret->IActiveScript_iface); diff --git a/dll/win32/vbscript/vbscript.h b/dll/win32/vbscript/vbscript.h index 5558dc3e87b..2fcb545ae13 100644 --- a/dll/win32/vbscript/vbscript.h +++ b/dll/win32/vbscript/vbscript.h @@ -19,6 +19,7 @@ #pragma once #include +#include #define COBJMACROS @@ -33,10 +34,10 @@ #include #endif #include "vbscript_classes.h" +#include "vbscript_defs.h" #include "wine/heap.h" #include "wine/list.h" -#include "wine/unicode.h" typedef struct { void **blocks; @@ -92,17 +93,6 @@ typedef struct { function_t *entries[VBDISP_ANY]; } vbdisp_funcprop_desc_t; -#define BP_GET 1 -#define BP_GETPUT 2 - -typedef struct { - DISPID id; - HRESULT (*proc)(vbdisp_t*,VARIANT*,unsigned,VARIANT*); - DWORD flags; - unsigned min_args; - UINT_PTR max_args; -} builtin_prop_t; - typedef struct _class_desc_t { const WCHAR *name; script_ctx_t *ctx; @@ -118,9 +108,6 @@ typedef struct _class_desc_t { unsigned array_cnt; array_desc_t *array_descs; - unsigned builtin_prop_cnt; - const builtin_prop_t *builtin_props; - ITypeInfo *typeinfo; function_t *value_func; struct _class_desc_t *next; @@ -151,6 +138,16 @@ typedef struct { script_ctx_t *ctx; } ScriptDisp; +typedef struct _builtin_prop_t builtin_prop_t; + +typedef struct { + IDispatch IDispatch_iface; + LONG ref; + size_t member_cnt; + const builtin_prop_t *members; + script_ctx_t *ctx; +} BuiltinDisp; + HRESULT create_vbdisp(const class_desc_t*,vbdisp_t**) DECLSPEC_HIDDEN; HRESULT disp_get_id(IDispatch*,BSTR,vbdisp_invoke_type_t,BOOL,DISPID*) DECLSPEC_HIDDEN; HRESULT vbdisp_get_id(vbdisp_t*,BSTR,vbdisp_invoke_type_t,BOOL,DISPID*) DECLSPEC_HIDDEN; @@ -158,7 +155,6 @@ HRESULT disp_call(script_ctx_t*,IDispatch*,DISPID,DISPPARAMS*,VARIANT*) DECLSPEC HRESULT disp_propput(script_ctx_t*,IDispatch*,DISPID,WORD,DISPPARAMS*) DECLSPEC_HIDDEN; HRESULT get_disp_value(script_ctx_t*,IDispatch*,VARIANT*) DECLSPEC_HIDDEN; void collect_objects(script_ctx_t*) DECLSPEC_HIDDEN; -HRESULT create_procedure_disp(script_ctx_t*,vbscode_t*,IDispatch**) DECLSPEC_HIDDEN; HRESULT create_script_disp(script_ctx_t*,ScriptDisp**) DECLSPEC_HIDDEN; HRESULT to_int(VARIANT*,int*) DECLSPEC_HIDDEN; @@ -191,13 +187,10 @@ struct _script_ctx_t { ScriptDisp *script_obj; - class_desc_t global_desc; - vbdisp_t *global_obj; + BuiltinDisp *global_obj; + BuiltinDisp *err_obj; - class_desc_t err_desc; - vbdisp_t *err_obj; - - HRESULT err_number; + EXCEPINFO ei; dynamic_var_t *global_vars; function_t *global_funcs; @@ -253,11 +246,11 @@ typedef enum { X(idiv, 1, 0, 0) \ X(imp, 1, 0, 0) \ X(incc, 1, ARG_BSTR, 0) \ + X(int, 1, ARG_INT, 0) \ X(is, 1, 0, 0) \ X(jmp, 0, ARG_ADDR, 0) \ X(jmp_false, 0, ARG_ADDR, 0) \ X(jmp_true, 0, ARG_ADDR, 0) \ - X(long, 1, ARG_INT, 0) \ X(lt, 1, 0, 0) \ X(lteq, 1, 0, 0) \ X(mcall, 1, ARG_BSTR, ARG_UINT) \ @@ -275,9 +268,9 @@ typedef enum { X(or, 1, 0, 0) \ X(pop, 1, ARG_UINT, 0) \ X(ret, 0, 0, 0) \ + X(retval, 1, 0, 0) \ X(set_ident, 1, ARG_BSTR, ARG_UINT) \ X(set_member, 1, ARG_BSTR, ARG_UINT) \ - X(short, 1, ARG_INT, 0) \ X(step, 0, ARG_ADDR, ARG_BSTR) \ X(stop, 1, 0, 0) \ X(string, 1, ARG_STR, 0) \ @@ -359,38 +352,18 @@ struct _vbscode_t { }; void release_vbscode(vbscode_t*) DECLSPEC_HIDDEN; -HRESULT compile_script(script_ctx_t*,const WCHAR*,const WCHAR*,vbscode_t**) DECLSPEC_HIDDEN; -HRESULT exec_script(script_ctx_t*,function_t*,vbdisp_t*,DISPPARAMS*,VARIANT*) DECLSPEC_HIDDEN; +HRESULT compile_script(script_ctx_t*,const WCHAR*,const WCHAR*,DWORD,vbscode_t**) DECLSPEC_HIDDEN; +HRESULT compile_procedure(script_ctx_t*,const WCHAR*,const WCHAR*,DWORD,class_desc_t**) DECLSPEC_HIDDEN; +HRESULT exec_script(script_ctx_t*,BOOL,function_t*,vbdisp_t*,DISPPARAMS*,VARIANT*) DECLSPEC_HIDDEN; void release_dynamic_vars(dynamic_var_t*) DECLSPEC_HIDDEN; IDispatch *lookup_named_item(script_ctx_t*,const WCHAR*,unsigned) DECLSPEC_HIDDEN; +void clear_ei(EXCEPINFO*) DECLSPEC_HIDDEN; +HRESULT report_script_error(script_ctx_t*) DECLSPEC_HIDDEN; +void detach_global_objects(script_ctx_t*) DECLSPEC_HIDDEN; +HRESULT get_builtin_id(BuiltinDisp*,const WCHAR*,DISPID*) DECLSPEC_HIDDEN; -typedef struct { - UINT16 len; - WCHAR buf[7]; -} string_constant_t; - -#define TID_LIST \ - XDIID(ErrObj) \ - XDIID(GlobalObj) - -typedef enum { -#define XDIID(iface) iface ## _tid, -TID_LIST -#undef XDIID - LAST_tid -} tid_t; - -HRESULT get_typeinfo(tid_t,ITypeInfo**) DECLSPEC_HIDDEN; void release_regexp_typelib(void) DECLSPEC_HIDDEN; -#ifndef INT32_MIN -#define INT32_MIN (-2147483647-1) -#endif - -#ifndef INT32_MAX -#define INT32_MAX (2147483647) -#endif - static inline BOOL is_int32(double d) { return INT32_MIN <= d && d <= INT32_MAX && (double)(int)d == d; @@ -405,40 +378,12 @@ HRESULT create_safearray_iter(SAFEARRAY *sa, IEnumVARIANT **ev) DECLSPEC_HIDDEN; #define FACILITY_VBS 0xa #define MAKE_VBSERROR(code) MAKE_HRESULT(SEVERITY_ERROR, FACILITY_VBS, code) -#define VBSE_ILLEGAL_FUNC_CALL 5 -#define VBSE_OVERFLOW 6 -#define VBSE_OUT_OF_MEMORY 7 -#define VBSE_OUT_OF_BOUNDS 9 -#define VBSE_ARRAY_LOCKED 10 -#define VBSE_TYPE_MISMATCH 13 -#define VBSE_FILE_NOT_FOUND 53 -#define VBSE_IO_ERROR 57 -#define VBSE_FILE_ALREADY_EXISTS 58 -#define VBSE_DISK_FULL 61 -#define VBSE_TOO_MANY_FILES 67 -#define VBSE_PERMISSION_DENIED 70 -#define VBSE_PATH_FILE_ACCESS 75 -#define VBSE_PATH_NOT_FOUND 76 -#define VBSE_ILLEGAL_NULL_USE 94 -#define VBSE_OLE_NOT_SUPPORTED 430 -#define VBSE_OLE_NO_PROP_OR_METHOD 438 -#define VBSE_ACTION_NOT_SUPPORTED 445 -#define VBSE_NAMED_ARGS_NOT_SUPPORTED 446 -#define VBSE_LOCALE_SETTING_NOT_SUPPORTED 447 -#define VBSE_NAMED_PARAM_NOT_FOUND 448 -#define VBSE_INVALID_TYPELIB_VARIABLE 458 -#define VBSE_FUNC_ARITY_MISMATCH 450 -#define VBSE_PARAMETER_NOT_OPTIONAL 449 -#define VBSE_NOT_ENUM 451 -#define VBSE_INVALID_DLL_FUNCTION_NAME 453 -#define VBSE_CANT_CREATE_TMP_FILE 322 -#define VBSE_OLE_FILE_NOT_FOUND 432 -#define VBSE_CANT_CREATE_OBJECT 429 -#define VBSE_SERVER_NOT_FOUND 462 - HRESULT WINAPI VBScriptFactory_CreateInstance(IClassFactory*,IUnknown*,REFIID,void**) DECLSPEC_HIDDEN; HRESULT WINAPI VBScriptRegExpFactory_CreateInstance(IClassFactory*,IUnknown*,REFIID,void**) DECLSPEC_HIDDEN; +BSTR get_vbscript_string(int) DECLSPEC_HIDDEN; +BSTR get_vbscript_error_string(HRESULT) DECLSPEC_HIDDEN; + static inline LPWSTR heap_strdupW(LPCWSTR str) { LPWSTR ret = NULL; @@ -446,7 +391,7 @@ static inline LPWSTR heap_strdupW(LPCWSTR str) if(str) { DWORD size; - size = (strlenW(str)+1)*sizeof(WCHAR); + size = (lstrlenW(str)+1)*sizeof(WCHAR); ret = heap_alloc(size); if(ret) memcpy(ret, str, size); diff --git a/dll/win32/vbscript/vbscript.rc b/dll/win32/vbscript/vbscript.rc index 7f03c04160e..bcd3c185778 100644 --- a/dll/win32/vbscript/vbscript.rc +++ b/dll/win32/vbscript/vbscript.rc @@ -17,6 +17,48 @@ */ #include +#include "vbscript_defs.h" + +LANGUAGE LANG_ENGLISH, SUBLANG_DEFAULT + +STRINGTABLE +{ + VBSE_ILLEGAL_FUNC_CALL "Invalid procedure call or argument" + VBSE_OVERFLOW "Overflow" + VBSE_OUT_OF_MEMORY "Out of memory" + VBSE_OUT_OF_BOUNDS "Subscript out of range" + VBSE_ARRAY_LOCKED "This array is fixed or temporarily locked" + VBSE_TYPE_MISMATCH "Type mismatch" + VBSE_FILE_NOT_FOUND "File not found" + VBSE_IO_ERROR "Device I/O error" + VBSE_FILE_ALREADY_EXISTS "File already exists" + VBSE_DISK_FULL "Disk full" + VBSE_TOO_MANY_FILES "Too many files" + VBSE_PERMISSION_DENIED "Permission denied" + VBSE_PATH_FILE_ACCESS "Path/File access error" + VBSE_PATH_NOT_FOUND "Path not found" + VBSE_OBJECT_VARIABLE_NOT_SET "Object variable not set" + VBSE_ILLEGAL_NULL_USE "Invalid use of Null" + VBSE_CANT_CREATE_TMP_FILE "Can't create necessary temporary file" + VBSE_CANT_CREATE_OBJECT "ActiveX component can't create object" + VBSE_OLE_NOT_SUPPORTED "Class doesn't support Automation" + VBSE_OLE_FILE_NOT_FOUND "File name or class name not found during Automation operation" + VBSE_OLE_NO_PROP_OR_METHOD "Object doesn't support this property or method" + VBSE_ACTION_NOT_SUPPORTED "Object doesn't support this action" + VBSE_NAMED_ARGS_NOT_SUPPORTED "Object doesn't support named arguments" + VBSE_LOCALE_SETTING_NOT_SUPPORTED "Object doesn't support current locale setting" + VBSE_NAMED_PARAM_NOT_FOUND "Named argument not found" + VBSE_PARAMETER_NOT_OPTIONAL "Named argument not found" + VBSE_FUNC_ARITY_MISMATCH "Wrong number of arguments or invalid property assignment" + VBSE_NOT_ENUM "Object not a collection" + VBSE_INVALID_DLL_FUNCTION_NAME "Specified DLL function not found" + VBSE_INVALID_TYPELIB_VARIABLE "Variable uses an Automation type not supported in VBScript" + VBSE_SERVER_NOT_FOUND "The remote server machine does not exist or is unavailable" + + VBS_COMPILE_ERROR "Microsoft VBScript compilation error" + VBS_RUNTIME_ERROR "Microsoft VBScript runtime error" + VBS_UNKNOWN_RUNTIME_ERROR "Unknown runtime error" +} LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL diff --git a/dll/win32/vbscript/vbscript_defs.h b/dll/win32/vbscript/vbscript_defs.h index b4b904a0103..44f005b640f 100644 --- a/dll/win32/vbscript/vbscript_defs.h +++ b/dll/win32/vbscript/vbscript_defs.h @@ -234,3 +234,40 @@ #define DISPID_REGEXP_TEST 10005 #define DISPID_REGEXP_REPLACE 10006 #define DISPID_REGEXP_MULTILINE 10007 + +/* error codes */ +#define VBSE_ILLEGAL_FUNC_CALL 5 +#define VBSE_OVERFLOW 6 +#define VBSE_OUT_OF_MEMORY 7 +#define VBSE_OUT_OF_BOUNDS 9 +#define VBSE_ARRAY_LOCKED 10 +#define VBSE_TYPE_MISMATCH 13 +#define VBSE_FILE_NOT_FOUND 53 +#define VBSE_IO_ERROR 57 +#define VBSE_FILE_ALREADY_EXISTS 58 +#define VBSE_DISK_FULL 61 +#define VBSE_TOO_MANY_FILES 67 +#define VBSE_PERMISSION_DENIED 70 +#define VBSE_PATH_FILE_ACCESS 75 +#define VBSE_PATH_NOT_FOUND 76 +#define VBSE_OBJECT_VARIABLE_NOT_SET 91 +#define VBSE_ILLEGAL_NULL_USE 94 +#define VBSE_CANT_CREATE_TMP_FILE 322 +#define VBSE_CANT_CREATE_OBJECT 429 +#define VBSE_OLE_NOT_SUPPORTED 430 +#define VBSE_OLE_FILE_NOT_FOUND 432 +#define VBSE_OLE_NO_PROP_OR_METHOD 438 +#define VBSE_ACTION_NOT_SUPPORTED 445 +#define VBSE_NAMED_ARGS_NOT_SUPPORTED 446 +#define VBSE_LOCALE_SETTING_NOT_SUPPORTED 447 +#define VBSE_NAMED_PARAM_NOT_FOUND 448 +#define VBSE_PARAMETER_NOT_OPTIONAL 449 +#define VBSE_FUNC_ARITY_MISMATCH 450 +#define VBSE_NOT_ENUM 451 +#define VBSE_INVALID_DLL_FUNCTION_NAME 453 +#define VBSE_INVALID_TYPELIB_VARIABLE 458 +#define VBSE_SERVER_NOT_FOUND 462 + +#define VBS_COMPILE_ERROR 4096 +#define VBS_RUNTIME_ERROR 4097 +#define VBS_UNKNOWN_RUNTIME_ERROR 4098 diff --git a/dll/win32/vbscript/vbscript_main.c b/dll/win32/vbscript/vbscript_main.c index 786b7fb8987..6e6f3867559 100644 --- a/dll/win32/vbscript/vbscript_main.c +++ b/dll/win32/vbscript/vbscript_main.c @@ -35,64 +35,19 @@ DEFINE_GUID(GUID_NULL,0,0,0,0,0,0,0,0,0,0,0); static HINSTANCE vbscript_hinstance; -static ITypeLib *typelib; -static ITypeInfo *typeinfos[LAST_tid]; - -static REFIID tid_ids[] = { -#define XDIID(iface) &DIID_ ## iface, -TID_LIST -#undef XDIID -}; - -HRESULT get_typeinfo(tid_t tid, ITypeInfo **typeinfo) +BSTR get_vbscript_string(int id) { - HRESULT hres; - - if (!typelib) { - ITypeLib *tl; - - static const WCHAR vbscript_dll1W[] = {'v','b','s','c','r','i','p','t','.','d','l','l','\\','1',0}; - - hres = LoadTypeLib(vbscript_dll1W, &tl); - if(FAILED(hres)) { - ERR("LoadRegTypeLib failed: %08x\n", hres); - return hres; - } - - if(InterlockedCompareExchangePointer((void**)&typelib, tl, NULL)) - ITypeLib_Release(tl); - } - - if(!typeinfos[tid]) { - ITypeInfo *ti; - - hres = ITypeLib_GetTypeInfoOfGuid(typelib, tid_ids[tid], &ti); - if(FAILED(hres)) { - ERR("GetTypeInfoOfGuid(%s) failed: %08x\n", debugstr_guid(tid_ids[tid]), hres); - return hres; - } - - if(InterlockedCompareExchangePointer((void**)(typeinfos+tid), ti, NULL)) - ITypeInfo_Release(ti); - } - - *typeinfo = typeinfos[tid]; - return S_OK; + WCHAR buf[512]; + if(!LoadStringW(vbscript_hinstance, id, buf, ARRAY_SIZE(buf))) return NULL; + return SysAllocString(buf); } -static void release_typelib(void) +BSTR get_vbscript_error_string(HRESULT error) { - unsigned i; - - if(!typelib) - return; - - for(i = 0; i < ARRAY_SIZE(typeinfos); i++) { - if(typeinfos[i]) - ITypeInfo_Release(typeinfos[i]); - } - - ITypeLib_Release(typelib); + BSTR ret; + if(HRESULT_FACILITY(error) != FACILITY_VBS || !(ret = get_vbscript_string(HRESULT_CODE(error)))) + ret = get_vbscript_string(VBS_UNKNOWN_RUNTIME_ERROR); + return ret; } #define MIN_BLOCK_SIZE 128 @@ -301,7 +256,6 @@ BOOL WINAPI DllMain(HINSTANCE hInstDLL, DWORD fdwReason, LPVOID lpv) break; case DLL_PROCESS_DETACH: if (lpv) break; - release_typelib(); release_regexp_typelib(); } diff --git a/media/doc/README.WINE b/media/doc/README.WINE index 8cd29acad9a..c7d47ba6730 100644 --- a/media/doc/README.WINE +++ b/media/doc/README.WINE @@ -192,7 +192,7 @@ dll/win32/url # Synced to WineStaging-3.3 dll/win32/urlmon # Synced to WineStaging-4.18 dll/win32/usp10 # Synced to WineStaging-4.18 dll/win32/uxtheme # Forked -dll/win32/vbscript # Synced to WineStaging-4.0 +dll/win32/vbscript # Synced to WineStaging-4.18 dll/win32/version # Synced to WineStaging-4.0 dll/win32/vssapi # Synced to WineStaging-2.9 dll/win32/wbemdisp # Synced to WineStaging-4.0