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
b9b11c6c
Commit
b9b11c6c
authored
Oct 19, 2010
by
Piotr Caban
Committed by
Alexandre Julliard
Oct 19, 2010
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
jscript: Add index, input and lastIndex properties to regexp functions results.
parent
dcdc6c70
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
32 additions
and
0 deletions
+32
-0
regexp.c
dlls/jscript/regexp.c
+28
-0
regexp.js
dlls/jscript/tests/regexp.js
+4
-0
No files found.
dlls/jscript/regexp.c
View file @
b9b11c6c
...
...
@@ -3590,6 +3590,7 @@ static HRESULT create_match_array(script_ctx_t *ctx, BSTR input, const match_res
static
const
WCHAR
indexW
[]
=
{
'i'
,
'n'
,
'd'
,
'e'
,
'x'
,
0
};
static
const
WCHAR
inputW
[]
=
{
'i'
,
'n'
,
'p'
,
'u'
,
't'
,
0
};
static
const
WCHAR
lastIndexW
[]
=
{
'l'
,
'a'
,
's'
,
't'
,
'I'
,
'n'
,
'd'
,
'e'
,
'x'
,
0
};
static
const
WCHAR
zeroW
[]
=
{
'0'
,
0
};
hres
=
create_array
(
ctx
,
parens_cnt
+
1
,
&
array
);
...
...
@@ -3617,6 +3618,11 @@ static HRESULT create_match_array(script_ctx_t *ctx, BSTR input, const match_res
if
(
FAILED
(
hres
))
break
;
V_I4
(
&
var
)
=
result
->
str
-
input
+
result
->
len
;
hres
=
jsdisp_propput_name
(
array
,
lastIndexW
,
&
var
,
ei
,
NULL
/*FIXME*/
);
if
(
FAILED
(
hres
))
break
;
V_VT
(
&
var
)
=
VT_BSTR
;
V_BSTR
(
&
var
)
=
input
;
hres
=
jsdisp_propput_name
(
array
,
inputW
,
&
var
,
ei
,
NULL
/*FIXME*/
);
...
...
@@ -3918,6 +3924,10 @@ HRESULT create_regexp_var(script_ctx_t *ctx, VARIANT *src_arg, VARIANT *flags_ar
HRESULT
regexp_string_match
(
script_ctx_t
*
ctx
,
jsdisp_t
*
re
,
BSTR
str
,
VARIANT
*
retv
,
jsexcept_t
*
ei
)
{
static
const
WCHAR
indexW
[]
=
{
'i'
,
'n'
,
'd'
,
'e'
,
'x'
,
0
};
static
const
WCHAR
inputW
[]
=
{
'i'
,
'n'
,
'p'
,
'u'
,
't'
,
0
};
static
const
WCHAR
lastIndexW
[]
=
{
'l'
,
'a'
,
's'
,
't'
,
'I'
,
'n'
,
'd'
,
'e'
,
'x'
,
0
};
RegExpInstance
*
regexp
=
(
RegExpInstance
*
)
re
;
match_result_t
*
match_result
;
DWORD
match_cnt
,
i
,
length
;
...
...
@@ -3985,6 +3995,24 @@ HRESULT regexp_string_match(script_ctx_t *ctx, jsdisp_t *re, BSTR str,
break
;
}
while
(
SUCCEEDED
(
hres
))
{
V_VT
(
&
var
)
=
VT_I4
;
V_I4
(
&
var
)
=
match_result
[
match_cnt
-
1
].
str
-
str
;
hres
=
jsdisp_propput_name
(
array
,
indexW
,
&
var
,
ei
,
NULL
/*FIXME*/
);
if
(
FAILED
(
hres
))
break
;
V_I4
(
&
var
)
=
match_result
[
match_cnt
-
1
].
str
-
str
+
match_result
[
match_cnt
-
1
].
len
;
hres
=
jsdisp_propput_name
(
array
,
lastIndexW
,
&
var
,
ei
,
NULL
/*FIXME*/
);
if
(
FAILED
(
hres
))
break
;
V_VT
(
&
var
)
=
VT_BSTR
;
V_BSTR
(
&
var
)
=
str
;
hres
=
jsdisp_propput_name
(
array
,
inputW
,
&
var
,
ei
,
NULL
/*FIXME*/
);
break
;
}
heap_free
(
match_result
);
if
(
SUCCEEDED
(
hres
)
&&
retv
)
...
...
dlls/jscript/tests/regexp.js
View file @
b9b11c6c
...
...
@@ -50,6 +50,7 @@ ok(re.lastIndex === 0, "re.lastIndex = " + re.lastIndex);
m
=
re
.
exec
(
" aabaaa"
);
ok
(
re
.
lastIndex
===
3
,
"re.lastIndex = "
+
re
.
lastIndex
);
ok
(
m
.
index
===
1
,
"m.index = "
+
m
.
index
);
ok
(
m
.
lastIndex
==
3
,
"m.lastIndex = "
+
m
.
lastIndex
);
ok
(
m
.
input
===
" aabaaa"
,
"m.input = "
+
m
.
input
);
ok
(
m
.
length
===
1
,
"m.length = "
+
m
.
length
);
ok
(
m
[
0
]
===
"aa"
,
"m[0] = "
+
m
[
0
]);
...
...
@@ -194,6 +195,9 @@ ok(typeof(m) === "object", "typeof m is not object");
ok
(
m
.
length
===
2
,
"m.length is not 2"
);
ok
(
m
[
"0"
]
===
"ab"
,
"m[0] is not
\"
ab
\"
"
);
ok
(
m
[
"1"
]
===
"ab"
,
"m[1] is not
\"
ab
\"
"
);
ok
(
m
.
index
===
3
,
"m.index = "
+
m
.
index
);
ok
(
m
.
input
===
"abcabc"
,
"m.input = "
+
m
.
input
);
ok
(
m
.
lastIndex
===
5
,
"m.lastIndex = "
+
m
.
lastIndex
);
m
=
"abcabcg"
.
match
(
"ab"
,
"g"
);
ok
(
typeof
(
m
)
===
"object"
,
"typeof m is not object"
);
...
...
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