#[derive(Clone, Copy, Debug)]
pub struct Options {
pub legacy_strands: bool,
pub surrealism: bool,
}
impl Options {
pub const ALL: Options = Options {
legacy_strands: false,
surrealism: true,
};
}
#[derive(Clone, Debug, PartialEq, Eq)]
pub struct Reject {
pub msg: std::borrow::Cow<'static, str>,
pub span: Option<(u32, u32)>,
pub label: Option<std::borrow::Cow<'static, str>>,
pub extra: Option<(u32, u32, std::borrow::Cow<'static, str>)>,
}
impl Reject {
pub fn new(msg: impl Into<std::borrow::Cow<'static, str>>) -> Self {
Reject {
msg: msg.into(),
span: None,
label: None,
extra: None,
}
}
pub fn at(mut self, start: u32, end: u32) -> Self {
self.span = Some((start, end));
self
}
pub fn with_label(mut self, label: impl Into<std::borrow::Cow<'static, str>>) -> Self {
self.label = Some(label.into());
self
}
}