Std. Regex. Syntax
(Cure Standard Library v0.37.2)
View Source
Compile-time support for Cure's regex literal syntax. The macro parses a
pattern and lowers it to the runtime Std.Regex representation.
Examples
use Std.Regex.Syntax
regex_failure_message(:UnclosedRegexGroup)
regex_failure_hint(:UnclosedRegexGroup)
Summary
Functions
Macro entry point for regex literals; extracts the pattern and flag
strings from input and delegates to expand_literal_strings.
Parse pattern and flags, validate captures and lookarounds, and emit
the lowered Std.Regex.Runtime expression AST.
Return a remediation hint explaining how to fix a regex literal failure
reason atom.
Return the human-readable diagnostic message for a regex literal failure
reason atom.
Reject a regex literal with a diagnostic pointing at the subspan
(start, width) inside pattern_syntax.
Map a parser-space (start, width) span back to original literal source
coordinates via positions and reject the literal with a located diagnostic.
Reject a regex literal with a diagnostic attached to the full
pattern_syntax span.
Functions
fn expand_literal(input: Syntax) -> MacroResult
Macro entry point for regex literals; extracts the pattern and flag
strings from input and delegates to expand_literal_strings.
fn expand_literal_strings(pattern_syntax: Syntax, pattern: String, flags: String) -> MacroResult
Parse pattern and flags, validate captures and lookarounds, and emit
the lowered Std.Regex.Runtime expression AST.
fn regex_failure_hint(reason: Atom) -> String
Return a remediation hint explaining how to fix a regex literal failure
reason atom.
fn regex_failure_message(reason: Atom) -> String
Return the human-readable diagnostic message for a regex literal failure
reason atom.
fn reject_located_literal(pattern_syntax: Syntax, reason: Atom, start: Nat, width: Nat) -> MacroResult
Reject a regex literal with a diagnostic pointing at the subspan
(start, width) inside pattern_syntax.
fn reject_mapped_literal(pattern_syntax: Syntax, reason: Atom, positions: List(Nat), source_length: Nat, start: Nat, width: Nat) -> MacroResult
Map a parser-space (start, width) span back to original literal source
coordinates via positions and reject the literal with a located diagnostic.
fn reject_unlocated_literal(pattern_syntax: Syntax, reason: Atom) -> MacroResult
Reject a regex literal with a diagnostic attached to the full
pattern_syntax span.