MCPcopy Create free account
hub / github.com/douglance/devsql / extract_python

Function extract_python

crates/devsql/src/providers/symbols.rs:557–575  ·  view source on GitHub ↗
(content: &str)

Source from the content-addressed store, hash-verified

555 LazyLock::new(|| Regex::new(r"(?m)^[[:space:]]*(class|def)\s+(\w+)").expect("Python regex"));
556
557fn extract_python(content: &str) -> Vec<SymbolMatch> {
558 let mut rows = Vec::new();
559 for caps in RE_PYTHON.captures_iter(content) {
560 let full_match = caps.get(0).unwrap();
561 let line_start = line_number_at(content, full_match.start());
562 let signature = line_text(content, line_start).trim().to_string();
563 let kind = caps.get(1).map(|m| m.as_str()).unwrap_or("unknown");
564 let name = caps.get(2).map(|m| m.as_str()).unwrap_or("");
565 rows.push(SymbolMatch {
566 name: name.to_string(),
567 kind: kind.to_string(),
568 line_start,
569 line_end: line_start,
570 signature,
571 visibility: String::new(),
572 });
573 }
574 rows
575}
576
577static RE_GO: LazyLock<Regex> =
578 LazyLock::new(|| Regex::new(r"(?m)^func\s+(\([^)]*\)\s+)?(\w+)").expect("Go regex"));

Callers 1

extract_symbolsFunction · 0.85

Calls 2

line_number_atFunction · 0.85
line_textFunction · 0.85

Tested by

no test coverage detected