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.

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.

Returns an empty regex input character list.

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.

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.

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.

Resolves a single LiteralCaptureReference against layout, turning named references into slot references.

Resolves named capture references inside pattern to numeric slot references using layout.

Reverses a list of characters.

Tail-recursively reverses values onto the 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.

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.

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.

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 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

 enum LiteralAssertionPolarity
   LiteralAssertionPositive
   LiteralAssertionNegative

enum LiteralCaptureAllocation

 enum LiteralCaptureAllocation
   LiteralCaptureAllocated
   LiteralCaptureAllocationInvalid

enum LiteralCaptureLayout

 enum LiteralCaptureLayout
   LiteralCaptureLayout

type LiteralCaptureLayoutDecision indices (left: List(LiteralCaptureSlotInfo), right: List(LiteralCaptureSlotInfo))

 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

 enum LiteralCaptureReference
   LiteralCaptureSlotReference
   LiteralCaptureNameReference

enum LiteralCaptureSlotInfo

 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

 enum LiteralCaptureWalk
   LiteralCaptureWalked
   LiteralCaptureWalkInvalid

enum LiteralCharacterRange

 enum LiteralCharacterRange
   LiteralCharacterRange

enum LiteralClassKind

 enum LiteralClassKind
   DigitKind
   NotDigitKind
   WordKind
   NotWordKind
   SpaceKind
   NotSpaceKind
   HorizontalKind
   NotHorizontalKind
   VerticalKind
   NotVerticalKind

enum LiteralClassKinds

 enum LiteralClassKinds
   LiteralClassKinds

enum LiteralClassParse

 enum LiteralClassParse
   LiteralClassParsed
   LiteralClassInvalid
   LiteralClassAtInvalid

enum LiteralCountParse

 enum LiteralCountParse
   LiteralCountParsed
   LiteralCountInvalid

enum LiteralFlags

 enum LiteralFlags
   LiteralFlagsParsed
   LiteralFlagsInvalid

enum LiteralLookaroundValidation

 enum LiteralLookaroundValidation
   LiteralLookaroundValid
   LiteralLookaroundInvalid

enum LiteralModifier

 enum LiteralModifier
   CaselessModifier
   MultilineModifier
   DotallModifier
   ExtendedModifier
   UnicodeModifier
   FirstlineModifier
   UngreedyModifier
   ExportModifier

enum LiteralNewlinePolicy

 enum LiteralNewlinePolicy
   LiteralLFPolicy
   LiteralCRPolicy
   LiteralCRLFPolicy
   LiteralAnyCRLFPolicy
   LiteralAnyUnicodePolicy

enum LiteralParse

 enum LiteralParse
   LiteralParsed
   LiteralInvalid
   LiteralAtInvalid
   LiteralLocatedInvalid

enum LiteralPattern

 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

 enum LiteralPatternOptions
   LiteralPatternOptions

enum LiteralPosixClass

 enum LiteralPosixClass
   PosixAlnum
   PosixAlpha
   PosixAscii
   PosixBlank
   PosixCntrl
   PosixDigit
   PosixGraph
   PosixLower
   PosixPrint
   PosixPunct
   PosixSpace
   PosixUpper
   PosixWord
   PosixXdigit

enum LiteralPosixClassMatch

 enum LiteralPosixClassMatch
   LiteralPosixClassMatch

enum LiteralPosixParse

 enum LiteralPosixParse
   LiteralPosixParsed
   LiteralPosixInvalid

enum LiteralPrepared

 enum LiteralPrepared
   LiteralPrepared

enum LiteralPropertyParse

 enum LiteralPropertyParse
   LiteralPropertyParsed
   LiteralPropertyInvalid

enum LiteralReferenceLookup

 enum LiteralReferenceLookup
   LiteralReferenceResolved
   LiteralReferenceInvalid

enum LiteralReferenceResolution

 enum LiteralReferenceResolution
   LiteralReferencesResolved
   LiteralReferencesInvalid

enum LiteralRegexOptions

 enum LiteralRegexOptions
   LiteralRegexOptions

enum LiteralScalarParse

 enum LiteralScalarParse
   LiteralScalarParsed
   LiteralScalarInvalid

enum LiteralShapeCode

 enum LiteralShapeCode
   UnitC
   CharC
   StringC
   BoolC
   NatC
   IntC
   PairC
   ChoiceC
   OptionC
   ListC

enum LiteralSourceMap

 enum LiteralSourceMap
   LiteralSourceMap

enum LiteralSourceSpan

 enum LiteralSourceSpan
   LiteralSourceSpan

enum LiteralUnicodeProperty

 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

 enum LiteralUnicodePropertyMatch
   LiteralUnicodePropertyMatch

enum LiteralWidth

 enum LiteralWidth
   LiteralWidthExact
   LiteralWidthVariable

Functions

allocate_literal_captures(pattern: LiteralPattern) -> LiteralCaptureAllocation

 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.

append_literal_capture_slots(left: List(LiteralCaptureSlotInfo), right: List(LiteralCaptureSlotInfo)) -> List(LiteralCaptureSlotInfo)

 fn append_literal_capture_slots(left: List(LiteralCaptureSlotInfo), right: List(LiteralCaptureSlotInfo)) -> List(LiteralCaptureSlotInfo)

Appends two lists of LiteralCaptureSlotInfo descriptors.

append_literal_patterns(left: List(LiteralPattern), right: List(LiteralPattern)) -> List(LiteralPattern)

 fn append_literal_patterns(left: List(LiteralPattern), right: List(LiteralPattern)) -> List(LiteralPattern)

Appends two lists of LiteralPattern nodes.

apply_literal_scoped_disabled(disabled: List(LiteralModifier), options: LiteralRegexOptions) -> LiteralRegexOptions

 fn apply_literal_scoped_disabled(disabled: List(LiteralModifier), options: LiteralRegexOptions) -> LiteralRegexOptions

Disables every modifier in disabled on options.

apply_literal_scoped_enabled(enabled: List(LiteralModifier), options: LiteralRegexOptions) -> LiteralRegexOptions

 fn apply_literal_scoped_enabled(enabled: List(LiteralModifier), options: LiteralRegexOptions) -> LiteralRegexOptions

Enables every modifier in enabled on options.

apply_literal_scoped_options(enabled: List(LiteralModifier), disabled: List(LiteralModifier), options: LiteralRegexOptions) -> LiteralRegexOptions

 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.

capture_name_chars_same(left: List(Char), right: List(Char)) -> Bool

 fn capture_name_chars_same(left: List(Char), right: List(Char)) -> Bool

Returns true when two character lists are equal element-by-element.

capture_name_seen(name: String, names: List(String)) -> Bool

 fn capture_name_seen(name: String, names: List(String)) -> Bool

Returns true when name is already present in names.

capture_names_same(left: String, right: String) -> Bool

 fn capture_names_same(left: String, right: String) -> Bool

Returns true when two capture group names have identical character sequences.

class_kind_is_digit(value: LiteralClassKind) -> Bool

 fn class_kind_is_digit(value: LiteralClassKind) -> Bool

Returns true when value is DigitKind.

class_kind_is_horizontal(value: LiteralClassKind) -> Bool

 fn class_kind_is_horizontal(value: LiteralClassKind) -> Bool

Returns true when value is HorizontalKind.

class_kind_is_not_digit(value: LiteralClassKind) -> Bool

 fn class_kind_is_not_digit(value: LiteralClassKind) -> Bool

Returns true when value is NotDigitKind.

class_kind_is_not_horizontal(value: LiteralClassKind) -> Bool

 fn class_kind_is_not_horizontal(value: LiteralClassKind) -> Bool

Returns true when value is NotHorizontalKind.

class_kind_is_not_space(value: LiteralClassKind) -> Bool

 fn class_kind_is_not_space(value: LiteralClassKind) -> Bool

Returns true when value is NotSpaceKind.

class_kind_is_not_vertical(value: LiteralClassKind) -> Bool

 fn class_kind_is_not_vertical(value: LiteralClassKind) -> Bool

Returns true when value is NotVerticalKind.

class_kind_is_not_word(value: LiteralClassKind) -> Bool

 fn class_kind_is_not_word(value: LiteralClassKind) -> Bool

Returns true when value is NotWordKind.

class_kind_is_space(value: LiteralClassKind) -> Bool

 fn class_kind_is_space(value: LiteralClassKind) -> Bool

Returns true when value is SpaceKind.

class_kind_is_vertical(value: LiteralClassKind) -> Bool

 fn class_kind_is_vertical(value: LiteralClassKind) -> Bool

Returns true when value is VerticalKind.

class_kind_is_word(value: LiteralClassKind) -> Bool

 fn class_kind_is_word(value: LiteralClassKind) -> Bool

Returns true when value is WordKind.

disable_modifier(modifier: LiteralModifier, options: LiteralRegexOptions) -> LiteralRegexOptions

 fn disable_modifier(modifier: LiteralModifier, options: LiteralRegexOptions) -> LiteralRegexOptions

Removes all occurrences of modifier from options.

empty_regex_input() -> List(Char)

 fn empty_regex_input() -> List(Char)

Returns an empty regex input character list.

enable_class_kind(kind: LiteralClassKind, kinds: LiteralClassKinds) -> LiteralClassKinds

 fn enable_class_kind(kind: LiteralClassKind, kinds: LiteralClassKinds) -> LiteralClassKinds

Adds a shorthand character class kind to kinds.

enable_modifier(modifier: LiteralModifier, options: LiteralRegexOptions) -> LiteralRegexOptions

 fn enable_modifier(modifier: LiteralModifier, options: LiteralRegexOptions) -> LiteralRegexOptions

Adds modifier to the enabled modifier list in options.

enable_posix_class(posix_class: LiteralPosixClass, negated: Bool, kinds: LiteralClassKinds) -> LiteralClassKinds

 fn enable_posix_class(posix_class: LiteralPosixClass, negated: Bool, kinds: LiteralClassKinds) -> LiteralClassKinds

Adds a POSIX character class matcher (optionally negated) to kinds.

enable_unicode_property(property: LiteralUnicodeProperty, negated: Bool, kinds: LiteralClassKinds) -> LiteralClassKinds

 fn enable_unicode_property(property: LiteralUnicodeProperty, negated: Bool, kinds: LiteralClassKinds) -> LiteralClassKinds

Adds a Unicode property matcher (optionally negated) to kinds.

has_class_kind(kinds: LiteralClassKinds, wanted: LiteralClassKind) -> Bool

 fn has_class_kind(kinds: LiteralClassKinds, wanted: LiteralClassKind) -> Bool

Returns true when kinds contains the shorthand class wanted.

has_class_kind_in(values: List(LiteralClassKind), wanted: LiteralClassKind) -> Bool

 fn has_class_kind_in(values: List(LiteralClassKind), wanted: LiteralClassKind) -> Bool

Returns true when wanted appears in the shorthand class list values.

has_modifier(options: LiteralRegexOptions, wanted: LiteralModifier) -> Bool

 fn has_modifier(options: LiteralRegexOptions, wanted: LiteralModifier) -> Bool

Returns true when wanted is enabled in options.

has_modifier_in(values: List(LiteralModifier), wanted: LiteralModifier) -> Bool

 fn has_modifier_in(values: List(LiteralModifier), wanted: LiteralModifier) -> Bool

Returns true when wanted appears in the modifier list values.

is_literal_stop(char: Char) -> Bool

 fn is_literal_stop(char: Char) -> Bool

Returns true when char terminates a sequence (| or )).

literal_alternate_list(arms: List(LiteralPattern)) -> LiteralPattern

 fn literal_alternate_list(arms: List(LiteralPattern)) -> LiteralPattern

Folds a list of alternative patterns left-associatively into nested LiteralAlternate nodes.

literal_alternate_list_tail(left: LiteralPattern, rest: List(LiteralPattern)) -> LiteralPattern

 fn literal_alternate_list_tail(left: LiteralPattern, rest: List(LiteralPattern)) -> LiteralPattern

Left-folds remaining alternation arms onto left.

literal_bounded_less(n: Nat, left: Bounded(n), right: Bounded(n)) -> Bool

 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.

literal_braced_hex_escape(input: List(Char), value: Int, digits: Nat) -> LiteralScalarParse

 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 }.

literal_branch_reset_alternate(arms: List(LiteralPattern)) -> LiteralPattern

 fn literal_branch_reset_alternate(arms: List(LiteralPattern)) -> LiteralPattern

Lowers branch-reset arms into a left-associative alternation pattern.

literal_capture_layout_decision(left: List(LiteralCaptureSlotInfo), right: List(LiteralCaptureSlotInfo)) -> LiteralCaptureLayoutDecision(left, right)

 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.

literal_capture_layout_has_names(layout: LiteralCaptureLayout) -> Bool

 fn literal_capture_layout_has_names(layout: LiteralCaptureLayout) -> Bool

Returns true when layout contains at least one named capture slot.

literal_capture_slot_by_name(name: String, layout: LiteralCaptureLayout) -> Option(Nat)

 fn literal_capture_slot_by_name(name: String, layout: LiteralCaptureLayout) -> Option(Nat)

Looks up the 0-based capture slot index for name in layout.

literal_capture_slot_by_name_in(name: String, slots: List(LiteralCaptureSlotInfo)) -> Option(Nat)

 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.

literal_capture_slots_have_names(slots: List(LiteralCaptureSlotInfo)) -> Bool

 fn literal_capture_slots_have_names(slots: List(LiteralCaptureSlotInfo)) -> Bool

Returns true when any descriptor in slots carries a capture name.

literal_class_posix(kinds: LiteralClassKinds) -> List(LiteralPosixClassMatch)

 fn literal_class_posix(kinds: LiteralClassKinds) -> List(LiteralPosixClassMatch)

Returns the POSIX class matchers stored in kinds.

literal_class_properties(kinds: LiteralClassKinds) -> List(LiteralUnicodePropertyMatch)

 fn literal_class_properties(kinds: LiteralClassKinds) -> List(LiteralUnicodePropertyMatch)

Returns the Unicode property matchers stored in kinds.

literal_decimal_digit(char: Char) -> Option(Nat)

 fn literal_decimal_digit(char: Char) -> Option(Nat)

Converts an ASCII decimal digit character '0'..'9' to its Nat value.

literal_decimal_prefix_width(input: List(Char)) -> Nat

 fn literal_decimal_prefix_width(input: List(Char)) -> Nat

Counts leading ASCII decimal digits in input.

literal_default_options() -> LiteralRegexOptions

 fn literal_default_options() -> LiteralRegexOptions

Returns the default LiteralRegexOptions with no modifiers and LiteralAnyUnicodePolicy.

literal_delimited_width(input: List(Char), closing: Char) -> Nat

 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).

literal_fixed_hex_escape(input: List(Char)) -> LiteralScalarParse

 fn literal_fixed_hex_escape(input: List(Char)) -> LiteralScalarParse

Parses a two-digit hexadecimal escape \xHH into a Unicode scalar.

literal_fuel(input: List(Char)) -> Nat

 fn literal_fuel(input: List(Char)) -> Nat

Computes the structural recursion fuel budget for parsing input.

literal_length(input: List(Char)) -> Nat

 fn literal_length(input: List(Char)) -> Nat

Returns the length of a character list as a Nat.

literal_lookaround_limit() -> 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.

literal_lookbehind_limit() -> Nat

 fn literal_lookbehind_limit() -> Nat

Returns the maximum allowed fixed character width (8) for a lookbehind assertion.

literal_nat_add(left: Nat, right: Nat) -> Nat

 fn literal_nat_add(left: Nat, right: Nat) -> Nat

Adds two Peano Nat values structurally.

literal_nat_less(left: Nat, right: Nat) -> Bool

 fn literal_nat_less(left: Nat, right: Nat) -> Bool

Returns true when left is strictly less than right as Peano Nat values.

literal_nat_minus(left: Nat, right: Nat) -> Nat

 fn literal_nat_minus(left: Nat, right: Nat) -> Nat

Computes truncating subtraction (max(0, left - right)) on Peano Nat values.

literal_nat_multiply(left: Nat, right: Nat) -> Nat

 fn literal_nat_multiply(left: Nat, right: Nat) -> Nat

Multiplies two Peano Nat values structurally.

literal_nat_predecessor(value: Nat) -> Option(Nat)

 fn literal_nat_predecessor(value: Nat) -> Option(Nat)

Returns the predecessor of a positive Nat, or None() for Z().

literal_nat_times_ten(value: Nat) -> Nat

 fn literal_nat_times_ten(value: Nat) -> Nat

Multiplies a Nat by 10 using repeated addition.

literal_newline_policy(options: LiteralRegexOptions) -> LiteralNewlinePolicy

 fn literal_newline_policy(options: LiteralRegexOptions) -> LiteralNewlinePolicy

Extracts the active LiteralNewlinePolicy from options.

literal_numeric_escape_width(input: List(Char)) -> Nat

 fn literal_numeric_escape_width(input: List(Char)) -> Nat

Estimates the diagnostic span width of a numeric escape such as \1.

literal_pattern_exact_width(pattern: LiteralPattern) -> Option(Nat)

 fn literal_pattern_exact_width(pattern: LiteralPattern) -> Option(Nat)

Computes the exact character width of pattern, or None() when the pattern has variable width.

literal_pattern_exact_width_value(pattern: LiteralPattern) -> Nat

 fn literal_pattern_exact_width_value(pattern: LiteralPattern) -> Nat

Returns the exact width of pattern as a Nat, defaulting to Z() when variable-width.

literal_pattern_has_atomic(pattern: LiteralPattern) -> Bool

 fn literal_pattern_has_atomic(pattern: LiteralPattern) -> Bool

Returns true when pattern contains any atomic group or possessive quantifier.

literal_pattern_has_capture(pattern: LiteralPattern) -> Bool

 fn literal_pattern_has_capture(pattern: LiteralPattern) -> Bool

Returns true when pattern contains any capturing group.

literal_pattern_has_conditionals(pattern: LiteralPattern) -> Bool

 fn literal_pattern_has_conditionals(pattern: LiteralPattern) -> Bool

Returns true when pattern contains nested conditional subpatterns inside its branches.

literal_pattern_has_lookaround(pattern: LiteralPattern) -> Bool

 fn literal_pattern_has_lookaround(pattern: LiteralPattern) -> Bool

Returns true when pattern contains any lookahead or lookbehind assertion.

literal_pattern_list_exact_width(patterns: List(LiteralPattern)) -> Option(Nat)

 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.

literal_pattern_list_has_atomic(patterns: List(LiteralPattern)) -> Bool

 fn literal_pattern_list_has_atomic(patterns: List(LiteralPattern)) -> Bool

Returns true when any pattern in patterns contains an atomic group.

literal_pattern_list_has_capture(patterns: List(LiteralPattern)) -> Bool

 fn literal_pattern_list_has_capture(patterns: List(LiteralPattern)) -> Bool

Returns true when any pattern in patterns contains a capturing group.

literal_pattern_list_has_conditionals(patterns: List(LiteralPattern)) -> Bool

 fn literal_pattern_list_has_conditionals(patterns: List(LiteralPattern)) -> Bool

Returns true when any pattern in patterns satisfies literal_pattern_has_conditionals.

literal_pattern_list_has_lookaround(patterns: List(LiteralPattern)) -> Bool

 fn literal_pattern_list_has_lookaround(patterns: List(LiteralPattern)) -> Bool

Returns true when any pattern in patterns contains a lookaround assertion.

literal_pattern_option_has_atomic(pattern: Option(LiteralPattern)) -> Bool

 fn literal_pattern_option_has_atomic(pattern: Option(LiteralPattern)) -> Bool

Returns true when an optional pattern is present and contains an atomic group.

literal_pattern_option_has_capture(pattern: Option(LiteralPattern)) -> Bool

 fn literal_pattern_option_has_capture(pattern: Option(LiteralPattern)) -> Bool

Returns true when an optional pattern is present and contains a capturing group.

literal_pattern_option_has_conditionals(pattern: Option(LiteralPattern)) -> Bool

 fn literal_pattern_option_has_conditionals(pattern: Option(LiteralPattern)) -> Bool

Returns true when an optional pattern is present and satisfies literal_pattern_has_conditionals.

literal_pattern_option_has_lookaround(pattern: Option(LiteralPattern)) -> Bool

 fn literal_pattern_option_has_lookaround(pattern: Option(LiteralPattern)) -> Bool

Returns true when an optional pattern is present and contains a lookaround assertion.

literal_pattern_options(pattern: LiteralPattern, options: LiteralRegexOptions) -> LiteralPatternOptions

 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.

literal_pattern_tail_exact_width(patterns: List(LiteralPattern), expected: Nat) -> Option(Nat)

 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.

literal_prefix_width(input: List(Char), maximum: Nat) -> Nat

 fn literal_prefix_width(input: List(Char), maximum: Nat) -> Nat

Returns the smaller of maximum and the length of input.

literal_property_escape_width(input: List(Char)) -> Nat

 fn literal_property_escape_width(input: List(Char)) -> Nat

Estimates the diagnostic span width of a \p{...} or \P{...} Unicode property escape.

literal_quantifier_limit() -> Nat

 fn literal_quantifier_limit() -> Nat

Returns the maximum allowed repeat count (64) for bounded quantifiers {n,m}.

literal_scalar_escape_width(input: List(Char)) -> Nat

 fn literal_scalar_escape_width(input: List(Char)) -> Nat

Estimates the diagnostic span width of a \x.. or \x{...} scalar escape.

literal_source_positions_after(positions: List(Nat), count: Nat) -> List(Nat)

 fn literal_source_positions_after(positions: List(Nat), count: Nat) -> List(Nat)

Drops the first count entries from a source-position table.

literal_source_span(positions: List(Nat), source_length: Nat, start: Nat, width: Nat) -> LiteralSourceSpan

 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.

literal_source_span_end(positions: List(Nat), remaining: Nat, current_end: Nat) -> Nat

 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.

literal_suffix_offset(input: List(Char), suffix: List(Char)) -> Nat

 fn literal_suffix_offset(input: List(Char), suffix: List(Char)) -> Nat

Computes the starting offset of suffix within input.

literal_unicode_property_named(name: List(Char)) -> Option(LiteralUnicodeProperty)

 fn literal_unicode_property_named(name: List(Char)) -> Option(LiteralUnicodeProperty)

Maps a Unicode general-category short or long name to its LiteralUnicodeProperty.

literal_unicode_scalar(value: Int, rest: List(Char)) -> LiteralScalarParse

 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.

modifier_is_caseless(value: LiteralModifier) -> Bool

 fn modifier_is_caseless(value: LiteralModifier) -> Bool

Returns true when value is CaselessModifier.

modifier_is_dotall(value: LiteralModifier) -> Bool

 fn modifier_is_dotall(value: LiteralModifier) -> Bool

Returns true when value is DotallModifier.

modifier_is_export(value: LiteralModifier) -> Bool

 fn modifier_is_export(value: LiteralModifier) -> Bool

Returns true when value is ExportModifier.

modifier_is_extended(value: LiteralModifier) -> Bool

 fn modifier_is_extended(value: LiteralModifier) -> Bool

Returns true when value is ExtendedModifier.

modifier_is_firstline(value: LiteralModifier) -> Bool

 fn modifier_is_firstline(value: LiteralModifier) -> Bool

Returns true when value is FirstlineModifier.

modifier_is_multiline(value: LiteralModifier) -> Bool

 fn modifier_is_multiline(value: LiteralModifier) -> Bool

Returns true when value is MultilineModifier.

modifier_is_ungreedy(value: LiteralModifier) -> Bool

 fn modifier_is_ungreedy(value: LiteralModifier) -> Bool

Returns true when value is UngreedyModifier.

modifier_is_unicode(value: LiteralModifier) -> Bool

 fn modifier_is_unicode(value: LiteralModifier) -> Bool

Returns true when value is UnicodeModifier.

no_class_kinds() -> LiteralClassKinds

 fn no_class_kinds() -> LiteralClassKinds

Returns an empty LiteralClassKinds containing no shorthand classes, Unicode properties, or POSIX classes.

parse_fuel_step(fuel: Nat) -> Nat

 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.

parse_literal_hex_scalar(input: List(Char)) -> LiteralScalarParse

 fn parse_literal_hex_scalar(input: List(Char)) -> LiteralScalarParse

Parses either a braced \x{...} or fixed two-digit \xHH hexadecimal scalar escape.

parse_literal_unicode_property(input: List(Char)) -> LiteralPropertyParse

 fn parse_literal_unicode_property(input: List(Char)) -> LiteralPropertyParse

Parses a braced Unicode property escape {Property} following \p or \P.

parse_literal_unicode_property_name(input: List(Char), reversed: List(Char)) -> LiteralPropertyParse

 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.

prepend_literal_pattern(head: LiteralPattern, rest: LiteralPattern) -> LiteralPattern

 fn prepend_literal_pattern(head: LiteralPattern, rest: LiteralPattern) -> LiteralPattern

Prepends head before rest as a LiteralSequence.

remove_modifier(values: List(LiteralModifier), wanted: LiteralModifier) -> List(LiteralModifier)

 fn remove_modifier(values: List(LiteralModifier), wanted: LiteralModifier) -> List(LiteralModifier)

Filters out all occurrences of wanted from a modifier list.

resolve_literal_capture_reference(reference: LiteralCaptureReference, layout: LiteralCaptureLayout) -> LiteralReferenceLookup

 fn resolve_literal_capture_reference(reference: LiteralCaptureReference, layout: LiteralCaptureLayout) -> LiteralReferenceLookup

Resolves a single LiteralCaptureReference against layout, turning named references into slot references.

resolve_literal_capture_reference_arms(arms: List(LiteralPattern), layout: LiteralCaptureLayout) -> LiteralReferenceResolution

 fn resolve_literal_capture_reference_arms(arms: List(LiteralPattern), layout: LiteralCaptureLayout) -> LiteralReferenceResolution

Resolves capture references across a list of branch-reset arm patterns.

resolve_literal_capture_references(pattern: LiteralPattern, layout: LiteralCaptureLayout, _next: Nat) -> LiteralReferenceResolution

 fn resolve_literal_capture_references(pattern: LiteralPattern, layout: LiteralCaptureLayout, _next: Nat) -> LiteralReferenceResolution

Resolves named capture references inside pattern to numeric slot references using layout.

resolve_literal_reference_unary(wrap: Function(LiteralPattern, LiteralPattern), inner: LiteralPattern, layout: LiteralCaptureLayout, next: Nat) -> LiteralReferenceResolution

 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.

reverse_chars(values: List(Char)) -> List(Char)

 fn reverse_chars(values: List(Char)) -> List(Char)

Reverses a list of characters.

reverse_chars_into(values: List(Char), output: List(Char)) -> List(Char)

 fn reverse_chars_into(values: List(Char), output: List(Char)) -> List(Char)

