use crate::constants::{CHAR_SPACE, CHAR_TAB};
pub use babbel_core::io::traits::ISource as ICharStream;
pub trait IStatefulStream {
fn save_state(&mut self) -> SaveState;
fn restore_state(&mut self, state: SaveState);
}
pub trait IIndentationAware {
fn is_whitespace(&self, c: char) -> bool {
c == CHAR_SPACE || c == CHAR_TAB
}
fn is_tab(&self, c: char) -> bool {
c == CHAR_TAB
}
fn get_current_indent_level(&self) -> usize;
}
pub trait ISource: ICharStream + IStatefulStream + IIndentationAware {}
impl<T: ICharStream + IStatefulStream + IIndentationAware + ?Sized> ISource for T {}
#[derive(Clone, Debug, PartialEq, Eq)]
pub struct SaveState {
pub pos: u64,
pub current_byte: Option<u8>,
pub column: usize,
pub line: usize,
}
pub use babbel_core::io::traits::IDestination;