pub struct LookAheadFrame {
start_index: usize,
length: usize,
}
impl LookAheadFrame {
pub fn new(start_index: usize) -> LookAheadFrame {
LookAheadFrame {
start_index,
length: 0,
}
}
pub fn length(&self) -> usize {
self.length
}
pub fn next_token_ix(&self) -> usize {
self.start_index + self.length
}
pub fn increment(&mut self) {
self.length += 1;
}
}
#[must_use]
pub(crate) struct LookAheadHandler {
id: usize,
}
impl LookAheadHandler {
pub fn new(id: usize) -> Self {
Self { id }
}
pub fn id(&self) -> usize {
self.id
}
}
pub enum TokenLocation {
Stream,
StreamLookingAhead,
BufferHead,
BufferTail,
}