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
edc9df20
Commit
edc9df20
authored
Mar 01, 2019
by
Jacek Caban
Committed by
Alexandre Julliard
Mar 04, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
jscript: Return regexp string as jsstr_t from lexer.
Signed-off-by:
Jacek Caban
<
jacek@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
79557db9
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
15 additions
and
25 deletions
+15
-25
compile.c
dlls/jscript/compile.c
+5
-19
lex.c
dlls/jscript/lex.c
+1
-2
parser.h
dlls/jscript/parser.h
+5
-3
parser.y
dlls/jscript/parser.y
+4
-1
No files found.
dlls/jscript/compile.c
View file @
edc9df20
...
@@ -48,7 +48,7 @@ typedef struct {
...
@@ -48,7 +48,7 @@ typedef struct {
int
ref
;
int
ref
;
}
function_local_t
;
}
function_local_t
;
typedef
struct
{
typedef
struct
_compiler_ctx_t
{
parser_ctx_t
*
parser
;
parser_ctx_t
*
parser
;
bytecode_t
*
code
;
bytecode_t
*
code
;
...
@@ -130,7 +130,7 @@ static inline void *compiler_alloc(bytecode_t *code, size_t size)
...
@@ -130,7 +130,7 @@ static inline void *compiler_alloc(bytecode_t *code, size_t size)
return
heap_pool_alloc
(
&
code
->
heap
,
size
);
return
heap_pool_alloc
(
&
code
->
heap
,
size
);
}
}
static
jsstr_t
*
compiler_alloc_string_len
(
compiler_ctx_t
*
ctx
,
const
WCHAR
*
str
,
unsigned
len
)
jsstr_t
*
compiler_alloc_string_len
(
compiler_ctx_t
*
ctx
,
const
WCHAR
*
str
,
unsigned
len
)
{
{
jsstr_t
*
new_str
;
jsstr_t
*
new_str
;
...
@@ -825,22 +825,8 @@ static HRESULT compile_literal(compiler_ctx_t *ctx, literal_t *literal)
...
@@ -825,22 +825,8 @@ static HRESULT compile_literal(compiler_ctx_t *ctx, literal_t *literal)
return
push_instr
(
ctx
,
OP_null
)
?
S_OK
:
E_OUTOFMEMORY
;
return
push_instr
(
ctx
,
OP_null
)
?
S_OK
:
E_OUTOFMEMORY
;
case
LT_STRING
:
case
LT_STRING
:
return
push_instr_str
(
ctx
,
OP_str
,
literal
->
u
.
wstr
);
return
push_instr_str
(
ctx
,
OP_str
,
literal
->
u
.
wstr
);
case
LT_REGEXP
:
{
case
LT_REGEXP
:
unsigned
instr
;
return
push_instr_str_uint
(
ctx
,
OP_regexp
,
literal
->
u
.
regexp
.
str
,
literal
->
u
.
regexp
.
flags
);
jsstr_t
*
str
;
str
=
compiler_alloc_string_len
(
ctx
,
literal
->
u
.
regexp
.
str
,
literal
->
u
.
regexp
.
str_len
);
if
(
!
str
)
return
E_OUTOFMEMORY
;
instr
=
push_instr
(
ctx
,
OP_regexp
);
if
(
!
instr
)
return
E_OUTOFMEMORY
;
instr_ptr
(
ctx
,
instr
)
->
u
.
arg
[
0
].
str
=
str
;
instr_ptr
(
ctx
,
instr
)
->
u
.
arg
[
1
].
uint
=
literal
->
u
.
regexp
.
flags
;
return
S_OK
;
}
DEFAULT_UNREACHABLE
;
DEFAULT_UNREACHABLE
;
}
}
return
E_FAIL
;
return
E_FAIL
;
...
@@ -2480,7 +2466,7 @@ HRESULT compile_script(script_ctx_t *ctx, const WCHAR *code, const WCHAR *args,
...
@@ -2480,7 +2466,7 @@ HRESULT compile_script(script_ctx_t *ctx, const WCHAR *code, const WCHAR *args,
}
}
}
}
hres
=
script_parse
(
ctx
,
compiler
.
code
->
source
,
delimiter
,
from_eval
,
&
compiler
.
parser
);
hres
=
script_parse
(
ctx
,
&
compiler
,
compiler
.
code
->
source
,
delimiter
,
from_eval
,
&
compiler
.
parser
);
if
(
FAILED
(
hres
))
{
if
(
FAILED
(
hres
))
{
release_bytecode
(
compiler
.
code
);
release_bytecode
(
compiler
.
code
);
return
hres
;
return
hres
;
...
...
dlls/jscript/lex.c
View file @
edc9df20
...
@@ -1201,8 +1201,7 @@ literal_t *parse_regexp(parser_ctx_t *ctx)
...
@@ -1201,8 +1201,7 @@ literal_t *parse_regexp(parser_ctx_t *ctx)
ret
=
parser_alloc
(
ctx
,
sizeof
(
literal_t
));
ret
=
parser_alloc
(
ctx
,
sizeof
(
literal_t
));
ret
->
type
=
LT_REGEXP
;
ret
->
type
=
LT_REGEXP
;
ret
->
u
.
regexp
.
str
=
re
;
ret
->
u
.
regexp
.
str
=
compiler_alloc_string_len
(
ctx
->
compiler
,
re
,
re_len
);
ret
->
u
.
regexp
.
str_len
=
re_len
;
ret
->
u
.
regexp
.
flags
=
flags
;
ret
->
u
.
regexp
.
flags
=
flags
;
return
ret
;
return
ret
;
}
}
dlls/jscript/parser.h
View file @
edc9df20
...
@@ -34,6 +34,7 @@ typedef struct _parser_ctx_t {
...
@@ -34,6 +34,7 @@ typedef struct _parser_ctx_t {
const
WCHAR
*
ptr
;
const
WCHAR
*
ptr
;
script_ctx_t
*
script
;
script_ctx_t
*
script
;
struct
_compiler_ctx_t
*
compiler
;
source_elements_t
*
source
;
source_elements_t
*
source
;
BOOL
nl
;
BOOL
nl
;
BOOL
implicit_nl_semicolon
;
BOOL
implicit_nl_semicolon
;
...
@@ -47,7 +48,7 @@ typedef struct _parser_ctx_t {
...
@@ -47,7 +48,7 @@ typedef struct _parser_ctx_t {
heap_pool_t
heap
;
heap_pool_t
heap
;
}
parser_ctx_t
;
}
parser_ctx_t
;
HRESULT
script_parse
(
script_ctx_t
*
,
const
WCHAR
*
,
const
WCHAR
*
,
BOOL
,
parser_ctx_t
**
)
DECLSPEC_HIDDEN
;
HRESULT
script_parse
(
script_ctx_t
*
,
struct
_compiler_ctx_t
*
,
const
WCHAR
*
,
const
WCHAR
*
,
BOOL
,
parser_ctx_t
**
)
DECLSPEC_HIDDEN
;
void
parser_release
(
parser_ctx_t
*
)
DECLSPEC_HIDDEN
;
void
parser_release
(
parser_ctx_t
*
)
DECLSPEC_HIDDEN
;
int
parser_lex
(
void
*
,
parser_ctx_t
*
)
DECLSPEC_HIDDEN
;
int
parser_lex
(
void
*
,
parser_ctx_t
*
)
DECLSPEC_HIDDEN
;
...
@@ -81,8 +82,7 @@ typedef struct {
...
@@ -81,8 +82,7 @@ typedef struct {
const
WCHAR
*
wstr
;
const
WCHAR
*
wstr
;
BOOL
bval
;
BOOL
bval
;
struct
{
struct
{
const
WCHAR
*
str
;
jsstr_t
*
str
;
DWORD
str_len
;
DWORD
flags
;
DWORD
flags
;
}
regexp
;
}
regexp
;
}
u
;
}
u
;
...
@@ -399,3 +399,5 @@ static inline double get_ccnum(ccval_t v)
...
@@ -399,3 +399,5 @@ static inline double get_ccnum(ccval_t v)
{
{
return
v
.
is_num
?
v
.
u
.
n
:
v
.
u
.
b
;
return
v
.
is_num
?
v
.
u
.
n
:
v
.
u
.
b
;
}
}
jsstr_t
*
compiler_alloc_string_len
(
struct
_compiler_ctx_t
*
,
const
WCHAR
*
,
unsigned
)
DECLSPEC_HIDDEN
;
dlls/jscript/parser.y
View file @
edc9df20
...
@@ -1566,7 +1566,7 @@ void parser_release(parser_ctx_t *ctx)
...
@@ -1566,7 +1566,7 @@ void parser_release(parser_ctx_t *ctx)
heap_free(ctx);
heap_free(ctx);
}
}
HRESULT script_parse(script_ctx_t *ctx, const WCHAR *code, const WCHAR *delimiter, BOOL from_eval,
HRESULT script_parse(script_ctx_t *ctx,
struct _compiler_ctx_t *compiler,
const WCHAR *code, const WCHAR *delimiter, BOOL from_eval,
parser_ctx_t **ret)
parser_ctx_t **ret)
{
{
parser_ctx_t *parser_ctx;
parser_ctx_t *parser_ctx;
...
@@ -1591,7 +1591,10 @@ HRESULT script_parse(script_ctx_t *ctx, const WCHAR *code, const WCHAR *delimite
...
@@ -1591,7 +1591,10 @@ HRESULT script_parse(script_ctx_t *ctx, const WCHAR *code, const WCHAR *delimite
mark = heap_pool_mark(&ctx->tmp_heap);
mark = heap_pool_mark(&ctx->tmp_heap);
heap_pool_init(&parser_ctx->heap);
heap_pool_init(&parser_ctx->heap);
parser_ctx->compiler = compiler;
parser_parse(parser_ctx);
parser_parse(parser_ctx);
parser_ctx->compiler = NULL;
heap_pool_clear(mark);
heap_pool_clear(mark);
hres = parser_ctx->hres;
hres = parser_ctx->hres;
if(FAILED(hres)) {
if(FAILED(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