1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
//! [`FeatureRecord`] and [`PatternHint`] — the output types of the parsing stage.
use PathBuf;
use ;
/// An AST node captured during parsing for use by the patterns stage.
///
/// Captures enough context to classify patterns without reparsing the file.
///
/// # Examples
///
/// ```rust
/// use sdivi_parsing::feature_record::PatternHint;
///
/// let hint = PatternHint {
/// node_kind: "try_expression".to_string(),
/// start_byte: 42,
/// end_byte: 55,
/// start_row: 10,
/// start_col: 4,
/// text: "some_fn()?".to_string(),
/// };
/// assert_eq!(hint.node_kind, "try_expression");
/// ```
/// The parsed output for a single source file.
///
/// Produced by [`crate::adapter::LanguageAdapter::parse_file`] and consumed by
/// the graph (imports), patterns (pattern_hints), and snapshot stages.
///
/// All fields own their data — no reference into the original file content or
/// the tree-sitter CST survives in this struct.
///
/// # Examples
///
/// ```rust
/// use sdivi_parsing::feature_record::FeatureRecord;
/// use std::path::PathBuf;
///
/// let record = FeatureRecord {
/// path: PathBuf::from("src/lib.rs"),
/// language: "rust".to_string(),
/// imports: vec!["std::collections::BTreeMap".to_string()],
/// exports: vec!["Foo".to_string()],
/// signatures: vec!["pub fn new() -> Foo".to_string()],
/// pattern_hints: vec![],
/// };
/// assert_eq!(record.language, "rust");
/// assert_eq!(record.imports.len(), 1);
/// ```