[−][src]Struct regex_lexer::Lexer
A regex-based lexer.
#[derive(Debug, PartialEq, Eq)] enum Token<'t> { Ident(&'t str), // ... } let lexer = regex_lexer::LexerBuilder::new() .token(r"\p{XID_Start}\p{XID_Continue}*", |id| Some(Token::Ident(id))) .token(r"\s+", |_| None) // skip whitespace // ... .build()?; let tokens = lexer.tokens("these are some identifiers");
Implementations
impl<'t, T: 't> Lexer<'t, T>
[src]
pub fn builder<'r>() -> LexerBuilder<'r, 't, T>
[src]
Create a LexerBuilder. This is the same as LexerBuilder::new.
pub fn tokens<'l>(&'l self, source: &'t str) -> Tokens<'l, 't, T>
[src]
Return an iterator over all matched tokens.
Trait Implementations
Auto Trait Implementations
impl<'t, T> !RefUnwindSafe for Lexer<'t, T>
impl<'t, T> !Send for Lexer<'t, T>
impl<'t, T> !Sync for Lexer<'t, T>
impl<'t, T> Unpin for Lexer<'t, T>
impl<'t, T> !UnwindSafe for Lexer<'t, T>
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,