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
98b5a1c6
Commit
98b5a1c6
authored
Oct 14, 2009
by
Jacek Caban
Committed by
Alexandre Julliard
Oct 14, 2009
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
jscript: Separate flags parsing from regexp creating.
parent
fa3e6917
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
38 additions
and
30 deletions
+38
-30
jscript.h
dlls/jscript/jscript.h
+2
-1
lex.c
dlls/jscript/lex.c
+8
-4
regexp.c
dlls/jscript/regexp.c
+27
-24
string.c
dlls/jscript/string.c
+1
-1
No files found.
dlls/jscript/jscript.h
View file @
98b5a1c6
...
...
@@ -225,7 +225,7 @@ HRESULT throw_uri_error(script_ctx_t*,jsexcept_t*,UINT,const WCHAR*);
HRESULT
create_object
(
script_ctx_t
*
,
DispatchEx
*
,
DispatchEx
**
);
HRESULT
create_math
(
script_ctx_t
*
,
DispatchEx
**
);
HRESULT
create_array
(
script_ctx_t
*
,
DWORD
,
DispatchEx
**
);
HRESULT
create_regexp
_str
(
script_ctx_t
*
,
const
WCHAR
*
,
DWORD
,
const
WCHAR
*
,
DWORD
,
DispatchEx
**
);
HRESULT
create_regexp
(
script_ctx_t
*
,
const
WCHAR
*
,
int
,
DWORD
,
DispatchEx
**
);
HRESULT
create_string
(
script_ctx_t
*
,
const
WCHAR
*
,
DWORD
,
DispatchEx
**
);
HRESULT
create_bool
(
script_ctx_t
*
,
VARIANT_BOOL
,
DispatchEx
**
);
HRESULT
create_number
(
script_ctx_t
*
,
VARIANT
*
,
DispatchEx
**
);
...
...
@@ -319,6 +319,7 @@ typedef struct {
HRESULT
regexp_match_next
(
script_ctx_t
*
,
DispatchEx
*
,
BOOL
,
const
WCHAR
*
,
DWORD
,
const
WCHAR
**
,
match_result_t
**
,
DWORD
*
,
DWORD
*
,
match_result_t
*
);
HRESULT
regexp_match
(
script_ctx_t
*
,
DispatchEx
*
,
const
WCHAR
*
,
DWORD
,
BOOL
,
match_result_t
**
,
DWORD
*
);
HRESULT
parse_regexp_flags
(
const
WCHAR
*
,
DWORD
,
DWORD
*
);
static
inline
VARIANT
*
get_arg
(
DISPPARAMS
*
dp
,
DWORD
i
)
{
...
...
dlls/jscript/lex.c
View file @
98b5a1c6
...
...
@@ -766,10 +766,10 @@ static void add_object_literal(parser_ctx_t *ctx, DispatchEx *obj)
literal_t
*
parse_regexp
(
parser_ctx_t
*
ctx
)
{
const
WCHAR
*
re
,
*
flags
;
const
WCHAR
*
re
,
*
flags_ptr
;
DWORD
re_len
,
flags
;
DispatchEx
*
regexp
;
literal_t
*
ret
;
DWORD
re_len
;
HRESULT
hres
;
TRACE
(
"
\n
"
);
...
...
@@ -790,11 +790,15 @@ literal_t *parse_regexp(parser_ctx_t *ctx)
re_len
=
ctx
->
ptr
-
re
;
flags
=
++
ctx
->
ptr
;
flags
_ptr
=
++
ctx
->
ptr
;
while
(
ctx
->
ptr
<
ctx
->
end
&&
isalnumW
(
*
ctx
->
ptr
))
ctx
->
ptr
++
;
hres
=
create_regexp_str
(
ctx
->
script
,
re
,
re_len
,
flags
,
ctx
->
ptr
-
flags
,
&
regexp
);
hres
=
parse_regexp_flags
(
flags_ptr
,
ctx
->
ptr
-
flags_ptr
,
&
flags
);
if
(
FAILED
(
hres
))
return
NULL
;
hres
=
create_regexp
(
ctx
->
script
,
re
,
re_len
,
flags
,
&
regexp
);
if
(
FAILED
(
hres
))
return
NULL
;
...
...
dlls/jscript/regexp.c
View file @
98b5a1c6
...
...
@@ -3737,7 +3737,7 @@ static HRESULT alloc_regexp(script_ctx_t *ctx, DispatchEx *object_prototype, Reg
return
S_OK
;
}
static
HRESULT
create_regexp
(
script_ctx_t
*
ctx
,
const
WCHAR
*
exp
,
int
len
,
DWORD
flags
,
DispatchEx
**
ret
)
HRESULT
create_regexp
(
script_ctx_t
*
ctx
,
const
WCHAR
*
exp
,
int
len
,
DWORD
flags
,
DispatchEx
**
ret
)
{
RegExpInstance
*
regexp
;
HRESULT
hres
;
...
...
@@ -3773,6 +3773,7 @@ static HRESULT regexp_constructor(script_ctx_t *ctx, DISPPARAMS *dp, VARIANT *re
const
WCHAR
*
opt
=
emptyW
,
*
src
;
DispatchEx
*
ret
;
VARIANT
*
arg
;
DWORD
flags
;
HRESULT
hres
;
if
(
!
arg_cnt
(
dp
))
{
...
...
@@ -3820,7 +3821,11 @@ static HRESULT regexp_constructor(script_ctx_t *ctx, DISPPARAMS *dp, VARIANT *re
opt
=
V_BSTR
(
arg
);
}
hres
=
create_regexp_str
(
ctx
,
src
,
-
1
,
opt
,
strlenW
(
opt
),
&
ret
);
hres
=
parse_regexp_flags
(
opt
,
strlenW
(
opt
),
&
flags
);
if
(
FAILED
(
hres
))
return
hres
;
hres
=
create_regexp
(
ctx
,
src
,
-
1
,
flags
,
&
ret
);
if
(
FAILED
(
hres
))
return
hres
;
...
...
@@ -3892,33 +3897,31 @@ HRESULT create_regexp_constr(script_ctx_t *ctx, DispatchEx *object_prototype, Di
return
hres
;
}
HRESULT
create_regexp_str
(
script_ctx_t
*
ctx
,
const
WCHAR
*
exp
,
DWORD
exp_len
,
const
WCHAR
*
opt
,
DWORD
opt_len
,
DispatchEx
**
ret
)
HRESULT
parse_regexp_flags
(
const
WCHAR
*
str
,
DWORD
str_len
,
DWORD
*
ret
)
{
const
WCHAR
*
p
;
DWORD
flags
=
0
;
if
(
opt
)
{
for
(
p
=
opt
;
p
<
opt
+
opt_len
;
p
++
)
{
switch
(
*
p
)
{
case
'g'
:
flags
|=
JSREG_GLOB
;
break
;
case
'i'
:
flags
|=
JSREG_FOLD
;
break
;
case
'm'
:
flags
|=
JSREG_MULTILINE
;
break
;
case
'y'
:
flags
|=
JSREG_STICKY
;
break
;
default:
WARN
(
"wrong flag %c
\n
"
,
*
p
);
return
E_FAIL
;
}
for
(
p
=
str
;
p
<
str
+
str_len
;
p
++
)
{
switch
(
*
p
)
{
case
'g'
:
flags
|=
JSREG_GLOB
;
break
;
case
'i'
:
flags
|=
JSREG_FOLD
;
break
;
case
'm'
:
flags
|=
JSREG_MULTILINE
;
break
;
case
'y'
:
flags
|=
JSREG_STICKY
;
break
;
default:
WARN
(
"wrong flag %c
\n
"
,
*
p
);
return
E_FAIL
;
}
}
return
create_regexp
(
ctx
,
exp
,
exp_len
,
flags
,
ret
);
*
ret
=
flags
;
return
S_OK
;
}
dlls/jscript/string.c
View file @
98b5a1c6
...
...
@@ -656,7 +656,7 @@ static HRESULT String_match(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISP
if
(
FAILED
(
hres
))
return
hres
;
hres
=
create_regexp
_str
(
ctx
,
match_str
,
SysStringLen
(
match_str
),
NULL
,
0
,
&
regexp
);
hres
=
create_regexp
(
ctx
,
match_str
,
SysStringLen
(
match_str
)
,
0
,
&
regexp
);
SysFreeString
(
match_str
);
if
(
FAILED
(
hres
))
return
hres
;
...
...
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