1pub mod ast;
2pub mod cli;
3pub mod config;
4pub mod grammar;
5pub mod languages;
6pub mod processor;
7pub mod rules;
8
9pub use grammar::GrammarManager;
10pub use processor::{ProcessingOptions, Processor};
11pub use rules::preservation::PreservationRule;
12
13use std::error::Error;
14use std::fmt;
15
16#[derive(Debug)]
17pub enum UncommentError {
18 Io(std::io::Error),
19 ParseError(String),
20 LanguageNotSupported(String),
21 TreeSitterError(String),
22}
23
24impl fmt::Display for UncommentError {
25 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
26 match self {
27 UncommentError::Io(err) => write!(f, "IO error: {err}"),
28 UncommentError::ParseError(msg) => write!(f, "Parse error: {msg}"),
29 UncommentError::LanguageNotSupported(lang) => {
30 write!(f, "Language not supported: {lang}")
31 }
32 UncommentError::TreeSitterError(msg) => write!(f, "Tree-sitter error: {msg}"),
33 }
34 }
35}
36
37impl Error for UncommentError {}
38
39impl From<std::io::Error> for UncommentError {
40 fn from(err: std::io::Error) -> Self {
41 UncommentError::Io(err)
42 }
43}
44
45pub type Result<T> = std::result::Result<T, UncommentError>;