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
82
83
84
85
86
//! # sealmap-extract
//!
//! The language-neutral half of a sealmap language adapter. A language adapter (the syn-based
//! `sealmap-rust`, or a future TypeScript one) parses source and walks
//! function bodies; everything after that is shared and lives here, so two
//! language adapters produce flows, labels, ids and confidences by the same rules:
//!
//! | Module | Owns |
//! |---|---|
//! | [`raw`] | the raw flow IR a parser emits before resolution ([`RawStep`], [`RawCall`], [`Callee`], [`Recv`]) and the helpers that shape it while walking |
//! | [`lower`] | flow normalisation: raw steps plus a call resolver → a model [`Flow`](sealmap_model::Flow) |
//! | [`confidence`] | the confidence lattice, the external-call policy ([`ExternalCalls`]) and call-edge aggregation |
//! | [`labels`] | label rules: compact token spacing, clipping limits, call, condition and deferred-closure labels |
//! | [`fingerprint`] | per-symbol `sig_hash` / `body_hash` over a language-neutral token stream |
//! | [`ids`] | the `sym:` id builder (package, module, item, method and trait-impl ids) |
//! | [`isolate`] | per-file collection on big stacks with a panic guard |
//!
//! It has no parser dependency; a language adapter brings its own.
//!
//! ## Example
//!
//! A language adapter has walked `fn run() { if ready() { go() } }` and resolves
//! every path call to an internal function:
//!
//! ```
//! use sealmap_extract::raw::{Callee, RawCall, RawStep};
//! use sealmap_extract::{ids, lower};
//! use sealmap_model::{CallKind, Confidence, Step, SymbolKind};
//!
//! let call = |name: &str, line| {
//! RawStep::Call(RawCall::new(Callee::Path(vec![name.into()]), format!("{name}()"), CallKind::Function, line))
//! };
//! let raw = vec![call("ready", 1), RawStep::Branch(vec![("ready()".into(), vec![call("go", 1)])])];
//!
//! let app = ids::module_id(&ids::package("cargo", "app"), &[]);
//! let flow = lower::lower_flow(&raw, &mut |c: &RawCall| {
//! let Callee::Path(segs) = &c.callee else { return None };
//! Some(c.to_call(ids::item_id(&app, SymbolKind::Function, &segs[0]), Confidence::Exact))
//! })
//! .unwrap();
//!
//! let targets: Vec<_> = flow.calls().map(|c| c.target.to_string()).collect();
//! assert_eq!(targets, ["sym:cargo app . ready().", "sym:cargo app . go()."]);
//! // A branch with one surviving arm is an optional fragment.
//! assert!(matches!(&flow.steps[1], Step::Optional { label, .. } if label == "ready()"));
//! ```
use ;
pub use ;
pub use ;
/// A non-fatal problem found while extracting (currently: files that failed
/// to parse; they still get a module symbol so every file is represented).
/// Result of a language adapter's extraction.
/// Compiles and runs the README examples as doctests.
;