Std. Regex. Syntax. Flags
(Cure Standard Library v0.37.2)
View Source
Parser helpers for regex literal modifiers such as i, m, and u.
Examples
use Std.Regex.Syntax.Model
use Std.Regex.Syntax.Flags
parse_literal_flags(['i', 'm'], literal_default_options())
literal_extended_space(' ') # => true
Summary
Functions
Return true if char is an ASCII whitespace character ignored in
extended (x) mode.
Pair each character of input with its sequential source position starting
from position.
Parse regex literal modifier characters into a LiteralFlags result,
updating options for each recognized flag (i, m, s, x, u, f,
U, E).
Prepare a raw regex literal character list for parsing, stripping extended
whitespace and comments when ExtendedModifier is enabled while recording
original source positions.
Prepend a character and its original source offset onto a LiteralSourceMap.
Strip unescaped whitespace and #-to-newline comments under extended (x)
mode while preserving character classes and source positions.
Preserve characters verbatim inside a [...] character class under
extended (x) mode until the closing ].
Preserve the character immediately following a backslash inside a character
class under extended (x) mode.
Discard characters in an extended (x) mode # comment up to and
including the terminating newline.
Preserve the character immediately following a backslash in extended (x)
mode and resume stripping the remainder.
Functions
fn literal_extended_space(char: Char) -> Bool
Return true if char is an ASCII whitespace character ignored in
extended (x) mode.
fn map_literal_source(input: List(Char), position: Nat) -> LiteralSourceMap
Pair each character of input with its sequential source position starting
from position.
fn parse_literal_flags(flags: List(Char), options: LiteralRegexOptions) -> LiteralFlags
Parse regex literal modifier characters into a LiteralFlags result,
updating options for each recognized flag (i, m, s, x, u, f,
U, E).
fn prepare_literal(pattern: List(Char), options: LiteralRegexOptions) -> LiteralPrepared
Prepare a raw regex literal character list for parsing, stripping extended
whitespace and comments when ExtendedModifier is enabled while recording
original source positions.
fn prepend_literal_source(char: Char, position: Nat, mapped: LiteralSourceMap) -> LiteralSourceMap
Prepend a character and its original source offset onto a LiteralSourceMap.
fn strip_extended(input: List(Char), position: Nat) -> LiteralSourceMap
Strip unescaped whitespace and #-to-newline comments under extended (x)
mode while preserving character classes and source positions.
fn strip_extended_class(input: List(Char), position: Nat) -> LiteralSourceMap
Preserve characters verbatim inside a [...] character class under
extended (x) mode until the closing ].
fn strip_extended_class_escaped(input: List(Char), position: Nat) -> LiteralSourceMap
Preserve the character immediately following a backslash inside a character
class under extended (x) mode.
fn strip_extended_comment(input: List(Char), position: Nat) -> LiteralSourceMap
Discard characters in an extended (x) mode # comment up to and
including the terminating newline.
fn strip_extended_escaped(input: List(Char), position: Nat) -> LiteralSourceMap
Preserve the character immediately following a backslash in extended (x)
mode and resume stripping the remainder.