MCPcopy Create free account
hub / github.com/ScriptedAlchemy/tracedecay / nth_sym

Method nth_sym

src/extraction/clojure_extractor.rs:412–430  ·  view source on GitHub ↗

Returns the text of the Nth `sym_lit` child (0-indexed among named children).

(state: &ExtractionState, node: TsNode<'_>, n: usize)

Source from the content-addressed store, hash-verified

410
411 /// Returns the text of the Nth `sym_lit` child (0-indexed among named children).
412 fn nth_sym(state: &ExtractionState, node: TsNode<'_>, n: usize) -> Option<String> {
413 let mut count = 0;
414 let mut cursor = node.walk();
415 if cursor.goto_first_child() {
416 loop {
417 let child = cursor.node();
418 if child.kind() == "sym_lit" {
419 if count == n {
420 return Some(state.node_text(child));
421 }
422 count += 1;
423 }
424 if !cursor.goto_next_sibling() {
425 break;
426 }
427 }
428 }
429 None
430 }
431
432 /// Returns the first `str_lit` child, used for docstrings.
433 fn extract_string_child(state: &ExtractionState, node: TsNode<'_>) -> Option<String> {

Callers

nothing calls this directly

Calls 2

kindMethod · 0.80
node_textMethod · 0.45

Tested by

no test coverage detected