mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 21:57:35 +00:00
LibRegex: Implement ECMA262 multiline matching without splitting lines
As ECMA262 regex allows `[^]` and literal newlines to match newlines in the input string, we shouldn't split the input string into lines, rather simply make boundaries and catchall patterns capable of checking for these conditions specifically.
This commit is contained in:
parent
98183ef572
commit
5fac41f733
7 changed files with 55 additions and 20 deletions
|
@ -83,6 +83,7 @@ enum __RegexAllFlags {
|
|||
__Regex_SkipTrimEmptyMatches = __Regex_Global << 13, // Do not remove empty capture group results.
|
||||
__Regex_Internal_Stateful = __Regex_Global << 14, // Internal flag; enables stateful matches.
|
||||
__Regex_Internal_BrowserExtended = __Regex_Global << 15, // Internal flag; enable browser-specific ECMA262 extensions.
|
||||
__Regex_Internal_ConsiderNewline = __Regex_Global << 16, // Internal flag; allow matchers to consider newlines as line separators.
|
||||
__Regex_Last = __Regex_SkipTrimEmptyMatches
|
||||
};
|
||||
|
||||
|
@ -97,7 +98,6 @@ enum __RegexAllFlags {
|
|||
#define REG_NOTBOL __Regex_MatchNotBeginOfLine // The circumflex character (^), when taken as a special character, will not match the beginning of string.
|
||||
#define REG_NOTEOL __Regex_MatchNotEndOfLine // The dollar sign ($), when taken as a special character, will not match the end of string.
|
||||
|
||||
//static_assert (sizeof(FlagsUnderlyingType) * 8 >= regex::POSIXFlags::Last << 1), "flags type too small")
|
||||
#define REG_SEARCH __Regex_Last << 1
|
||||
|
||||
int regcomp(regex_t*, const char*, int);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue