use crate::ast::Ast;
use std::ops::Range;
#[derive(Clone)]
pub struct AstMeta {
pub range: Range<usize>,
pub item: Ast,
pub has_semi: bool,
}
impl AstMeta {
pub fn new(range: Range<usize>, item: Ast) -> Self {
Self {
range,
item,
has_semi: false,
}
}
pub fn boxed(range: Range<usize>, item: Ast) -> Box<Self> {
Box::new(
Self {
range,
item,
has_semi: false,
}
)
}
pub fn as_box(self) -> Box<Self> {
Box::new(self)
}
}
impl std::fmt::Debug for AstMeta {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
self.item.fmt(f)
}
}