Skip to main content

Module structure

Module structure 

Source
Expand description

String-level structural analysis primitives and the nested/adjacent unbounded-quantifier rules.

Port of the reference _redos_structure_primitives.py and _redos_structure_rules.py (assembled by _redos_structure.py): all analysis happens over the raw pattern source, exactly as in Python.

Structs§

NestingTooDeep
The reference GroupNestingTooDeep signal.

Constants§

MAX_GROUP_NESTING_DEPTH
Maximum group nesting depth the structural analyzer supports.

Functions§

advance_past_escape_or_char_class
Advance past an escape pair or a whole char class.
branch_is_unbounded_single
Whether a branch is . quantified unbounded exactly once: .*, .+ or .{n,}.
branches_overlap
Prefix-overlap test for literal branches.
detect_adjacent_broad_unbounded_quantifiers
Reference _detect_adjacent_broad_unbounded_quantifiers.
detect_nested_unbounded_quantifier
Reference _detect_nested_unbounded_quantifier.
find_group_end
Index just past the group whose ( is at start.
is_pure_literal_branch
Whether a branch is a nonempty run of non-meta characters.
iter_quantified_group_bodies
Every quantified group body as (start, end, inner) over the source.
nesting_depth_rejection_reason
Rejection reason returned when the depth cap trips.
normalize_group_inner
Strip ?: / ?P<name> group prefixes; None for unsupported heads.
outer_quantifier_len
Length of the unbounded quantifier at k (*, +, {n,}), else 0.
overlapping_literal_branches
Whether at least two literal branches share a prefix.
skip_char_class
Skip a [...] class starting at i; returns the index past ].
split_top_level_alternations
Split alternation branches at top nesting level.
strip_escapes_and_char_classes
Replace escapes and char classes with X placeholders.
unwrap_transparent_wrapper
Peel leading transparent wrappers that span the whole text.

Type Aliases§

StructureResult