Skip to main content

icb_parser/
lib.rs

1//! # icb-parser
2//!
3//! Language frontends that turn source code into a stream of [`RawNode`]s.
4//!
5//! The parser crate is the first stage of the ICB pipeline. It reads source
6//! files, invokes language-specific parsers, and produces a flat list of
7//! facts that the graph engine can consume.
8//!
9//! # Architecture
10//!
11//! * [`manager::ParserManager`] selects the right parser for a given
12//!   [`Language`].
13//! * Each language lives in its own module: [`lang`] for Python (and future
14//!   languages), [`cpp_tree_sitter`] for C/C++ via tree‑sitter.
15//! * Output is a [`facts::RawNode`] vector that represents AST nodes, calls,
16//!   references, etc.
17//!
18//! # Quick example
19//!
20//! ```rust
21//! use icb_parser::manager::ParserManager;
22//! use icb_common::Language;
23//!
24//! let manager = ParserManager::new();
25//! let facts = manager.parse_file(Language::CppTreeSitter, "void f() {}")
26//!     .unwrap();
27//! assert_eq!(facts.len(), 1);
28//! assert_eq!(facts[0].kind, icb_common::NodeKind::Function);
29//! ```
30
31pub mod cpp_tree_sitter;
32pub mod facts;
33pub mod heuristic_parser;
34pub mod lang;
35pub mod manager;