The innermost interval holding `offset`: the last interval opening before `offset` or one of the intervals around that one.
(&self, offset: usize)
| 56 | /// The innermost interval holding `offset`: the last interval opening |
| 57 | /// before `offset` or one of the intervals around that one. |
| 58 | fn innermost(&self, offset: usize) -> Option<usize> { |
| 59 | let count = self.opens.partition_point(|&o| o < offset); |
| 60 | let mut k = if count == 0 { None } else { Some(count - 1) }; |
| 61 | while let Some(i) = k { |
| 62 | if self.closes[i] > offset { |
| 63 | break; |
| 64 | } |
| 65 | k = self.parents[i]; |
| 66 | } |
| 67 | k |
| 68 | } |
| 69 | } |
| 70 | |
| 71 | pub struct BraceScopes { |