use crate::prelude::*;
use std::{iter::Peekable, str::Chars};
#[derive(Clone, Debug)]
pub struct LexerState<'lex> {
pub current_pos: BytePos,
txt: Peekable<Chars<'lex>>,
pub path: &'lex str,
}
impl<'lex> LexerState<'lex> {
pub fn new(current_pos: BytePos, txt: &'lex str, path: &'lex str) -> Self {
Self {
current_pos,
txt: txt.chars().peekable(),
path,
}
}
#[inline(always)]
pub fn next(&mut self) -> Option<char> {
self.current_pos = self.current_pos.shift_by(1);
self.txt.next()
}
#[inline(always)]
pub fn peek(&mut self) -> Option<&char> {
self.txt.peek()
}
}