mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 04:37:34 +00:00
LibRegex: Allow separately parsing patterns and creating Regex objects
Adds a static method to parse a regex pattern and return the result, and a constructor to accept a parse result. This is to allow LibJS to parse the pattern string of a RegExpLiteral once and hand off regex objects any number of times thereafter.
This commit is contained in:
parent
b162517065
commit
1400e3cf58
2 changed files with 21 additions and 0 deletions
|
@ -80,7 +80,10 @@ public:
|
|||
OwnPtr<Matcher<Parser>> matcher { nullptr };
|
||||
mutable size_t start_offset { 0 };
|
||||
|
||||
static regex::Parser::Result parse_pattern(StringView pattern, typename ParserTraits<Parser>::OptionsType regex_options = {});
|
||||
|
||||
explicit Regex(String pattern, typename ParserTraits<Parser>::OptionsType regex_options = {});
|
||||
Regex(regex::Parser::Result parse_result, String pattern, typename ParserTraits<Parser>::OptionsType regex_options = {});
|
||||
~Regex() = default;
|
||||
Regex(Regex&&);
|
||||
Regex& operator=(Regex&&);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue