Skip to main content

subscript_bound_classify

Function subscript_bound_classify 

Source
pub fn subscript_bound_classify(t: &str, arr: &[String]) -> SubscriptBound
Expand description

!!! WARNING: RUST-ONLY HELPER !!! Classify one subscript operand against arr — see SubscriptBound.

c:Src/params.c getindex — a bound with a search-flag subscript ((r)pat/(i)pat) yields the INDEX of the match (the *inv/*w path), not the value: ${a[(r)3,(r)5]} slices between the matched positions. getarg returns the value for r/R but the index for i/I. r is a FORWARD first-match (c:1411 down = 0), R a REVERSE last-match (c:1416 down = 1), so map ri / RI to get the matching index in the SAME direction — preserving forward/reverse for duplicate matches and the no-match returns (forward no-match → len+1, reverse → 0).