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
//! CodeGraph Parser API
//!
//! Shared trait and types for building CodeGraph language parsers.
//!
//! This crate provides the foundation for implementing language parsers that work
//! with the CodeGraph database. It defines:
//!
//! - **CodeParser trait**: The core interface all parsers must implement
//! - **Entity types**: Language-agnostic representations of code elements (functions, classes, etc.)
//! - **Relationship types**: Representations of code dependencies (calls, imports, etc.)
//! - **Configuration**: Customizable parser behavior
//! - **Metrics**: Performance and success tracking
//! - **Error handling**: Comprehensive error types
//!
//! # Example
//!
//! ```rust,ignore
//! use codegraph_parser_api::{CodeParser, ParserConfig, ParserError, FileInfo};
//! use codegraph::CodeGraph;
//! use std::path::Path;
//!
//! struct MyParser {
//! config: ParserConfig,
//! }
//!
//! impl CodeParser for MyParser {
//! fn language(&self) -> &str {
//! "mylang"
//! }
//!
//! fn file_extensions(&self) -> &[&str] {
//! &[".my"]
//! }
//!
//! fn parse_file(&self, path: &Path, graph: &mut CodeGraph) -> Result<FileInfo, ParserError> {
//! // Implementation here
//! todo!()
//! }
//!
//! fn parse_source(&self, source: &str, file_path: &Path, graph: &mut CodeGraph)
//! -> Result<FileInfo, ParserError> {
//! // Implementation here
//! todo!()
//! }
//!
//! fn config(&self) -> &ParserConfig {
//! &self.config
//! }
//!
//! fn metrics(&self) -> ParserMetrics {
//! ParserMetrics::default()
//! }
//!
//! fn reset_metrics(&mut self) {
//! // Reset internal metrics
//! }
//! }
//! ```
// Re-export commonly used types
pub use ;
pub use ParserConfig;
pub use ;
pub use ;
pub use CodeIR;
pub use ParserMetrics;
pub use ;
pub use ;