pub struct LexerState<'a> { /* private fields */ }Expand description
TODO
Implementations§
Source§impl<'a> LexerState<'a>
impl<'a> LexerState<'a>
Sourcepub fn new(input: &'a str) -> Self
pub fn new(input: &'a str) -> Self
Create a new lexer state.
Examples found in repository?
examples/lexing.rs (line 46)
39fn main() {
40 let src = r#"
41 "Hello, World!"
42 42
43 identifier
44 "#;
45 let lexer = lex::Initial::new();
46 let mut lexbuf = LexerState::new(src);
47 while let Some(token) = lexer.next(&mut lexbuf) {
48 println!("{token:?}");
49 }
50}Sourcepub fn run(&mut self, regex: &Regex) -> Option<PatternID>
pub fn run(&mut self, regex: &Regex) -> Option<PatternID>
Run the lexer against the given regex.
Sourcepub fn advance_to_cursor(&mut self, cursor: Cursor)
pub fn advance_to_cursor(&mut self, cursor: Cursor)
Advance the lexer to the given cursor position.
Trait Implementations§
Source§impl<'a> Clone for LexerState<'a>
impl<'a> Clone for LexerState<'a>
Source§fn clone(&self) -> LexerState<'a>
fn clone(&self) -> LexerState<'a>
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl<'a> Freeze for LexerState<'a>
impl<'a> RefUnwindSafe for LexerState<'a>
impl<'a> Send for LexerState<'a>
impl<'a> Sync for LexerState<'a>
impl<'a> Unpin for LexerState<'a>
impl<'a> UnwindSafe for LexerState<'a>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more