vbscript: Added lexer support for '_'.

This commit is contained in:
Jacek Caban 2011-10-17 14:32:13 +02:00 committed by Alexandre Julliard
parent 16eac43c8e
commit 64fd6fa787
3 changed files with 19 additions and 0 deletions

View File

@ -354,6 +354,7 @@ static int parse_next_token(void *lval, parser_ctx_t *ctx)
case '^': case '^':
case '\\': case '\\':
case '.': case '.':
case '_':
return *ctx->ptr++; return *ctx->ptr++;
case '(': case '(':
/* NOTE: /* NOTE:
@ -402,6 +403,15 @@ int parser_lex(void *lval, parser_ctx_t *ctx)
while(1) { while(1) {
ret = parse_next_token(lval, ctx); ret = parse_next_token(lval, ctx);
if(ret == '_') {
skip_spaces(ctx);
if(*ctx->ptr != '\n') {
FIXME("'_' not followed by newline\n");
return 0;
}
ctx->ptr++;
continue;
}
if(ret != tNL || ctx->last_token != tNL) if(ret != tNL || ctx->last_token != tNL)
break; break;

View File

@ -177,6 +177,13 @@ Call ok(2^3^2 = 64, "2^3^2 = " & (2^3^2))
Call ok(-3^2 = 9, "-3^2 = " & (-3^2)) Call ok(-3^2 = 9, "-3^2 = " & (-3^2))
Call ok(2*3^2 = 18, "2*3^2 = " & (2*3^2)) Call ok(2*3^2 = 18, "2*3^2 = " & (2*3^2))
x =_
3
x _
= 3
x = 3
if true then y = true : x = y if true then y = true : x = y
ok x, "x is false" ok x, "x is false"

View File

@ -1226,6 +1226,8 @@ static void run_tests(void)
parse_script_a("x = 1\n Call ok(x = 1, \"x = \" & x)"); parse_script_a("x = 1\n Call ok(x = 1, \"x = \" & x)");
parse_script_a("x = _ \n3");
test_global_vars_ref(TRUE); test_global_vars_ref(TRUE);
test_global_vars_ref(FALSE); test_global_vars_ref(FALSE);