Commit 107bba15 authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

vbscript: Always treat keywords after dot as identifiers.

parent 9b7923e4
......@@ -358,7 +358,9 @@ static int parse_next_token(void *lval, parser_ctx_t *ctx)
return parse_numeric_literal(ctx, lval);
if(iswalpha(c)) {
int ret = check_keywords(ctx, lval);
int ret = 0;
if(ctx->last_token != '.' && ctx->last_token != tDOT)
ret = check_keywords(ctx, lval);
if(!ret)
return parse_identifier(ctx, lval);
if(ret != tREM)
......
......@@ -144,7 +144,7 @@ static statement_t *link_statements(statement_t*,statement_t*);
%type <dim_decl> DimDeclList DimDecl
%type <dim_list> DimList
%type <const_decl> ConstDecl ConstDeclList
%type <string> Identifier DotIdentifier
%type <string> Identifier
%type <case_clausule> CaseClausules
%%
......@@ -231,8 +231,8 @@ SimpleStatement
MemberExpression
: Identifier { $$ = new_member_expression(ctx, NULL, $1); CHECK_ERROR; }
| CallExpression '.' DotIdentifier { $$ = new_member_expression(ctx, $1, $3); CHECK_ERROR; }
| tDOT DotIdentifier { expression_t *dot_expr = new_expression(ctx, EXPR_DOT, sizeof(*dot_expr)); CHECK_ERROR;
| CallExpression '.' tIdentifier { $$ = new_member_expression(ctx, $1, $3); CHECK_ERROR; }
| tDOT tIdentifier { expression_t *dot_expr = new_expression(ctx, EXPR_DOT, sizeof(*dot_expr)); CHECK_ERROR;
$$ = new_member_expression(ctx, dot_expr, $2); CHECK_ERROR; }
Preserve_opt
......@@ -492,62 +492,6 @@ Identifier
| 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; }
| tWITH { $$ = $1; }
| tREDIM { $$ = $1; }
| tPRESERVE { $$ = $1; }
/* Most statements accept both new line and ':' as separators */
StSep
: tNL
......
......@@ -1514,7 +1514,7 @@ call test_identifiers()
sub test_dotIdentifiers
' test keywords that can also be an identifier after a dot
' Call ok(testObj.rem = 10, "testObj.rem = " & testObj.rem & " expected 10")
Call ok(testObj.rem = 10, "testObj.rem = " & testObj.rem & " expected 10")
Call ok(testObj.true = 10, "testObj.true = " & testObj.true & " expected 10")
Call ok(testObj.false = 10, "testObj.false = " & testObj.false & " expected 10")
Call ok(testObj.not = 10, "testObj.not = " & testObj.not & " expected 10")
......@@ -1567,6 +1567,9 @@ sub test_dotIdentifiers
Call ok(testObj.with = 10, "testObj.with = " & testObj.with & " expected 10")
Call ok(testObj.redim = 10, "testObj.redim = " & testObj.redim & " expected 10")
Call ok(testObj.preserve = 10, "testObj.preserve = " & testObj.preserve & " expected 10")
Call ok(testObj.property = 10, "testObj.property = " & testObj.property & " expected 10")
Call ok(testObj.me = 10, "testObj.me = " & testObj.me & " expected 10")
Call ok(testObj.stop = 10, "testObj.stop = " & testObj.stop & " expected 10")
end sub
call test_dotIdentifiers
......
......@@ -859,7 +859,10 @@ static HRESULT WINAPI testObj_GetDispID(IDispatchEx *iface, BSTR bstrName, DWORD
{ L"goto", DISPID_TESTOBJ_KEYWORD },
{ L"redim", DISPID_TESTOBJ_KEYWORD },
{ L"preserve", DISPID_TESTOBJ_KEYWORD },
{ L"with", DISPID_TESTOBJ_KEYWORD }
{ L"with", DISPID_TESTOBJ_KEYWORD },
{ L"property", DISPID_TESTOBJ_KEYWORD },
{ L"me", DISPID_TESTOBJ_KEYWORD },
{ L"stop", DISPID_TESTOBJ_KEYWORD }
};
test_grfdex(grfdex, fdexNameCaseInsensitive);
......@@ -2881,12 +2884,8 @@ static void run_tests(void)
parse_script_a("Option Explicit\nset test.setobj = testObj");
CHECK_CALLED(global_setobj_i);
SET_EXPECT(OnScriptError);
hres = parse_script_ar("dim x\nx = testObj.rem");
todo_wine
ok(hres == S_OK, "use of 'rem' as dot identifier failed: %x08\n", hres);
todo_wine
CHECK_NOT_CALLED(OnScriptError);
SET_EXPECT(testobj_propget_d);
SET_EXPECT(testobj_propget_i);
......@@ -2948,6 +2947,8 @@ static void run_tests(void)
"x(counter(), counter()) = counter\n");
CHECK_CALLED(testobj_valueput_i);
parse_script_a("dim x\nx = testObj.property(1)");
parse_htmlscript_a("<!--");
parse_htmlscript_a(" -->");
parse_htmlscript_a("<!--\ndim x\nx=1\n-->\n");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment