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§
- Nesting
TooDeep - The reference
GroupNestingTooDeepsignal.
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 atstart. - 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;Nonefor 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 ati; 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
Xplaceholders. - unwrap_
transparent_ wrapper - Peel leading transparent wrappers that span the whole text.