matchBrace: index of the `}` matching the `{` at `open`, or None.
(s: &[u8], open: usize)
| 490 | } |
| 491 | |
| 492 | /// matchBrace: index of the `}` matching the `{` at `open`, or None. |
| 493 | fn match_brace(s: &[u8], open: usize) -> Option<usize> { |
| 494 | let mut depth = 0i64; |
| 495 | let mut i = open; |
| 496 | while i < s.len() { |
| 497 | match s[i] { |
| 498 | b'{' => depth += 1, |
| 499 | b'}' => { |
| 500 | depth -= 1; |
| 501 | if depth == 0 { |
| 502 | return Some(i); |
| 503 | } |
| 504 | } |
| 505 | _ => {} |
| 506 | } |
| 507 | i += 1; |
| 508 | } |
| 509 | None |
| 510 | } |
| 511 | |
| 512 | /// The `(?:(?:static|const|extern|register|volatile)\s+)*` modifier loop: |
no test coverage detected