Function regex_automata::meta::reverse_inner::top_concat

source ·
fn top_concat(hir: &Hir) -> Option<Vec<Hir>>
Expand description

Looks for a “top level” HirKind::Concat item in the given HIR. This will try to return one even if it’s embedded in a capturing group, but is otherwise pretty conservative in what is returned.

The HIR returned is a complete copy of the concat with all capturing groups removed. In effect, the concat returned is “flattened” with respect to capturing groups. This makes the detection logic above for prefixes a bit simpler, and it works because 1) capturing groups never influence whether a match occurs or not and 2) capturing groups are not used when doing the reverse inner search to find the start of the match.