Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-cw
Commits
931554dd
Commit
931554dd
authored
Jun 03, 2009
by
Piotr Caban
Committed by
Alexandre Julliard
Jun 04, 2009
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
jscript: Fix parse_double_literal implementation.
parent
5e72f7b2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
36 additions
and
8 deletions
+36
-8
lex.c
dlls/jscript/lex.c
+34
-8
lang.js
dlls/jscript/tests/lang.js
+2
-0
No files found.
dlls/jscript/lex.c
View file @
931554dd
...
@@ -31,6 +31,8 @@
...
@@ -31,6 +31,8 @@
WINE_DEFAULT_DEBUG_CHANNEL
(
jscript
);
WINE_DEFAULT_DEBUG_CHANNEL
(
jscript
);
#define LONGLONG_MAX (((LONGLONG)0x7fffffff<<32)|0xffffffff)
static
const
WCHAR
breakW
[]
=
{
'b'
,
'r'
,
'e'
,
'a'
,
'k'
,
0
};
static
const
WCHAR
breakW
[]
=
{
'b'
,
'r'
,
'e'
,
'a'
,
'k'
,
0
};
static
const
WCHAR
caseW
[]
=
{
'c'
,
'a'
,
's'
,
'e'
,
0
};
static
const
WCHAR
caseW
[]
=
{
'c'
,
'a'
,
's'
,
'e'
,
0
};
static
const
WCHAR
catchW
[]
=
{
'c'
,
'a'
,
't'
,
'c'
,
'h'
,
0
};
static
const
WCHAR
catchW
[]
=
{
'c'
,
'a'
,
't'
,
'c'
,
'h'
,
0
};
...
@@ -373,7 +375,8 @@ static literal_t *alloc_int_literal(parser_ctx_t *ctx, LONG l)
...
@@ -373,7 +375,8 @@ static literal_t *alloc_int_literal(parser_ctx_t *ctx, LONG l)
static
int
parse_double_literal
(
parser_ctx_t
*
ctx
,
LONG
int_part
,
literal_t
**
literal
)
static
int
parse_double_literal
(
parser_ctx_t
*
ctx
,
LONG
int_part
,
literal_t
**
literal
)
{
{
double
d
,
tmp
=
1
.
0
;
LONGLONG
d
,
hlp
;
int
exp
=
0
;
if
(
ctx
->
ptr
==
ctx
->
end
||
(
!
isdigitW
(
*
ctx
->
ptr
)
&&
if
(
ctx
->
ptr
==
ctx
->
end
||
(
!
isdigitW
(
*
ctx
->
ptr
)
&&
*
ctx
->
ptr
!=
'.'
&&
*
ctx
->
ptr
!=
'e'
&&
*
ctx
->
ptr
!=
'E'
))
{
*
ctx
->
ptr
!=
'.'
&&
*
ctx
->
ptr
!=
'e'
&&
*
ctx
->
ptr
!=
'E'
))
{
...
@@ -382,13 +385,32 @@ static int parse_double_literal(parser_ctx_t *ctx, LONG int_part, literal_t **li
...
@@ -382,13 +385,32 @@ static int parse_double_literal(parser_ctx_t *ctx, LONG int_part, literal_t **li
}
}
d
=
int_part
;
d
=
int_part
;
while
(
ctx
->
ptr
<
ctx
->
end
&&
isdigitW
(
*
ctx
->
ptr
))
while
(
ctx
->
ptr
<
ctx
->
end
&&
isdigitW
(
*
ctx
->
ptr
))
{
d
=
d
*
10
+
*
(
ctx
->
ptr
++
)
-
'0'
;
hlp
=
d
*
10
+
*
(
ctx
->
ptr
++
)
-
'0'
;
if
(
d
>
LONGLONG_MAX
/
10
||
hlp
<
0
)
{
exp
++
;
break
;
}
else
d
=
hlp
;
}
while
(
ctx
->
ptr
<
ctx
->
end
&&
isdigitW
(
*
ctx
->
ptr
))
{
exp
++
;
ctx
->
ptr
++
;
}
if
(
*
ctx
->
ptr
==
'.'
)
ctx
->
ptr
++
;
if
(
*
ctx
->
ptr
==
'.'
)
ctx
->
ptr
++
;
while
(
ctx
->
ptr
<
ctx
->
end
&&
isdigitW
(
*
ctx
->
ptr
))
{
hlp
=
d
*
10
+
*
(
ctx
->
ptr
++
)
-
'0'
;
if
(
d
>
LONGLONG_MAX
/
10
||
hlp
<
0
)
break
;
d
=
hlp
;
exp
--
;
}
while
(
ctx
->
ptr
<
ctx
->
end
&&
isdigitW
(
*
ctx
->
ptr
))
while
(
ctx
->
ptr
<
ctx
->
end
&&
isdigitW
(
*
ctx
->
ptr
))
d
+=
(
tmp
/=
10
.
0
)
*
(
*
ctx
->
ptr
++
-
'0'
)
;
ctx
->
ptr
++
;
if
(
ctx
->
ptr
<
ctx
->
end
&&
(
*
ctx
->
ptr
==
'e'
||
*
ctx
->
ptr
==
'E'
))
{
if
(
ctx
->
ptr
<
ctx
->
end
&&
(
*
ctx
->
ptr
==
'e'
||
*
ctx
->
ptr
==
'E'
))
{
int
sign
=
1
,
e
=
0
;
int
sign
=
1
,
e
=
0
;
...
@@ -411,16 +433,20 @@ static int parse_double_literal(parser_ctx_t *ctx, LONG int_part, literal_t **li
...
@@ -411,16 +433,20 @@ static int parse_double_literal(parser_ctx_t *ctx, LONG int_part, literal_t **li
return
lex_error
(
ctx
,
E_FAIL
);
return
lex_error
(
ctx
,
E_FAIL
);
}
}
while
(
ctx
->
ptr
<
ctx
->
end
&&
isdigitW
(
*
ctx
->
ptr
))
while
(
ctx
->
ptr
<
ctx
->
end
&&
isdigitW
(
*
ctx
->
ptr
))
{
e
=
e
*
10
+
*
ctx
->
ptr
++
-
'0'
;
if
(
e
>
INT_MAX
/
10
||
(
e
=
e
*
10
+
*
ctx
->
ptr
++
-
'0'
)
<
0
)
e
=
INT_MAX
;
}
e
*=
sign
;
e
*=
sign
;
d
*=
pow
(
10
,
e
);
if
(
exp
<
0
&&
e
<
0
&&
e
+
exp
>
0
)
exp
=
INT_MIN
;
else
if
(
exp
>
0
&&
e
>
0
&&
e
+
exp
<
0
)
exp
=
INT_MAX
;
else
exp
+=
e
;
}
}
*
literal
=
parser_alloc
(
ctx
,
sizeof
(
literal_t
));
*
literal
=
parser_alloc
(
ctx
,
sizeof
(
literal_t
));
(
*
literal
)
->
vt
=
VT_R8
;
(
*
literal
)
->
vt
=
VT_R8
;
(
*
literal
)
->
u
.
dval
=
d
;
(
*
literal
)
->
u
.
dval
=
(
double
)
d
*
pow
(
10
,
exp
)
;
return
tNumericLiteral
;
return
tNumericLiteral
;
}
}
...
...
dlls/jscript/tests/lang.js
View file @
931554dd
...
@@ -35,6 +35,8 @@ ok(undefined === undefined, "undefined === undefined is false");
...
@@ -35,6 +35,8 @@ ok(undefined === undefined, "undefined === undefined is false");
ok
(
!
(
undefined
===
null
),
"!(undefined === null) is false"
);
ok
(
!
(
undefined
===
null
),
"!(undefined === null) is false"
);
ok
(
1
E0
===
1
,
"1E0 === 1 is false"
);
ok
(
1
E0
===
1
,
"1E0 === 1 is false"
);
ok
(
1000000
*
1000000
===
1000000000000
,
"1000000*1000000 === 1000000000000 is false"
);
ok
(
1000000
*
1000000
===
1000000000000
,
"1000000*1000000 === 1000000000000 is false"
);
ok
(
8.64e15
===
8640000000000000
,
"8.64e15 !== 8640000000000000"
+
8.64e15
);
ok
(
1
e2147483648
===
Infinity
,
"1e2147483648 !== Infinity"
);
ok
(
1
!==
2
,
"1 !== 2 is false"
);
ok
(
1
!==
2
,
"1 !== 2 is false"
);
ok
(
null
!==
undefined
,
"null !== undefined is false"
);
ok
(
null
!==
undefined
,
"null !== undefined is false"
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment