jscript: Ensure that the whole script is parsed.

This commit is contained in:
Jacek Caban 2010-12-28 15:05:25 +01:00 committed by Alexandre Julliard
parent 5e469f4fff
commit 0f36ef09b1
3 changed files with 4 additions and 2 deletions

View File

@ -526,7 +526,7 @@ int parser_lex(void *lval, parser_ctx_t *ctx)
do { do {
skip_spaces(ctx); skip_spaces(ctx);
if(ctx->ptr == ctx->end) if(ctx->ptr == ctx->end)
return 0; return tEOF;
}while(skip_comment(ctx) || skip_html_comment(ctx)); }while(skip_comment(ctx) || skip_html_comment(ctx));
if(isalphaW(*ctx->ptr)) { if(isalphaW(*ctx->ptr)) {

View File

@ -180,6 +180,7 @@ static source_elements_t *source_elements_add_statement(source_elements_t*,state
%token <ival> tAssignOper tEqOper tShiftOper tRelOper %token <ival> tAssignOper tEqOper tShiftOper tRelOper
%token <literal> tNumericLiteral %token <literal> tNumericLiteral
%token <wstr> tStringLiteral %token <wstr> tStringLiteral
%token tEOF
%type <source_elements> SourceElements %type <source_elements> SourceElements
%type <source_elements> FunctionBody %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 */ /* ECMA-262 3rd Edition 14 */
Program Program
: SourceElements HtmlComment : SourceElements HtmlComment tEOF
{ program_parsed(ctx, $1); } { program_parsed(ctx, $1); }
HtmlComment HtmlComment

View File

@ -1985,6 +1985,7 @@ testSyntaxError("for(i=0;i<10", "E_SEMICOLON");
testSyntaxError("while(", "E_SYNTAX_ERROR"); testSyntaxError("while(", "E_SYNTAX_ERROR");
testSyntaxError("if(", "E_SYNTAX_ERROR"); testSyntaxError("if(", "E_SYNTAX_ERROR");
testSyntaxError("'unterminated", "E_UNTERMINATED_STR"); testSyntaxError("'unterminated", "E_UNTERMINATED_STR");
testSyntaxError("*", "E_SYNTAX_ERROR");
// ReferenceError tests // ReferenceError tests
testException(function() {test = function() {}}, "E_ILLEGAL_ASSIGN"); testException(function() {test = function() {}}, "E_ILLEGAL_ASSIGN");