MCPcopy Create free account
hub / github.com/colbymchenry/codegraph / match_brace

Function match_brace

codegraph-kernel/src/cfnptr.rs:492–509  ·  view source on GitHub ↗

matchBrace: index of the `}` matching the `{` at `open`, or None.

(s: &[u8], open: usize)

Source from the content-addressed store, hash-verified

490}
491
492/// matchBrace: index of the `}` matching the `{` at `open`, or None.
493fn 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:

Callers 2

scan_inline_structsFunction · 0.85
scan_fileFunction · 0.85

Calls 1

lenMethod · 0.80

Tested by

no test coverage detected