matchBrace: index of the `}` matching the `{` at `open`, or None.
(s: &[u8], open: usize)
| 469 | } |
| 470 | |
| 471 | /// matchBrace: index of the `}` matching the `{` at `open`, or None. |
| 472 | fn match_brace(s: &[u8], open: usize) -> Option<usize> { |
| 473 | let mut depth = 0i64; |
| 474 | let mut i = open; |
| 475 | while i < s.len() { |
| 476 | match s[i] { |
| 477 | b'{' => depth += 1, |
| 478 | b'}' => { |
| 479 | depth -= 1; |
| 480 | if depth == 0 { |
| 481 | return Some(i); |
| 482 | } |
| 483 | } |
| 484 | _ => {} |
| 485 | } |
| 486 | i += 1; |
| 487 | } |
| 488 | None |
| 489 | } |
| 490 | |
| 491 | /// The `(?:(?:static|const|extern|register|volatile)\s+)*` modifier loop: |
no test coverage detected