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
4733fd06
Commit
4733fd06
authored
Apr 20, 2012
by
Jacek Caban
Committed by
Alexandre Julliard
Apr 20, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
jscript: Added regexp 'pre-parser' to support non-backslash-sequenced…
jscript: Added regexp 'pre-parser' to support non-backslash-sequenced non-terminating '/' in characted classes.
parent
a7137ef0
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
26 additions
and
4 deletions
+26
-4
lex.c
dlls/jscript/lex.c
+20
-4
regexp.js
dlls/jscript/tests/regexp.js
+6
-0
No files found.
dlls/jscript/lex.c
View file @
4733fd06
...
...
@@ -957,6 +957,7 @@ int parser_lex(void *lval, parser_ctx_t *ctx)
literal_t
*
parse_regexp
(
parser_ctx_t
*
ctx
)
{
const
WCHAR
*
re
,
*
flags_ptr
;
BOOL
in_class
=
FALSE
;
DWORD
re_len
,
flags
;
literal_t
*
ret
;
HRESULT
hres
;
...
...
@@ -965,14 +966,29 @@ literal_t *parse_regexp(parser_ctx_t *ctx)
while
(
*--
ctx
->
ptr
!=
'/'
);
/* Simple regexp pre-parser; '/' if used in char class does not terminate regexp literal */
re
=
++
ctx
->
ptr
;
while
(
ctx
->
ptr
<
ctx
->
end
&&
*
ctx
->
ptr
!=
'/'
)
{
if
(
*
ctx
->
ptr
++
==
'\\'
&&
ctx
->
ptr
<
ctx
->
end
)
while
(
ctx
->
ptr
<
ctx
->
end
)
{
if
(
*
ctx
->
ptr
==
'\\'
)
{
if
(
++
ctx
->
ptr
==
ctx
->
end
)
break
;
}
else
if
(
in_class
)
{
if
(
*
ctx
->
ptr
==
'\n'
)
break
;
if
(
*
ctx
->
ptr
==
']'
)
in_class
=
FALSE
;
}
else
{
if
(
*
ctx
->
ptr
==
'/'
)
break
;
if
(
*
ctx
->
ptr
==
'['
)
in_class
=
TRUE
;
}
ctx
->
ptr
++
;
}
if
(
ctx
->
ptr
==
ctx
->
end
)
{
WARN
(
"
unexpected end of file
\n
"
);
if
(
ctx
->
ptr
==
ctx
->
end
||
*
ctx
->
ptr
!=
'/'
)
{
WARN
(
"
pre-parsing failed
\n
"
);
return
NULL
;
}
...
...
dlls/jscript/tests/regexp.js
View file @
4733fd06
...
...
@@ -592,4 +592,10 @@ ok(tmp === "xxx", '"xxx".replace(/^\s*|\s*$/g, "y") = ' + tmp);
tmp
=
"xxx"
.
replace
(
/^
\s
*|
\s
*$/g
,
"y"
);
ok
(
tmp
===
"yxxxy"
,
'"xxx".replace(/^
\
s*|
\
s*$/g, "y") = '
+
tmp
);
tmp
=
"x/y"
.
replace
(
/
[/]
/
,
"*"
);
ok
(
tmp
===
"x*y"
,
'"x/y".replace(/[/]/, "*") = '
+
tmp
);
tmp
=
"x/y"
.
replace
(
/
[
xy
/]
/g
,
"*"
);
ok
(
tmp
===
"***"
,
'"x/y".replace(/[xy/]/, "*") = '
+
tmp
);
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