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 syntax;
20pub(crate) mod utilities;
21
22pub use language::Language;
23
24#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Debug)]
25pub struct NodeId(pub u64);
26
27#[derive(Clone, Copy, PartialEq, Eq, Debug)]
28pub struct Ast;
29
30#[derive(Clone, Copy, PartialEq, Eq, Debug)]
31pub struct Cfg;
32
33pub trait CodeGraph {
34    fn children(&self, n_id: NodeId) -> Vec<NodeId>;
35    fn parents(&self, n_id: NodeId) -> Vec<NodeId>;
36    fn ast_children(&self, n_id: NodeId) -> Vec<NodeId>;
37    fn ast_parents(&self, n_id: NodeId) -> Vec<NodeId>;
38    fn cfg_children(&self, n_id: NodeId) -> Vec<NodeId>;
39    fn cfg_parents(&self, n_id: NodeId) -> Vec<NodeId>;
40    fn label_type(&self, n_id: NodeId) -> Option<&str>;
41}