pub struct Lexer<'src> {
pub errors: Vec<LexerError>,
/* private fields */
}Fields§
§errors: Vec<LexerError>Implementations§
Source§impl<'src> Lexer<'src>
impl<'src> Lexer<'src>
pub fn new(source: &'src str) -> Self
Sourcepub fn new_at(source: &'src str, offset: usize) -> Self
pub fn new_at(source: &'src str, offset: usize) -> Self
Create a lexer starting in PHP mode at a given byte offset within source.
The caller guarantees that source[offset..] contains valid PHP expression
content (no <?php tag needed — the lexer is pre-set to PHP mode).
Spans produced will be correct absolute offsets into source.
pub fn source(&self) -> &'src str
pub fn peek(&mut self) -> &Token
pub fn next_token(&mut self) -> Token
Sourcepub fn token_text(&self, token: &Token) -> &'src str
pub fn token_text(&self, token: &Token) -> &'src str
Get the text slice corresponding to a token
Auto Trait Implementations§
impl<'src> Freeze for Lexer<'src>
impl<'src> RefUnwindSafe for Lexer<'src>
impl<'src> Send for Lexer<'src>
impl<'src> Sync for Lexer<'src>
impl<'src> Unpin for Lexer<'src>
impl<'src> UnsafeUnpin for Lexer<'src>
impl<'src> UnwindSafe for Lexer<'src>
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