matchBrace: index of the `}` matching the `{` at `open`, or None.
(s: &[u8], open: usize)
| 480 | } |
| 481 | |
| 482 | /// matchBrace: index of the `}` matching the `{` at `open`, or None. |
| 483 | fn match_brace(s: &[u8], open: usize) -> Option<usize> { |
| 484 | let mut depth = 0i64; |
| 485 | let mut i = open; |
| 486 | while i < s.len() { |
| 487 | match s[i] { |
| 488 | b'{' => depth += 1, |
| 489 | b'}' => { |
| 490 | depth -= 1; |
| 491 | if depth == 0 { |
| 492 | return Some(i); |
| 493 | } |
| 494 | } |
| 495 | _ => {} |
| 496 | } |
| 497 | i += 1; |
| 498 | } |
| 499 | None |
| 500 | } |
| 501 | |
| 502 | /// The `(?:(?:static|const|extern|register|volatile)\s+)*` modifier loop: |
no test coverage detected