Skip to main content

fluidattacks_blends_domain/
lib.rs

1//! Blends functional core: the pure AST graph to syntax graph transformation.
2//!
3//! Everything here is `no_std` + (later) `alloc` — no filesystem, network,
4//! clock, randomness, or tree-sitter. The imperative shell (`crates/shell`)
5//! parses source into an AST graph and feeds it in; this crate only decides how
6//! that graph becomes a syntax graph.
7#![cfg_attr(not(test), no_std)]
8
9extern crate alloc;
10
11use alloc::vec::Vec;
12
13pub mod ast;
14pub mod content;
15pub mod graph_set;
16pub mod language;
17pub mod path_search;
18pub mod query;
19pub mod stack;
20pub mod syntax;
21pub(crate) mod utilities;
22
23pub use language::Language;
24
25#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Debug)]
26#[allow(
27    clippy::exhaustive_structs,
28    reason = "a newtype id consumers build by literal; it never grows a field"
29)]
30pub struct NodeId(pub u64);
31
32#[derive(Clone, Copy, PartialEq, Eq, Debug)]
33#[allow(
34    clippy::exhaustive_structs,
35    reason = "a unit marker used by value; it has no fields to add"
36)]
37pub struct Ast;
38
39#[derive(Clone, Copy, PartialEq, Eq, Debug)]
40#[allow(
41    clippy::exhaustive_structs,
42    reason = "a unit marker used by value; it has no fields to add"
43)]
44pub struct Cfg;
45
46pub trait CodeGraph {
47    fn children(&self, n_id: NodeId) -> Vec<NodeId>;
48    fn parents(&self, n_id: NodeId) -> Vec<NodeId>;
49    fn ast_children(&self, n_id: NodeId) -> Vec<NodeId>;
50    fn ast_parents(&self, n_id: NodeId) -> Vec<NodeId>;
51    fn cfg_children(&self, n_id: NodeId) -> Vec<NodeId>;
52    fn cfg_parents(&self, n_id: NodeId) -> Vec<NodeId>;
53    fn label_type(&self, n_id: NodeId) -> Option<&str>;
54}