vbscript: Added parser/compiler support for |option explicit|.
This commit is contained in:
parent
a921bd2ea4
commit
8108b4040c
|
@ -256,6 +256,8 @@ static vbscode_t *alloc_vbscode(compile_ctx_t *ctx, const WCHAR *source)
|
|||
ctx->instr_cnt = 0;
|
||||
ctx->instr_size = 32;
|
||||
|
||||
ret->option_explicit = ctx->parser.option_explicit;
|
||||
|
||||
ret->bstr_pool = NULL;
|
||||
ret->bstr_pool_size = 0;
|
||||
ret->bstr_cnt = 0;
|
||||
|
|
|
@ -29,6 +29,7 @@ typedef struct {
|
|||
vbscode_t *code;
|
||||
instr_t *instr;
|
||||
script_ctx_t *script;
|
||||
function_t *func;
|
||||
|
||||
unsigned stack_size;
|
||||
unsigned top;
|
||||
|
@ -70,7 +71,8 @@ static HRESULT lookup_identifier(exec_ctx_t *ctx, BSTR name, ref_t *ref)
|
|||
}
|
||||
}
|
||||
|
||||
FIXME("create if no option explicit\n");
|
||||
if(!ctx->func->code_ctx->option_explicit)
|
||||
FIXME("create an attempt to set\n");
|
||||
|
||||
ref->type = REF_NONE;
|
||||
return S_OK;
|
||||
|
@ -223,6 +225,7 @@ HRESULT exec_script(script_ctx_t *ctx, function_t *func)
|
|||
exec.code = func->code_ctx;
|
||||
exec.instr = exec.code->instrs + func->code_off;
|
||||
exec.script = ctx;
|
||||
exec.func = func;
|
||||
|
||||
while(exec.instr) {
|
||||
op = exec.instr->op;
|
||||
|
|
|
@ -63,6 +63,7 @@ typedef struct {
|
|||
const WCHAR *ptr;
|
||||
const WCHAR *end;
|
||||
|
||||
BOOL option_explicit;
|
||||
BOOL parse_complete;
|
||||
HRESULT hres;
|
||||
|
||||
|
|
|
@ -31,7 +31,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(vbscript);
|
|||
|
||||
static int parser_error(const char*);
|
||||
|
||||
static void parse_complete(parser_ctx_t*);
|
||||
static void parse_complete(parser_ctx_t*,BOOL);
|
||||
|
||||
static void source_add_statement(parser_ctx_t*,statement_t*);
|
||||
|
||||
|
@ -54,6 +54,7 @@ static statement_t *new_call_statement(parser_ctx_t*,member_expression_t*);
|
|||
statement_t *statement;
|
||||
expression_t *expression;
|
||||
member_expression_t *member;
|
||||
BOOL bool;
|
||||
}
|
||||
|
||||
%token tEOF tNL tREM tEMPTYBRACKETS
|
||||
|
@ -75,11 +76,16 @@ static statement_t *new_call_statement(parser_ctx_t*,member_expression_t*);
|
|||
%type <expression> Expression LiteralExpression
|
||||
%type <member> MemberExpression
|
||||
%type <expression> Arguments_opt ArgumentList_opt ArgumentList
|
||||
%type <bool> OptionExplicit_opt
|
||||
|
||||
%%
|
||||
|
||||
Program
|
||||
: SourceElements tEOF { parse_complete(ctx); }
|
||||
: OptionExplicit_opt SourceElements tEOF { parse_complete(ctx, $1); }
|
||||
|
||||
OptionExplicit_opt
|
||||
: /* empty */ { $$ = FALSE; }
|
||||
| tOPTION tEXPLICIT tNL { $$ = TRUE; }
|
||||
|
||||
SourceElements
|
||||
: /* empty */
|
||||
|
@ -137,9 +143,10 @@ static void source_add_statement(parser_ctx_t *ctx, statement_t *stat)
|
|||
}
|
||||
}
|
||||
|
||||
static void parse_complete(parser_ctx_t *ctx)
|
||||
static void parse_complete(parser_ctx_t *ctx, BOOL option_explicit)
|
||||
{
|
||||
ctx->parse_complete = TRUE;
|
||||
ctx->option_explicit = option_explicit;
|
||||
}
|
||||
|
||||
static void *new_expression(parser_ctx_t *ctx, expression_type_t type, unsigned size)
|
||||
|
@ -240,6 +247,7 @@ HRESULT parse_script(parser_ctx_t *ctx, const WCHAR *code)
|
|||
ctx->last_token = tNL;
|
||||
ctx->last_nl = 0;
|
||||
ctx->stats = ctx->stats_tail = NULL;
|
||||
ctx->option_explicit = FALSE;
|
||||
|
||||
parser_parse(ctx);
|
||||
|
||||
|
|
|
@ -16,6 +16,8 @@
|
|||
' Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
'
|
||||
|
||||
Option Explicit
|
||||
|
||||
call ok(true, "true is not true?")
|
||||
ok true, "true is not true?"
|
||||
|
||||
|
|
|
@ -109,6 +109,8 @@ struct _vbscode_t {
|
|||
instr_t *instrs;
|
||||
WCHAR *source;
|
||||
|
||||
BOOL option_explicit;
|
||||
|
||||
BOOL global_executed;
|
||||
function_t global_code;
|
||||
|
||||
|
|
Loading…
Reference in New Issue