Std. Regex. Syntax. Model
(Cure Standard Library v0.37.2)
View Source
Compile-time-only literal syntax tree. It is consumed by expand_literal
and never appears in generated matching code.
Examples
use Std.Regex.Syntax.Model
fn exact_width_two() -> Option(Nat) =
literal_pattern_exact_width(LiteralSequence(LiteralExact('a'), LiteralDigit(false)))
Summary
Types
Capture-layout validation is a checked decision, not a Boolean side condition. The compatible branch is the certificate consumed by the branch-reset and conditional walkers; the incompatible branch is the only route to their structured diagnostics. Keeping this distinction in an indexed data type prevents a caller from accidentally treating a failed comparison as a valid layout.
Capture slots are allocated once, immediately after parsing. The slot number is stable metadata used by the named-capture side channel; it is deliberately absent from ShapeCode and therefore cannot perturb the existing typed result.
A lexical atomic scope. The inner pattern keeps its ordinary typed result shape; commitment is carried by the compiled machine rather than by a second untyped matcher.
Functions
Allocate every ordinary and named group in source order. Ordinary groups receive an unnamed slot as well: later branch-reset and participation phases can therefore reuse this layout without changing the parser again.
Appends two lists of LiteralCaptureSlotInfo descriptors.
Appends two lists of LiteralPattern nodes.
Disables every modifier in disabled on options.
Enables every modifier in enabled on options.
Applies a scoped inline option change by first disabling disabled modifiers and then enabling enabled.
Returns true when two character lists are equal element-by-element.
Returns true when name is already present in names.
Returns true when two capture group names have identical character sequences.
Returns true when value is DigitKind.
Returns true when value is HorizontalKind.
Returns true when value is NotDigitKind.
Returns true when value is NotHorizontalKind.
Returns true when value is NotSpaceKind.
Returns true when value is NotVerticalKind.
Returns true when value is NotWordKind.
Returns true when value is SpaceKind.
Returns true when value is VerticalKind.
Returns true when value is WordKind.
Removes all occurrences of modifier from options.
Returns an empty regex input character list.
Adds a shorthand character class kind to kinds.
Adds modifier to the enabled modifier list in options.
Adds a POSIX character class matcher (optionally negated) to kinds.
Adds a Unicode property matcher (optionally negated) to kinds.
Returns true when kinds contains the shorthand class wanted.
Returns true when wanted appears in the shorthand class list values.
Returns true when wanted is enabled in options.
Returns true when wanted appears in the modifier list values.
Returns true when char terminates a sequence (| or )).
Folds a list of alternative patterns left-associatively into nested LiteralAlternate nodes.
Left-folds remaining alternation arms onto left.
Returns true when left is strictly less than right as Bounded(n) indices.
Parses the hexadecimal digits of a braced escape \x{H...} up to }.
Lowers branch-reset arms into a left-associative alternation pattern.
A total, constructor-level decision for the slot ledger. Unlike the legacy Boolean helper below, callers must inspect the compatible branch before they can proceed with a normalized layout.
Returns true when layout contains at least one named capture slot.
Looks up the 0-based capture slot index for name in layout.
Searches a slot descriptor list for the first slot matching name.
Returns true when any descriptor in slots carries a capture name.
Returns the POSIX class matchers stored in kinds.
Returns the Unicode property matchers stored in kinds.
Converts an ASCII decimal digit character '0'..'9' to its Nat value.
Counts leading ASCII decimal digits in input.
Returns the default LiteralRegexOptions with no modifiers and LiteralAnyUnicodePolicy.
Measures the character width from the start of input through the first occurrence of closing (or end of input).
Parses a two-digit hexadecimal escape \xHH into a Unicode scalar.
Computes the structural recursion fuel budget for parsing input.
Returns the length of a character list as a Nat.
This bound is shared with the runtime assertion evaluator. It is large enough for useful composition while keeping staged proof terms finite and predictable under hostile literals.
Returns the maximum allowed fixed character width (8) for a lookbehind assertion.
Adds two Peano Nat values structurally.
Returns true when left is strictly less than right as Peano Nat values.
Computes truncating subtraction (max(0, left - right)) on Peano Nat values.
Multiplies two Peano Nat values structurally.
Returns the predecessor of a positive Nat, or None() for Z().
Multiplies a Nat by 10 using repeated addition.
Extracts the active LiteralNewlinePolicy from options.
Estimates the diagnostic span width of a numeric escape such as \1.
Computes the exact character width of pattern, or None() when the pattern has variable width.
Returns the exact width of pattern as a Nat, defaulting to Z() when variable-width.
Returns true when pattern contains any atomic group or possessive quantifier.
Returns true when pattern contains any capturing group.
Returns true when pattern contains nested conditional subpatterns inside its branches.
Returns true when pattern contains any lookahead or lookbehind assertion.
Computes the shared exact width of a list of alternative patterns, or None() if widths differ or vary.
Returns true when any pattern in patterns contains an atomic group.
Returns true when any pattern in patterns contains a capturing group.
Returns true when any pattern in patterns satisfies literal_pattern_has_conditionals.
Returns true when any pattern in patterns contains a lookaround assertion.
Returns true when an optional pattern is present and contains an atomic group.
Returns true when an optional pattern is present and contains a capturing group.
Returns true when an optional pattern is present and satisfies literal_pattern_has_conditionals.
Returns true when an optional pattern is present and contains a lookaround assertion.
Unwraps a top-level LiteralConfigured newline policy into options, returning the inner pattern and effective options.
Verifies that every remaining pattern in patterns has exact width equal to expected.
Returns the smaller of maximum and the length of input.
Estimates the diagnostic span width of a \p{...} or \P{...} Unicode property escape.
Returns the maximum allowed repeat count (64) for bounded quantifiers {n,m}.
Estimates the diagnostic span width of a \x.. or \x{...} scalar escape.
Drops the first count entries from a source-position table.
Maps a prepared-pattern offset start and width back to a LiteralSourceSpan in the original source.
Advances across remaining source positions to find the exclusive end offset of a span.
Computes the starting offset of suffix within input.
Maps a Unicode general-category short or long name to its LiteralUnicodeProperty.
Validates a numeric code point as a Unicode scalar value and wraps it into LiteralScalarParse.
Returns true when value is CaselessModifier.
Returns true when value is DotallModifier.
Returns true when value is ExportModifier.
Returns true when value is ExtendedModifier.
Returns true when value is FirstlineModifier.
Returns true when value is MultilineModifier.
Returns true when value is UngreedyModifier.
Returns true when value is UnicodeModifier.
Returns an empty LiteralClassKinds containing no shorthand classes, Unicode properties, or POSIX classes.
Recursive descent crosses several grammar layers for one consumed source character. A fixed allowance per character keeps the proof structural while leaving enough room for nested groups and empty alternatives.
Parses either a braced \x{...} or fixed two-digit \xHH hexadecimal scalar escape.
Parses a braced Unicode property escape {Property} following \p or \P.
Reads the property name up to } inside \p{...} or \P{...} and looks up the corresponding property.
Prepends head before rest as a LiteralSequence.
Filters out all occurrences of wanted from a modifier list.
Resolves a single LiteralCaptureReference against layout, turning named references into slot references.
Resolves capture references across a list of branch-reset arm patterns.
Resolves named capture references inside pattern to numeric slot references using layout.
Resolves capture references inside a single child pattern and rebuilds the parent node with wrap.
Reverses a list of characters.
Tail-recursively reverses values onto the accumulator output.
Reverses a list of LiteralPattern nodes.
Reverses a list of LiteralCharacterRange values.
Tail-recursively reverses values onto the character-range accumulator output.
Returns true when two optional capture group names are both None() or contain equal strings.
Returns true when two LiteralClassKind values denote the same shorthand class.
Returns true when two Peano Nat values are structurally equal.
Returns true when two LiteralModifier values represent the same flag.
Returns options updated with a new LiteralNewlinePolicy.
Validates lookaround rules across every pattern in patterns.
Capture slots are carried by the lookaround compilation sidecar and replayed only after a checked child path wins. They therefore no longer need to be rejected at syntax admission; the ordinary typed shape still remains capture-independent.
Validates lookaround rules for an optional pattern branch.
Lookaround is deliberately checked before emission. Nested assertions and atomic scopes are admitted up to a finite structural depth. Capture slots are preserved by the runtime sidecar while typed literals erase that metadata from their result shape. The same bound is consumed by the runtime child evaluator, so an accepted syntax tree can never ask the evaluator to recurse beyond its certified fuel.
Validates lookaround nesting depth and fixed-width lookbehind bounds within pattern using remaining depth.
Walks two child patterns left-to-right during capture allocation and rebuilds the parent node with wrap.
A branch-reset arm starts at the same slot and name scope. Each arm must allocate the same number of compatible slots; the normalized result keeps the ordinary alternation language while the first arm's joined layout is reused for every arm.
Walks the remaining arms of a branch-reset group, verifying each arm's capture layout matches the first arm.
Walks pattern in source order, indexing captures from next and rejecting duplicate names or mismatched branch layouts.
Walks a single child pattern during capture allocation and rebuilds the parent node with wrap.
Types
enum LiteralAssertionPolarity
LiteralAssertionPositive
LiteralAssertionNegative
enum LiteralCaptureAllocation
LiteralCaptureAllocated
LiteralCaptureAllocationInvalid
enum LiteralCaptureLayout
LiteralCaptureLayout
type LiteralCaptureLayoutDecision indices (left: List(LiteralCaptureSlotInfo), right: List(LiteralCaptureSlotInfo))
LiteralCaptureLayoutsCompatible : LiteralCaptureLayoutDecision(left, right)
LiteralCaptureLayoutsIncompatible : LiteralCaptureLayoutDecision(left, right)
Capture-layout validation is a checked decision, not a Boolean side condition. The compatible branch is the certificate consumed by the branch-reset and conditional walkers; the incompatible branch is the only route to their structured diagnostics. Keeping this distinction in an indexed data type prevents a caller from accidentally treating a failed comparison as a valid layout.
enum LiteralCaptureReference
LiteralCaptureSlotReference
LiteralCaptureNameReference
enum LiteralCaptureSlotInfo
LiteralCaptureSlotInfo
Capture slots are allocated once, immediately after parsing. The slot number is stable metadata used by the named-capture side channel; it is deliberately absent from ShapeCode and therefore cannot perturb the existing typed result.
enum LiteralCaptureWalk
LiteralCaptureWalked
LiteralCaptureWalkInvalid
enum LiteralCharacterRange
LiteralCharacterRange
enum LiteralClassKind
DigitKind
NotDigitKind
WordKind
NotWordKind
SpaceKind
NotSpaceKind
HorizontalKind
NotHorizontalKind
VerticalKind
NotVerticalKind
enum LiteralClassKinds
LiteralClassKinds
enum LiteralClassParse
LiteralClassParsed
LiteralClassInvalid
LiteralClassAtInvalid
enum LiteralCountParse
LiteralCountParsed
LiteralCountInvalid
enum LiteralFlags
LiteralFlagsParsed
LiteralFlagsInvalid
enum LiteralLookaroundValidation
LiteralLookaroundValid
LiteralLookaroundInvalid
enum LiteralModifier
CaselessModifier
MultilineModifier
DotallModifier
ExtendedModifier
UnicodeModifier
FirstlineModifier
UngreedyModifier
ExportModifier
enum LiteralNewlinePolicy
LiteralLFPolicy
LiteralCRPolicy
LiteralCRLFPolicy
LiteralAnyCRLFPolicy
LiteralAnyUnicodePolicy
enum LiteralParse
LiteralParsed
LiteralInvalid
LiteralAtInvalid
LiteralLocatedInvalid
enum LiteralPattern
LiteralEmpty
LiteralExact
LiteralAny
LiteralClass
LiteralProperty
LiteralDigit
LiteralWord
LiteralSpace
LiteralHorizontal
LiteralVertical
LiteralLineBreak
LiteralSequence
LiteralAlternate
LiteralBranchReset
LiteralConditional
LiteralAtomic
LiteralLookahead
LiteralLookbehind
LiteralRepeat
LiteralPlus
LiteralOptional
LiteralBoundedExact
LiteralBoundedAtLeast
LiteralBoundedBetween
LiteralCapture
LiteralNamedCapture
LiteralCaptureIndexed
LiteralStart
LiteralEnd
LiteralAbsoluteStart
LiteralStrictEnd
LiteralFinalEnd
LiteralWordBoundary
LiteralConfigured
LiteralScopedOptions
A lexical atomic scope. The inner pattern keeps its ordinary typed result shape; commitment is carried by the compiled machine rather than by a second untyped matcher.
enum LiteralPatternOptions
LiteralPatternOptions
enum LiteralPosixClass
PosixAlnum
PosixAlpha
PosixAscii
PosixBlank
PosixCntrl
PosixDigit
PosixGraph
PosixLower
PosixPrint
PosixPunct
PosixSpace
PosixUpper
PosixWord
PosixXdigit
enum LiteralPosixClassMatch
LiteralPosixClassMatch
enum LiteralPosixParse
LiteralPosixParsed
LiteralPosixInvalid
enum LiteralPrepared
LiteralPrepared
enum LiteralPropertyParse
LiteralPropertyParsed
LiteralPropertyInvalid
enum LiteralReferenceLookup
LiteralReferenceResolved
LiteralReferenceInvalid
enum LiteralReferenceResolution
LiteralReferencesResolved
LiteralReferencesInvalid
enum LiteralRegexOptions
LiteralRegexOptions
enum LiteralScalarParse
LiteralScalarParsed
LiteralScalarInvalid
enum LiteralShapeCode
UnitC
CharC
StringC
BoolC
NatC
IntC
PairC
ChoiceC
OptionC
ListC
enum LiteralSourceMap
LiteralSourceMap
enum LiteralSourceSpan
LiteralSourceSpan
enum LiteralUnicodeProperty
PropertyAny
PropertyLetter
PropertyLowercaseLetter
PropertyUppercaseLetter
PropertyTitlecaseLetter
PropertyModifierLetter
PropertyOtherLetter
PropertyMark
PropertySpacingMark
PropertyEnclosingMark
PropertyNonspacingMark
PropertyNumber
PropertyDecimalNumber
PropertyLetterNumber
PropertyOtherNumber
PropertyPunctuation
PropertyConnectorPunctuation
PropertyDashPunctuation
PropertyClosePunctuation
PropertyFinalPunctuation
PropertyInitialPunctuation
PropertyOtherPunctuation
PropertyOpenPunctuation
PropertySymbol
PropertyCurrencySymbol
PropertyModifierSymbol
PropertyMathSymbol
PropertyOtherSymbol
PropertySeparator
PropertyLineSeparator
PropertyParagraphSeparator
PropertySpaceSeparator
PropertyOther
PropertyControl
PropertyFormat
PropertyUnassigned
PropertyPrivateUse
PropertySurrogate
enum LiteralUnicodePropertyMatch
LiteralUnicodePropertyMatch
enum LiteralWidth
LiteralWidthExact
LiteralWidthVariable
Functions
fn allocate_literal_captures(pattern: LiteralPattern) -> LiteralCaptureAllocation
Allocate every ordinary and named group in source order. Ordinary groups receive an unnamed slot as well: later branch-reset and participation phases can therefore reuse this layout without changing the parser again.
fn append_literal_capture_slots(left: List(LiteralCaptureSlotInfo), right: List(LiteralCaptureSlotInfo)) -> List(LiteralCaptureSlotInfo)
Appends two lists of LiteralCaptureSlotInfo descriptors.
fn append_literal_patterns(left: List(LiteralPattern), right: List(LiteralPattern)) -> List(LiteralPattern)
Appends two lists of LiteralPattern nodes.
fn apply_literal_scoped_disabled(disabled: List(LiteralModifier), options: LiteralRegexOptions) -> LiteralRegexOptions
Disables every modifier in disabled on options.
fn apply_literal_scoped_enabled(enabled: List(LiteralModifier), options: LiteralRegexOptions) -> LiteralRegexOptions
Enables every modifier in enabled on options.
fn apply_literal_scoped_options(enabled: List(LiteralModifier), disabled: List(LiteralModifier), options: LiteralRegexOptions) -> LiteralRegexOptions
Applies a scoped inline option change by first disabling disabled modifiers and then enabling enabled.
fn capture_name_chars_same(left: List(Char), right: List(Char)) -> Bool
Returns true when two character lists are equal element-by-element.
fn capture_name_seen(name: String, names: List(String)) -> Bool
Returns true when name is already present in names.
fn capture_names_same(left: String, right: String) -> Bool
Returns true when two capture group names have identical character sequences.
fn class_kind_is_digit(value: LiteralClassKind) -> Bool
Returns true when value is DigitKind.
fn class_kind_is_horizontal(value: LiteralClassKind) -> Bool
Returns true when value is HorizontalKind.
fn class_kind_is_not_digit(value: LiteralClassKind) -> Bool
Returns true when value is NotDigitKind.
fn class_kind_is_not_horizontal(value: LiteralClassKind) -> Bool
Returns true when value is NotHorizontalKind.
fn class_kind_is_not_space(value: LiteralClassKind) -> Bool
Returns true when value is NotSpaceKind.
fn class_kind_is_not_vertical(value: LiteralClassKind) -> Bool
Returns true when value is NotVerticalKind.
fn class_kind_is_not_word(value: LiteralClassKind) -> Bool
Returns true when value is NotWordKind.
fn class_kind_is_space(value: LiteralClassKind) -> Bool
Returns true when value is SpaceKind.
fn class_kind_is_vertical(value: LiteralClassKind) -> Bool
Returns true when value is VerticalKind.
fn class_kind_is_word(value: LiteralClassKind) -> Bool
Returns true when value is WordKind.
fn disable_modifier(modifier: LiteralModifier, options: LiteralRegexOptions) -> LiteralRegexOptions
Removes all occurrences of modifier from options.
fn empty_regex_input() -> List(Char)
Returns an empty regex input character list.
fn enable_class_kind(kind: LiteralClassKind, kinds: LiteralClassKinds) -> LiteralClassKinds
Adds a shorthand character class kind to kinds.
fn enable_modifier(modifier: LiteralModifier, options: LiteralRegexOptions) -> LiteralRegexOptions
Adds modifier to the enabled modifier list in options.
fn enable_posix_class(posix_class: LiteralPosixClass, negated: Bool, kinds: LiteralClassKinds) -> LiteralClassKinds
Adds a POSIX character class matcher (optionally negated) to kinds.
fn enable_unicode_property(property: LiteralUnicodeProperty, negated: Bool, kinds: LiteralClassKinds) -> LiteralClassKinds
Adds a Unicode property matcher (optionally negated) to kinds.
fn has_class_kind(kinds: LiteralClassKinds, wanted: LiteralClassKind) -> Bool
Returns true when kinds contains the shorthand class wanted.
fn has_class_kind_in(values: List(LiteralClassKind), wanted: LiteralClassKind) -> Bool
Returns true when wanted appears in the shorthand class list values.
fn has_modifier(options: LiteralRegexOptions, wanted: LiteralModifier) -> Bool
Returns true when wanted is enabled in options.
fn has_modifier_in(values: List(LiteralModifier), wanted: LiteralModifier) -> Bool
Returns true when wanted appears in the modifier list values.
fn is_literal_stop(char: Char) -> Bool
Returns true when char terminates a sequence (| or )).
fn literal_alternate_list(arms: List(LiteralPattern)) -> LiteralPattern
Folds a list of alternative patterns left-associatively into nested LiteralAlternate nodes.
fn literal_alternate_list_tail(left: LiteralPattern, rest: List(LiteralPattern)) -> LiteralPattern
Left-folds remaining alternation arms onto left.
fn literal_bounded_less(n: Nat, left: Bounded(n), right: Bounded(n)) -> Bool
Returns true when left is strictly less than right as Bounded(n) indices.
fn literal_braced_hex_escape(input: List(Char), value: Int, digits: Nat) -> LiteralScalarParse
Parses the hexadecimal digits of a braced escape \x{H...} up to }.
fn literal_branch_reset_alternate(arms: List(LiteralPattern)) -> LiteralPattern
Lowers branch-reset arms into a left-associative alternation pattern.
fn literal_capture_layout_decision(left: List(LiteralCaptureSlotInfo), right: List(LiteralCaptureSlotInfo)) -> LiteralCaptureLayoutDecision(left, right)
A total, constructor-level decision for the slot ledger. Unlike the legacy Boolean helper below, callers must inspect the compatible branch before they can proceed with a normalized layout.
fn literal_capture_layout_has_names(layout: LiteralCaptureLayout) -> Bool
Returns true when layout contains at least one named capture slot.
fn literal_capture_slot_by_name(name: String, layout: LiteralCaptureLayout) -> Option(Nat)
Looks up the 0-based capture slot index for name in layout.
fn literal_capture_slot_by_name_in(name: String, slots: List(LiteralCaptureSlotInfo)) -> Option(Nat)
Searches a slot descriptor list for the first slot matching name.
fn literal_capture_slots_have_names(slots: List(LiteralCaptureSlotInfo)) -> Bool
Returns true when any descriptor in slots carries a capture name.
fn literal_class_posix(kinds: LiteralClassKinds) -> List(LiteralPosixClassMatch)
Returns the POSIX class matchers stored in kinds.
fn literal_class_properties(kinds: LiteralClassKinds) -> List(LiteralUnicodePropertyMatch)
Returns the Unicode property matchers stored in kinds.
fn literal_decimal_digit(char: Char) -> Option(Nat)
Converts an ASCII decimal digit character '0'..'9' to its Nat value.
fn literal_decimal_prefix_width(input: List(Char)) -> Nat
Counts leading ASCII decimal digits in input.
fn literal_default_options() -> LiteralRegexOptions
Returns the default LiteralRegexOptions with no modifiers and LiteralAnyUnicodePolicy.
fn literal_delimited_width(input: List(Char), closing: Char) -> Nat
Measures the character width from the start of input through the first occurrence of closing (or end of input).
fn literal_fixed_hex_escape(input: List(Char)) -> LiteralScalarParse
Parses a two-digit hexadecimal escape \xHH into a Unicode scalar.
fn literal_fuel(input: List(Char)) -> Nat
Computes the structural recursion fuel budget for parsing input.
fn literal_length(input: List(Char)) -> Nat
Returns the length of a character list as a Nat.
fn literal_lookaround_limit() -> Nat
This bound is shared with the runtime assertion evaluator. It is large enough for useful composition while keeping staged proof terms finite and predictable under hostile literals.
fn literal_lookbehind_limit() -> Nat
Returns the maximum allowed fixed character width (8) for a lookbehind assertion.
fn literal_nat_add(left: Nat, right: Nat) -> Nat
Adds two Peano Nat values structurally.
fn literal_nat_less(left: Nat, right: Nat) -> Bool
Returns true when left is strictly less than right as Peano Nat values.
fn literal_nat_minus(left: Nat, right: Nat) -> Nat
Computes truncating subtraction (max(0, left - right)) on Peano Nat values.
fn literal_nat_multiply(left: Nat, right: Nat) -> Nat
Multiplies two Peano Nat values structurally.
fn literal_nat_predecessor(value: Nat) -> Option(Nat)
Returns the predecessor of a positive Nat, or None() for Z().
fn literal_nat_times_ten(value: Nat) -> Nat
Multiplies a Nat by 10 using repeated addition.
fn literal_newline_policy(options: LiteralRegexOptions) -> LiteralNewlinePolicy
Extracts the active LiteralNewlinePolicy from options.
fn literal_numeric_escape_width(input: List(Char)) -> Nat
Estimates the diagnostic span width of a numeric escape such as \1.
fn literal_pattern_exact_width(pattern: LiteralPattern) -> Option(Nat)
Computes the exact character width of pattern, or None() when the pattern has variable width.
fn literal_pattern_exact_width_value(pattern: LiteralPattern) -> Nat
Returns the exact width of pattern as a Nat, defaulting to Z() when variable-width.
fn literal_pattern_has_atomic(pattern: LiteralPattern) -> Bool
Returns true when pattern contains any atomic group or possessive quantifier.
fn literal_pattern_has_capture(pattern: LiteralPattern) -> Bool
Returns true when pattern contains any capturing group.
fn literal_pattern_has_conditionals(pattern: LiteralPattern) -> Bool
Returns true when pattern contains nested conditional subpatterns inside its branches.
fn literal_pattern_has_lookaround(pattern: LiteralPattern) -> Bool
Returns true when pattern contains any lookahead or lookbehind assertion.
fn literal_pattern_list_exact_width(patterns: List(LiteralPattern)) -> Option(Nat)
Computes the shared exact width of a list of alternative patterns, or None() if widths differ or vary.
fn literal_pattern_list_has_atomic(patterns: List(LiteralPattern)) -> Bool
Returns true when any pattern in patterns contains an atomic group.
fn literal_pattern_list_has_capture(patterns: List(LiteralPattern)) -> Bool
Returns true when any pattern in patterns contains a capturing group.
fn literal_pattern_list_has_conditionals(patterns: List(LiteralPattern)) -> Bool
Returns true when any pattern in patterns satisfies literal_pattern_has_conditionals.
fn literal_pattern_list_has_lookaround(patterns: List(LiteralPattern)) -> Bool
Returns true when any pattern in patterns contains a lookaround assertion.
fn literal_pattern_option_has_atomic(pattern: Option(LiteralPattern)) -> Bool
Returns true when an optional pattern is present and contains an atomic group.
fn literal_pattern_option_has_capture(pattern: Option(LiteralPattern)) -> Bool
Returns true when an optional pattern is present and contains a capturing group.
fn literal_pattern_option_has_conditionals(pattern: Option(LiteralPattern)) -> Bool
Returns true when an optional pattern is present and satisfies literal_pattern_has_conditionals.
fn literal_pattern_option_has_lookaround(pattern: Option(LiteralPattern)) -> Bool
Returns true when an optional pattern is present and contains a lookaround assertion.
fn literal_pattern_options(pattern: LiteralPattern, options: LiteralRegexOptions) -> LiteralPatternOptions
Unwraps a top-level LiteralConfigured newline policy into options, returning the inner pattern and effective options.
fn literal_pattern_tail_exact_width(patterns: List(LiteralPattern), expected: Nat) -> Option(Nat)
Verifies that every remaining pattern in patterns has exact width equal to expected.
fn literal_prefix_width(input: List(Char), maximum: Nat) -> Nat
Returns the smaller of maximum and the length of input.
fn literal_property_escape_width(input: List(Char)) -> Nat
Estimates the diagnostic span width of a \p{...} or \P{...} Unicode property escape.
fn literal_quantifier_limit() -> Nat
Returns the maximum allowed repeat count (64) for bounded quantifiers {n,m}.
fn literal_scalar_escape_width(input: List(Char)) -> Nat
Estimates the diagnostic span width of a \x.. or \x{...} scalar escape.
fn literal_source_positions_after(positions: List(Nat), count: Nat) -> List(Nat)
Drops the first count entries from a source-position table.
fn literal_source_span(positions: List(Nat), source_length: Nat, start: Nat, width: Nat) -> LiteralSourceSpan
Maps a prepared-pattern offset start and width back to a LiteralSourceSpan in the original source.
fn literal_source_span_end(positions: List(Nat), remaining: Nat, current_end: Nat) -> Nat
Advances across remaining source positions to find the exclusive end offset of a span.
fn literal_suffix_offset(input: List(Char), suffix: List(Char)) -> Nat
Computes the starting offset of suffix within input.
fn literal_unicode_property_named(name: List(Char)) -> Option(LiteralUnicodeProperty)
Maps a Unicode general-category short or long name to its LiteralUnicodeProperty.
fn literal_unicode_scalar(value: Int, rest: List(Char)) -> LiteralScalarParse
Validates a numeric code point as a Unicode scalar value and wraps it into LiteralScalarParse.
fn modifier_is_caseless(value: LiteralModifier) -> Bool
Returns true when value is CaselessModifier.
fn modifier_is_dotall(value: LiteralModifier) -> Bool
Returns true when value is DotallModifier.
fn modifier_is_export(value: LiteralModifier) -> Bool
Returns true when value is ExportModifier.
fn modifier_is_extended(value: LiteralModifier) -> Bool
Returns true when value is ExtendedModifier.
fn modifier_is_firstline(value: LiteralModifier) -> Bool
Returns true when value is FirstlineModifier.
fn modifier_is_multiline(value: LiteralModifier) -> Bool
Returns true when value is MultilineModifier.
fn modifier_is_ungreedy(value: LiteralModifier) -> Bool
Returns true when value is UngreedyModifier.
fn modifier_is_unicode(value: LiteralModifier) -> Bool
Returns true when value is UnicodeModifier.
fn no_class_kinds() -> LiteralClassKinds
Returns an empty LiteralClassKinds containing no shorthand classes, Unicode properties, or POSIX classes.
fn parse_fuel_step(fuel: Nat) -> Nat
Recursive descent crosses several grammar layers for one consumed source character. A fixed allowance per character keeps the proof structural while leaving enough room for nested groups and empty alternatives.
fn parse_literal_hex_scalar(input: List(Char)) -> LiteralScalarParse
Parses either a braced \x{...} or fixed two-digit \xHH hexadecimal scalar escape.
fn parse_literal_unicode_property(input: List(Char)) -> LiteralPropertyParse
Parses a braced Unicode property escape {Property} following \p or \P.
fn parse_literal_unicode_property_name(input: List(Char), reversed: List(Char)) -> LiteralPropertyParse
Reads the property name up to } inside \p{...} or \P{...} and looks up the corresponding property.
fn prepend_literal_pattern(head: LiteralPattern, rest: LiteralPattern) -> LiteralPattern
Prepends head before rest as a LiteralSequence.
fn remove_modifier(values: List(LiteralModifier), wanted: LiteralModifier) -> List(LiteralModifier)
Filters out all occurrences of wanted from a modifier list.
fn resolve_literal_capture_reference(reference: LiteralCaptureReference, layout: LiteralCaptureLayout) -> LiteralReferenceLookup
Resolves a single LiteralCaptureReference against layout, turning named references into slot references.
fn resolve_literal_capture_reference_arms(arms: List(LiteralPattern), layout: LiteralCaptureLayout) -> LiteralReferenceResolution
Resolves capture references across a list of branch-reset arm patterns.
fn resolve_literal_capture_references(pattern: LiteralPattern, layout: LiteralCaptureLayout, _next: Nat) -> LiteralReferenceResolution
Resolves named capture references inside pattern to numeric slot references using layout.
fn resolve_literal_reference_unary(wrap: Function(LiteralPattern, LiteralPattern), inner: LiteralPattern, layout: LiteralCaptureLayout, next: Nat) -> LiteralReferenceResolution
Resolves capture references inside a single child pattern and rebuilds the parent node with wrap.
fn reverse_chars(values: List(Char)) -> List(Char)
Reverses a list of characters.
fn reverse_chars_into(values: List(Char), output: List(Char)) -> List(Char)
Tail-recursively reverses values onto the accumulator output.
fn reverse_literal_patterns(values: List(LiteralPattern)) -> List(LiteralPattern)
Reverses a list of LiteralPattern nodes.
fn reverse_ranges(values: List(LiteralCharacterRange)) -> List(LiteralCharacterRange)
Reverses a list of LiteralCharacterRange values.
fn reverse_ranges_into(values: List(LiteralCharacterRange), output: List(LiteralCharacterRange)) -> List(LiteralCharacterRange)
Tail-recursively reverses values onto the character-range accumulator output.
fn same_capture_name_option(left: Option(String), right: Option(String)) -> Bool
Returns true when two optional capture group names are both None() or contain equal strings.
fn same_class_kind(left: LiteralClassKind, right: LiteralClassKind) -> Bool
Returns true when two LiteralClassKind values denote the same shorthand class.
fn same_literal_nat(left: Nat, right: Nat) -> Bool
Returns true when two Peano Nat values are structurally equal.
fn same_modifier(left: LiteralModifier, right: LiteralModifier) -> Bool
Returns true when two LiteralModifier values represent the same flag.
fn set_literal_newline_policy(policy: LiteralNewlinePolicy, options: LiteralRegexOptions) -> LiteralRegexOptions
Returns options updated with a new LiteralNewlinePolicy.
fn validate_literal_lookaround_list(patterns: List(LiteralPattern), depth: Nat) -> LiteralLookaroundValidation
Validates lookaround rules across every pattern in patterns.
fn validate_literal_lookaround_operand(pattern: LiteralPattern, depth: Nat) -> LiteralLookaroundValidation
Capture slots are carried by the lookaround compilation sidecar and replayed only after a checked child path wins. They therefore no longer need to be rejected at syntax admission; the ordinary typed shape still remains capture-independent.
fn validate_literal_lookaround_option(pattern: Option(LiteralPattern), depth: Nat) -> LiteralLookaroundValidation
Validates lookaround rules for an optional pattern branch.
fn validate_literal_lookarounds(pattern: LiteralPattern) -> LiteralLookaroundValidation
Lookaround is deliberately checked before emission. Nested assertions and atomic scopes are admitted up to a finite structural depth. Capture slots are preserved by the runtime sidecar while typed literals erase that metadata from their result shape. The same bound is consumed by the runtime child evaluator, so an accepted syntax tree can never ask the evaluator to recurse beyond its certified fuel.
fn validate_literal_lookarounds_at(pattern: LiteralPattern, depth: Nat) -> LiteralLookaroundValidation
Validates lookaround nesting depth and fixed-width lookbehind bounds within pattern using remaining depth.
fn walk_literal_binary(wrap: Function(LiteralPattern, LiteralPattern, LiteralPattern), left: LiteralPattern, right: LiteralPattern, next: Nat, names: List(String)) -> LiteralCaptureWalk
Walks two child patterns left-to-right during capture allocation and rebuilds the parent node with wrap.
fn walk_literal_branch_reset(arms: List(LiteralPattern), next: Nat, names: List(String)) -> LiteralCaptureWalk
A branch-reset arm starts at the same slot and name scope. Each arm must allocate the same number of compatible slots; the normalized result keeps the ordinary alternation language while the first arm's joined layout is reused for every arm.
fn walk_literal_branch_reset_rest(arms: List(LiteralPattern), next: Nat, names: List(String), normalized_reverse: List(LiteralPattern), slots: List(LiteralCaptureSlotInfo), expected_next: Nat, final_names: List(String)) -> LiteralCaptureWalk
Walks the remaining arms of a branch-reset group, verifying each arm's capture layout matches the first arm.
fn walk_literal_captures(pattern: LiteralPattern, next: Nat, names: List(String)) -> LiteralCaptureWalk
Walks pattern in source order, indexing captures from next and rejecting duplicate names or mismatched branch layouts.
fn walk_literal_unary(wrap: Function(LiteralPattern, LiteralPattern), inner: LiteralPattern, next: Nat, names: List(String)) -> LiteralCaptureWalk
Walks a single child pattern during capture allocation and rebuilds the parent node with wrap.