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
e5d25a17
Commit
e5d25a17
authored
Sep 12, 2011
by
Jacek Caban
Committed by
Alexandre Julliard
Sep 12, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
vbscript: Added hex literal implementation.
parent
66d3dd4b
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
41 additions
and
0 deletions
+41
-0
lex.c
dlls/vbscript/lex.c
+33
-0
lang.vbs
dlls/vbscript/tests/lang.vbs
+8
-0
No files found.
dlls/vbscript/lex.c
View file @
e5d25a17
...
...
@@ -267,6 +267,35 @@ static int parse_numeric_literal(parser_ctx_t *ctx, void **ret)
return
tDouble
;
}
static
int
hex_to_int
(
WCHAR
c
)
{
if
(
'0'
<=
c
&&
c
<=
'9'
)
return
c
-
'0'
;
if
(
'a'
<=
c
&&
c
<=
'f'
)
return
c
+
10
-
'a'
;
if
(
'A'
<=
c
&&
c
<=
'F'
)
return
c
+
10
-
'A'
;
return
-
1
;
}
static
int
parse_hex_literal
(
parser_ctx_t
*
ctx
,
LONG
*
ret
)
{
const
WCHAR
*
begin
=
ctx
->
ptr
;
LONG
l
=
0
,
d
;
while
((
d
=
hex_to_int
(
*++
ctx
->
ptr
))
!=
-
1
)
l
=
l
*
16
+
d
;
if
(
begin
+
9
/* max digits+1 */
<
ctx
->
ptr
||
*
ctx
->
ptr
!=
'&'
)
{
FIXME
(
"invalid literal
\n
"
);
return
0
;
}
ctx
->
ptr
++
;
*
ret
=
l
;
return
(
short
)
l
==
l
?
tShort
:
tLong
;
}
static
void
skip_spaces
(
parser_ctx_t
*
ctx
)
{
while
(
*
ctx
->
ptr
==
' '
||
*
ctx
->
ptr
==
'\t'
||
*
ctx
->
ptr
==
'\r'
)
...
...
@@ -329,6 +358,10 @@ static int parse_next_token(void *lval, parser_ctx_t *ctx)
return
'('
;
case
'"'
:
return
parse_string_literal
(
ctx
,
lval
);
case
'&'
:
if
(
*++
ctx
->
ptr
==
'h'
||
*
ctx
->
ptr
==
'H'
)
return
parse_hex_literal
(
ctx
,
lval
);
return
'&'
;
case
'<'
:
switch
(
*++
ctx
->
ptr
)
{
case
'>'
:
...
...
dlls/vbscript/tests/lang.vbs
View file @
e5d25a17
...
...
@@ -31,6 +31,10 @@ Call ok(not (true = false), "true = false is true")
Call
ok
(
"x"
=
"x"
,
"
""
x
""
=
""
x
""
is false"
)
Call
ok
(
empty
=
empty
,
"empty = empty is false"
)
Call
ok
(
empty
=
""
,
"empty =
""""
is false"
)
Call
ok
(
0
=
0.0
,
"0 <> 0.0"
)
Call
ok
(
16
=
&
h10&
,
"16 <> &h10&"
)
Call
ok
(
010
=
10
,
"010 <> 10"
)
Call
ok
(
10.
=
10
,
"10. <> 10"
)
Call
ok
(
getVT
(
false
)
=
"VT_BOOL"
,
"getVT(false) is not VT_BOOL"
)
Call
ok
(
getVT
(
true
)
=
"VT_BOOL"
,
"getVT(true) is not VT_BOOL"
)
...
...
@@ -44,5 +48,9 @@ Call ok(getVT(0.5) = "VT_R8", "getVT(0.5) is not VT_R8")
Call
ok
(
getVT
(
0.0
)
=
"VT_R8"
,
"getVT(0.0) is not VT_R8"
)
Call
ok
(
getVT
(
2147483647
)
=
"VT_I4"
,
"getVT(2147483647) is not VT_I4"
)
Call
ok
(
getVT
(
2147483648
)
=
"VT_R8"
,
"getVT(2147483648) is not VT_R8"
)
Call
ok
(
getVT
(
&
h10&
)
=
"VT_I2"
,
"getVT(&h10&) is not VT_I2"
)
Call
ok
(
getVT
(
&
h10000&
)
=
"VT_I4"
,
"getVT(&h10000&) is not VT_I4"
)
Call
ok
(
getVT
(
&
H10000
&
)
=
"VT_I4"
,
"getVT(&H10000&) is not VT_I4"
)
Call
ok
(
getVT
(
&
hffFFffFF&
)
=
"VT_I2"
,
"getVT(&hffFFffFF&) is not VT_I2"
)
reportSuccess
()
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