use crate::parser::DEFAULT_MAX_DEPTH;
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct ParserConfig {
pub comments: bool,
pub max_depth: usize,
}
impl Default for ParserConfig {
fn default() -> Self {
Self {
comments: true,
max_depth: DEFAULT_MAX_DEPTH,
}
}
}
impl ParserConfig {
pub fn new() -> Self {
Self::default()
}
pub fn without_comments() -> Self {
Self::with_comments(false)
}
pub fn with_comments(comments: bool) -> Self {
Self {
comments,
..Self::default()
}
}
pub fn with_max_depth(mut self, max_depth: usize) -> Self {
self.max_depth = max_depth;
self
}
}