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

Function match_brace

codegraph-kernel/src/cfnptr.rs:482–499  ·  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

480}
481
482/// matchBrace: index of the `}` matching the `{` at `open`, or None.
483fn 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:

Callers 2

scan_inline_structsFunction · 0.85
scan_fileFunction · 0.85

Calls 1

lenMethod · 0.80

Tested by

no test coverage detected