Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
R
rapidjson
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
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
rapidjson
Commits
b0c96f9b
Commit
b0c96f9b
authored
Dec 01, 2018
by
ylavic
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use passed in allocator for internal regex parser.
parent
a6321605
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
6 deletions
+11
-6
regex.h
include/rapidjson/internal/regex.h
+11
-6
No files found.
include/rapidjson/internal/regex.h
View file @
b0c96f9b
...
...
@@ -118,7 +118,8 @@ public:
template
<
typename
,
typename
>
friend
class
GenericRegexSearch
;
GenericRegex
(
const
Ch
*
source
,
Allocator
*
allocator
=
0
)
:
states_
(
allocator
,
256
),
ranges_
(
allocator
,
256
),
root_
(
kRegexInvalidState
),
stateCount_
(),
rangeCount_
(),
ownAllocator_
(
allocator
?
0
:
RAPIDJSON_NEW
(
Allocator
)()),
allocator_
(
allocator
?
allocator
:
ownAllocator_
),
states_
(
allocator_
,
256
),
ranges_
(
allocator_
,
256
),
root_
(
kRegexInvalidState
),
stateCount_
(),
rangeCount_
(),
anchorBegin_
(),
anchorEnd_
()
{
GenericStringStream
<
Encoding
>
ss
(
source
);
...
...
@@ -126,7 +127,10 @@ public:
Parse
(
ds
);
}
~
GenericRegex
()
{}
~
GenericRegex
()
{
RAPIDJSON_DELETE
(
ownAllocator_
);
}
bool
IsValid
()
const
{
return
root_
!=
kRegexInvalidState
;
...
...
@@ -188,10 +192,9 @@ private:
template
<
typename
InputStream
>
void
Parse
(
DecodedStream
<
InputStream
,
Encoding
>&
ds
)
{
Allocator
allocator
;
Stack
<
Allocator
>
operandStack
(
&
allocator
,
256
);
// Frag
Stack
<
Allocator
>
operatorStack
(
&
allocator
,
256
);
// Operator
Stack
<
Allocator
>
atomCountStack
(
&
allocator
,
256
);
// unsigned (Atom per parenthesis)
Stack
<
Allocator
>
operandStack
(
allocator_
,
256
);
// Frag
Stack
<
Allocator
>
operatorStack
(
allocator_
,
256
);
// Operator
Stack
<
Allocator
>
atomCountStack
(
allocator_
,
256
);
// unsigned (Atom per parenthesis)
*
atomCountStack
.
template
Push
<
unsigned
>
()
=
0
;
...
...
@@ -582,6 +585,8 @@ private:
}
}
Allocator
*
ownAllocator_
;
Allocator
*
allocator_
;
Stack
<
Allocator
>
states_
;
Stack
<
Allocator
>
ranges_
;
SizeType
root_
;
...
...
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