Tail-recursively reverses values onto the accumulator output.

reverse_literal_patterns(values: List(LiteralPattern)) -> List(LiteralPattern)

 fn reverse_literal_patterns(values: List(LiteralPattern)) -> List(LiteralPattern)

Reverses a list of LiteralPattern nodes.

reverse_ranges(values: List(LiteralCharacterRange)) -> List(LiteralCharacterRange)

 fn reverse_ranges(values: List(LiteralCharacterRange)) -> List(LiteralCharacterRange)

Reverses a list of LiteralCharacterRange values.

reverse_ranges_into(values: List(LiteralCharacterRange), output: List(LiteralCharacterRange)) -> List(LiteralCharacterRange)

 fn reverse_ranges_into(values: List(LiteralCharacterRange), output: List(LiteralCharacterRange)) -> List(LiteralCharacterRange)

Tail-recursively reverses values onto the character-range accumulator output.

same_capture_name_option(left: Option(String), right: Option(String)) -> Bool

 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.

same_class_kind(left: LiteralClassKind, right: LiteralClassKind) -> Bool

 fn same_class_kind(left: LiteralClassKind, right: LiteralClassKind) -> Bool

Returns true when two LiteralClassKind values denote the same shorthand class.

same_literal_nat(left: Nat, right: Nat) -> Bool

 fn same_literal_nat(left: Nat, right: Nat) -> Bool

Returns true when two Peano Nat values are structurally equal.

same_modifier(left: LiteralModifier, right: LiteralModifier) -> Bool

 fn same_modifier(left: LiteralModifier, right: LiteralModifier) -> Bool

Returns true when two LiteralModifier values represent the same flag.

set_literal_newline_policy(policy: LiteralNewlinePolicy, options: LiteralRegexOptions) -> LiteralRegexOptions

 fn set_literal_newline_policy(policy: LiteralNewlinePolicy, options: LiteralRegexOptions) -> LiteralRegexOptions

Returns options updated with a new LiteralNewlinePolicy.

validate_literal_lookaround_list(patterns: List(LiteralPattern), depth: Nat) -> LiteralLookaroundValidation

 fn validate_literal_lookaround_list(patterns: List(LiteralPattern), depth: Nat) -> LiteralLookaroundValidation

Validates lookaround rules across every pattern in patterns.

validate_literal_lookaround_operand(pattern: LiteralPattern, depth: Nat) -> LiteralLookaroundValidation

 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.

validate_literal_lookaround_option(pattern: Option(LiteralPattern), depth: Nat) -> LiteralLookaroundValidation

 fn validate_literal_lookaround_option(pattern: Option(LiteralPattern), depth: Nat) -> LiteralLookaroundValidation

Validates lookaround rules for an optional pattern branch.

validate_literal_lookarounds(pattern: LiteralPattern) -> LiteralLookaroundValidation

 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.

validate_literal_lookarounds_at(pattern: LiteralPattern, depth: Nat) -> LiteralLookaroundValidation

 fn validate_literal_lookarounds_at(pattern: LiteralPattern, depth: Nat) -> LiteralLookaroundValidation

Validates lookaround nesting depth and fixed-width lookbehind bounds within pattern using remaining depth.

walk_literal_binary(wrap: Function(LiteralPattern, LiteralPattern, LiteralPattern), left: LiteralPattern, right: LiteralPattern, next: Nat, names: List(String)) -> LiteralCaptureWalk

 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.

walk_literal_branch_reset(arms: List(LiteralPattern), next: Nat, names: List(String)) -> LiteralCaptureWalk

 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.

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

 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.

walk_literal_captures(pattern: LiteralPattern, next: Nat, names: List(String)) -> LiteralCaptureWalk

 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.

walk_literal_unary(wrap: Function(LiteralPattern, LiteralPattern), inner: LiteralPattern, next: Nat, names: List(String)) -> LiteralCaptureWalk

 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.