mod context;
pub use context::*;
mod token;
use lang_util::position::LexerPosition;
pub use token::*;
#[cfg(feature = "v1")]
pub mod v1;
#[cfg(any(feature = "v2-min", feature = "v2-full"))]
mod v2;
#[cfg(feature = "v2-min")]
pub mod v2_min;
#[cfg(feature = "v2-full")]
pub mod v2_full;
pub trait HasLexerError {
type Error: lang_util::error::LexicalError;
}
pub trait LangLexer<'i>: HasLexerError + Sized {
type Input: 'i;
type Iter: LangLexerIterator + HasLexerError<Error = Self::Error>;
fn new(source: Self::Input, opts: &ParseOptions) -> Self;
fn run(self, ctx: ParseContext) -> Self::Iter;
}
pub trait LangLexerIterator:
Iterator<Item = Result<(LexerPosition, Token, LexerPosition), Self::Error>> + HasLexerError
{
#[cfg(feature = "lalrpop")]
fn resolve_err(
&self,
err: lalrpop_util::ParseError<LexerPosition, Token, Self::Error>,
) -> lang_util::error::ParseError<Self::Error>;
}