Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
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-winehq
Commits
166c97d5
Commit
166c97d5
authored
Sep 30, 2014
by
Jacek Caban
Committed by
Alexandre Julliard
Sep 30, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
jscript: Return double from parse_numeric_literal and parse_double_literal.
parent
615f6a6e
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
38 additions
and
20 deletions
+38
-20
lex.c
dlls/jscript/lex.c
+38
-20
No files found.
dlls/jscript/lex.c
View file @
166c97d5
...
@@ -388,7 +388,7 @@ literal_t *new_boolean_literal(parser_ctx_t *ctx, BOOL bval)
...
@@ -388,7 +388,7 @@ literal_t *new_boolean_literal(parser_ctx_t *ctx, BOOL bval)
return
ret
;
return
ret
;
}
}
static
int
parse_double_literal
(
parser_ctx_t
*
ctx
,
LONG
int_part
,
literal_t
**
literal
)
static
BOOL
parse_double_literal
(
parser_ctx_t
*
ctx
,
LONG
int_part
,
double
*
ret
)
{
{
LONGLONG
d
,
hlp
;
LONGLONG
d
,
hlp
;
int
exp
=
0
;
int
exp
=
0
;
...
@@ -435,13 +435,15 @@ static int parse_double_literal(parser_ctx_t *ctx, LONG int_part, literal_t **li
...
@@ -435,13 +435,15 @@ static int parse_double_literal(parser_ctx_t *ctx, LONG int_part, literal_t **li
ctx
->
ptr
++
;
ctx
->
ptr
++
;
}
else
if
(
!
isdigitW
(
*
ctx
->
ptr
))
{
}
else
if
(
!
isdigitW
(
*
ctx
->
ptr
))
{
WARN
(
"Expected exponent part
\n
"
);
WARN
(
"Expected exponent part
\n
"
);
return
lex_error
(
ctx
,
E_FAIL
);
lex_error
(
ctx
,
E_FAIL
);
return
FALSE
;
}
}
}
}
if
(
ctx
->
ptr
==
ctx
->
end
)
{
if
(
ctx
->
ptr
==
ctx
->
end
)
{
WARN
(
"unexpected end of file
\n
"
);
WARN
(
"unexpected end of file
\n
"
);
return
lex_error
(
ctx
,
E_FAIL
);
lex_error
(
ctx
,
E_FAIL
);
return
FALSE
;
}
}
while
(
ctx
->
ptr
<
ctx
->
end
&&
isdigitW
(
*
ctx
->
ptr
))
{
while
(
ctx
->
ptr
<
ctx
->
end
&&
isdigitW
(
*
ctx
->
ptr
))
{
...
@@ -457,14 +459,15 @@ static int parse_double_literal(parser_ctx_t *ctx, LONG int_part, literal_t **li
...
@@ -457,14 +459,15 @@ static int parse_double_literal(parser_ctx_t *ctx, LONG int_part, literal_t **li
if
(
is_identifier_char
(
*
ctx
->
ptr
))
{
if
(
is_identifier_char
(
*
ctx
->
ptr
))
{
WARN
(
"wrong char after zero
\n
"
);
WARN
(
"wrong char after zero
\n
"
);
return
lex_error
(
ctx
,
JS_E_MISSING_SEMICOLON
);
lex_error
(
ctx
,
JS_E_MISSING_SEMICOLON
);
return
FALSE
;
}
}
*
literal
=
new_double_literal
(
ctx
,
exp
>=
0
?
d
*
pow
(
10
,
exp
)
:
d
/
pow
(
10
,
-
exp
)
);
*
ret
=
exp
>=
0
?
d
*
pow
(
10
,
exp
)
:
d
/
pow
(
10
,
-
exp
);
return
tNumericLiteral
;
return
TRUE
;
}
}
static
int
parse_numeric_literal
(
parser_ctx_t
*
ctx
,
literal_t
**
literal
)
static
BOOL
parse_numeric_literal
(
parser_ctx_t
*
ctx
,
double
*
ret
)
{
{
LONG
l
,
d
;
LONG
l
,
d
;
...
@@ -473,7 +476,7 @@ static int parse_numeric_literal(parser_ctx_t *ctx, literal_t **literal)
...
@@ -473,7 +476,7 @@ static int parse_numeric_literal(parser_ctx_t *ctx, literal_t **literal)
if
(
*
ctx
->
ptr
==
'x'
||
*
ctx
->
ptr
==
'X'
)
{
if
(
*
ctx
->
ptr
==
'x'
||
*
ctx
->
ptr
==
'X'
)
{
if
(
++
ctx
->
ptr
==
ctx
->
end
)
{
if
(
++
ctx
->
ptr
==
ctx
->
end
)
{
ERR
(
"unexpected end of file
\n
"
);
ERR
(
"unexpected end of file
\n
"
);
return
0
;
return
FALSE
;
}
}
while
(
ctx
->
ptr
<
ctx
->
end
&&
(
d
=
hex_to_int
(
*
ctx
->
ptr
))
!=
-
1
)
{
while
(
ctx
->
ptr
<
ctx
->
end
&&
(
d
=
hex_to_int
(
*
ctx
->
ptr
))
!=
-
1
)
{
...
@@ -483,11 +486,12 @@ static int parse_numeric_literal(parser_ctx_t *ctx, literal_t **literal)
...
@@ -483,11 +486,12 @@ static int parse_numeric_literal(parser_ctx_t *ctx, literal_t **literal)
if
(
ctx
->
ptr
<
ctx
->
end
&&
is_identifier_char
(
*
ctx
->
ptr
))
{
if
(
ctx
->
ptr
<
ctx
->
end
&&
is_identifier_char
(
*
ctx
->
ptr
))
{
WARN
(
"unexpected identifier char
\n
"
);
WARN
(
"unexpected identifier char
\n
"
);
return
lex_error
(
ctx
,
JS_E_MISSING_SEMICOLON
);
lex_error
(
ctx
,
JS_E_MISSING_SEMICOLON
);
return
FALSE
;
}
}
*
literal
=
new_double_literal
(
ctx
,
l
)
;
*
ret
=
l
;
return
tNumericLiteral
;
return
TRUE
;
}
}
if
(
isdigitW
(
*
ctx
->
ptr
))
{
if
(
isdigitW
(
*
ctx
->
ptr
))
{
...
@@ -509,20 +513,22 @@ static int parse_numeric_literal(parser_ctx_t *ctx, literal_t **literal)
...
@@ -509,20 +513,22 @@ static int parse_numeric_literal(parser_ctx_t *ctx, literal_t **literal)
/* FIXME: Do we need it here? */
/* FIXME: Do we need it here? */
if
(
ctx
->
ptr
<
ctx
->
end
&&
(
is_identifier_char
(
*
ctx
->
ptr
)
||
*
ctx
->
ptr
==
'.'
))
{
if
(
ctx
->
ptr
<
ctx
->
end
&&
(
is_identifier_char
(
*
ctx
->
ptr
)
||
*
ctx
->
ptr
==
'.'
))
{
WARN
(
"wrong char after octal literal: '%c'
\n
"
,
*
ctx
->
ptr
);
WARN
(
"wrong char after octal literal: '%c'
\n
"
,
*
ctx
->
ptr
);
return
lex_error
(
ctx
,
JS_E_MISSING_SEMICOLON
);
lex_error
(
ctx
,
JS_E_MISSING_SEMICOLON
);
return
FALSE
;
}
}
*
literal
=
new_double_literal
(
ctx
,
val
)
;
*
ret
=
val
;
return
tNumericLiteral
;
return
TRUE
;
}
}
if
(
is_identifier_char
(
*
ctx
->
ptr
))
{
if
(
is_identifier_char
(
*
ctx
->
ptr
))
{
WARN
(
"wrong char after zero
\n
"
);
WARN
(
"wrong char after zero
\n
"
);
return
lex_error
(
ctx
,
JS_E_MISSING_SEMICOLON
);
lex_error
(
ctx
,
JS_E_MISSING_SEMICOLON
);
return
FALSE
;
}
}
}
}
return
parse_double_literal
(
ctx
,
l
,
literal
);
return
parse_double_literal
(
ctx
,
l
,
ret
);
}
}
static
int
next_token
(
parser_ctx_t
*
ctx
,
void
*
lval
)
static
int
next_token
(
parser_ctx_t
*
ctx
,
void
*
lval
)
...
@@ -550,8 +556,15 @@ static int next_token(parser_ctx_t *ctx, void *lval)
...
@@ -550,8 +556,15 @@ static int next_token(parser_ctx_t *ctx, void *lval)
return
parse_identifier
(
ctx
,
lval
);
return
parse_identifier
(
ctx
,
lval
);
}
}
if
(
isdigitW
(
*
ctx
->
ptr
))
if
(
isdigitW
(
*
ctx
->
ptr
))
{
return
parse_numeric_literal
(
ctx
,
lval
);
double
n
;
if
(
!
parse_numeric_literal
(
ctx
,
&
n
))
return
-
1
;
*
(
literal_t
**
)
lval
=
new_double_literal
(
ctx
,
n
);
return
tNumericLiteral
;
}
switch
(
*
ctx
->
ptr
)
{
switch
(
*
ctx
->
ptr
)
{
case
'{'
:
case
'{'
:
...
@@ -571,8 +584,13 @@ static int next_token(parser_ctx_t *ctx, void *lval)
...
@@ -571,8 +584,13 @@ static int next_token(parser_ctx_t *ctx, void *lval)
return
'}'
;
return
'}'
;
case
'.'
:
case
'.'
:
if
(
++
ctx
->
ptr
<
ctx
->
end
&&
isdigitW
(
*
ctx
->
ptr
))
if
(
++
ctx
->
ptr
<
ctx
->
end
&&
isdigitW
(
*
ctx
->
ptr
))
{
return
parse_double_literal
(
ctx
,
0
,
lval
);
double
n
;
if
(
!
parse_double_literal
(
ctx
,
0
,
&
n
))
return
-
1
;
*
(
literal_t
**
)
lval
=
new_double_literal
(
ctx
,
n
);
return
tNumericLiteral
;
}
return
'.'
;
return
'.'
;
case
'<'
:
case
'<'
:
...
...
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