Module: wine Branch: master Commit: 0f36ef09b12e7c39c05b7def4d7c7fc87987dec2 URL: http://source.winehq.org/git/wine.git/?a=commit;h=0f36ef09b12e7c39c05b7def4d...
Author: Jacek Caban jacek@codeweavers.com Date: Tue Dec 28 15:05:25 2010 +0100
jscript: Ensure that the whole script is parsed.
---
dlls/jscript/lex.c | 2 +- dlls/jscript/parser.y | 3 ++- dlls/jscript/tests/api.js | 1 + 3 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/dlls/jscript/lex.c b/dlls/jscript/lex.c index bfa3568..88fed07 100644 --- a/dlls/jscript/lex.c +++ b/dlls/jscript/lex.c @@ -526,7 +526,7 @@ int parser_lex(void *lval, parser_ctx_t *ctx) do { skip_spaces(ctx); if(ctx->ptr == ctx->end) - return 0; + return tEOF; }while(skip_comment(ctx) || skip_html_comment(ctx));
if(isalphaW(*ctx->ptr)) { diff --git a/dlls/jscript/parser.y b/dlls/jscript/parser.y index 47fcc34..df7a070 100644 --- a/dlls/jscript/parser.y +++ b/dlls/jscript/parser.y @@ -180,6 +180,7 @@ static source_elements_t *source_elements_add_statement(source_elements_t*,state %token <ival> tAssignOper tEqOper tShiftOper tRelOper %token <literal> tNumericLiteral %token <wstr> tStringLiteral +%token tEOF
%type <source_elements> SourceElements %type <source_elements> FunctionBody @@ -253,7 +254,7 @@ static source_elements_t *source_elements_add_statement(source_elements_t*,state
/* ECMA-262 3rd Edition 14 */ Program - : SourceElements HtmlComment + : SourceElements HtmlComment tEOF { program_parsed(ctx, $1); }
HtmlComment diff --git a/dlls/jscript/tests/api.js b/dlls/jscript/tests/api.js index 4b9f160..6c62276 100644 --- a/dlls/jscript/tests/api.js +++ b/dlls/jscript/tests/api.js @@ -1985,6 +1985,7 @@ testSyntaxError("for(i=0;i<10", "E_SEMICOLON"); testSyntaxError("while(", "E_SYNTAX_ERROR"); testSyntaxError("if(", "E_SYNTAX_ERROR"); testSyntaxError("'unterminated", "E_UNTERMINATED_STR"); +testSyntaxError("*", "E_SYNTAX_ERROR");
// ReferenceError tests testException(function() {test = function() {}}, "E_ILLEGAL_ASSIGN");