jscript: Use parse_decimal for parsing JSON numeric literals starting with 0.
Signed-off-by: Jacek Caban <jacek@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
9240ed581f
commit
b9a57de048
|
@ -261,19 +261,12 @@ static HRESULT parse_json_value(json_parse_ctx_t *ctx, jsval_t *r)
|
||||||
skip_spaces(ctx);
|
skip_spaces(ctx);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!isdigitW(*ctx->ptr))
|
if(*ctx->ptr == '0' && ctx->ptr + 1 < ctx->end && isdigitW(ctx->ptr[1]))
|
||||||
break;
|
break;
|
||||||
|
|
||||||
if(*ctx->ptr == '0') {
|
|
||||||
ctx->ptr++;
|
|
||||||
n = 0;
|
|
||||||
if(is_identifier_char(*ctx->ptr))
|
|
||||||
break;
|
|
||||||
}else {
|
|
||||||
hres = parse_decimal(&ctx->ptr, ctx->end, &n);
|
hres = parse_decimal(&ctx->ptr, ctx->end, &n);
|
||||||
if(FAILED(hres))
|
if(FAILED(hres))
|
||||||
return hres;
|
break;
|
||||||
}
|
|
||||||
|
|
||||||
*r = jsval_number(sign*n);
|
*r = jsval_number(sign*n);
|
||||||
return S_OK;
|
return S_OK;
|
||||||
|
|
|
@ -1887,7 +1887,10 @@ ok(isNaN(tmp), "Math.tan(-Infinity) is not NaN");
|
||||||
["[false,{},{\"x\": []}]", [false,{},{x:[]}]],
|
["[false,{},{\"x\": []}]", [false,{},{x:[]}]],
|
||||||
["0", 0],
|
["0", 0],
|
||||||
["- 1", -1],
|
["- 1", -1],
|
||||||
["1e2147483648", Infinity]
|
["1e2147483648", Infinity],
|
||||||
|
["0.5", 0.5],
|
||||||
|
["0e5", 0],
|
||||||
|
[".5", 0.5]
|
||||||
];
|
];
|
||||||
|
|
||||||
function json_cmp(x, y) {
|
function json_cmp(x, y) {
|
||||||
|
|
Loading…
Reference in New Issue