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

Method extract_line_comment

src/extraction/qbasic_extractor.rs:188–196  ·  view source on GitHub ↗

Extract a comment from a line node, if the line is purely a comment. Returns the comment text (with leading ' stripped), or None if not a comment line.

(state: &ExtractionState, line: TsNode<'_>)

Source from the content-addressed store, hash-verified

186 /// Extract a comment from a line node, if the line is purely a comment.
187 /// Returns the comment text (with leading ' stripped), or None if not a comment line.
188 fn extract_line_comment(state: &ExtractionState, line: TsNode<'_>) -> Option<String> {
189 let stmt_list = find_direct_child_by_kind(line, "statement_list")?;
190 let stmt = find_direct_child_by_kind(stmt_list, "statement")?;
191 let comment = find_direct_child_by_kind(stmt, "apostrophe_comment")?;
192 let text = state.node_text(comment);
193 // Strip leading ' and whitespace.
194 let stripped = text.trim_start_matches('\'').trim().to_string();
195 Some(stripped)
196 }
197
198 /// Visit a top-level `line` node, extracting CONST, DIM SHARED, CALL, etc.
199 fn visit_line(state: &mut ExtractionState, line: TsNode<'_>, pending_comment: Option<&str>) {

Callers

nothing calls this directly

Calls 2

node_textMethod · 0.45

Tested by

no test coverage detected