use std::path::PathBuf;
use thiserror::Error;
#[derive(Error, Debug)]
pub enum ParserError {
#[error("IO error reading {0}: {1}")]
IoError(PathBuf, #[source] std::io::Error),
#[error("Syntax error in {0}:{1}:{2}: {3}")]
SyntaxError(PathBuf, usize, usize, String),
#[error("File {0} exceeds maximum size ({1} bytes)")]
FileTooLarge(PathBuf, usize),
#[error("Parsing {0} exceeded timeout")]
Timeout(PathBuf),
#[error("Failed to insert into graph: {0}")]
GraphError(String),
#[error("Unsupported language feature in {0}: {1}")]
UnsupportedFeature(PathBuf, String),
#[error("Parse error in {0}: {1}")]
ParseError(PathBuf, String),
}
pub type ParserResult<T> = Result<T, ParserError>;