jscript: Added 'unterminated string' error.
This commit is contained in:
parent
5ee34ea870
commit
ec25138a46
|
@ -56,6 +56,7 @@ typedef struct _parser_ctx_t {
|
|||
source_elements_t *source;
|
||||
BOOL nl;
|
||||
BOOL is_html;
|
||||
BOOL lexer_error;
|
||||
HRESULT hres;
|
||||
|
||||
jsheap_t heap;
|
||||
|
|
|
@ -30,6 +30,7 @@ STRINGTABLE DISCARDABLE
|
|||
IDS_SEMICOLON "Expected ';'"
|
||||
IDS_LBRACKET "Expected '('"
|
||||
IDS_RBRACKET "Expected ')'"
|
||||
IDS_UNTERMINATED_STR "Unterminated string constant"
|
||||
IDS_NOT_FUNC "Function expected"
|
||||
IDS_NOT_DATE "'[object]' is not a date object"
|
||||
IDS_NOT_NUM "Number expected"
|
||||
|
|
|
@ -100,7 +100,8 @@ static const struct {
|
|||
|
||||
static int lex_error(parser_ctx_t *ctx, HRESULT hres)
|
||||
{
|
||||
ctx->hres = hres;
|
||||
ctx->hres = JSCRIPT_ERROR|hres;
|
||||
ctx->lexer_error = TRUE;
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -342,10 +343,8 @@ static int parse_string_literal(parser_ctx_t *ctx, const WCHAR **ret, WCHAR endc
|
|||
ctx->ptr++;
|
||||
}
|
||||
|
||||
if(ctx->ptr == ctx->end) {
|
||||
WARN("unexpected end of file\n");
|
||||
return lex_error(ctx, E_FAIL);
|
||||
}
|
||||
if(ctx->ptr == ctx->end)
|
||||
return lex_error(ctx, IDS_UNTERMINATED_STR);
|
||||
|
||||
len = ctx->ptr-ptr;
|
||||
|
||||
|
|
|
@ -1577,7 +1577,8 @@ static void program_parsed(parser_ctx_t *ctx, source_elements_t *source)
|
|||
pop_func(ctx);
|
||||
|
||||
ctx->source = source;
|
||||
ctx->hres = S_OK;
|
||||
if(!ctx->lexer_error)
|
||||
ctx->hres = S_OK;
|
||||
}
|
||||
|
||||
void parser_release(parser_ctx_t *ctx)
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
#define IDS_SEMICOLON 0x03EC
|
||||
#define IDS_LBRACKET 0x03ED
|
||||
#define IDS_RBRACKET 0x03EE
|
||||
#define IDS_UNTERMINATED_STR 0x03F7
|
||||
#define IDS_NOT_FUNC 0x138A
|
||||
#define IDS_NOT_DATE 0x138E
|
||||
#define IDS_NOT_NUM 0x1389
|
||||
|
|
|
@ -1333,5 +1333,6 @@ exception_test(function() {eval("for(i=0")}, "SyntaxError", -2146827284);
|
|||
exception_test(function() {eval("for(i=0;i<10")}, "SyntaxError", -2146827284);
|
||||
exception_test(function() {eval("while(")}, "SyntaxError", -2146827286);
|
||||
exception_test(function() {eval("if(")}, "SyntaxError", -2146827286);
|
||||
exception_test(function() {eval("'unterminated")}, "SyntaxError", -2146827273);
|
||||
|
||||
reportSuccess();
|
||||
|
|
Loading…
Reference in New Issue