pub struct Lexer<'a> { /* private fields */ }Expand description
Lexes NWScript source using the upstream compiler’s token vocabulary.
Implementations§
Source§impl<'a> Lexer<'a>
impl<'a> Lexer<'a>
Sourcepub fn new(source_id: SourceId, input: &'a [u8]) -> Self
pub fn new(source_id: SourceId, input: &'a [u8]) -> Self
Creates a lexer for one source file’s contents.
Sourcepub fn lex_all(&mut self) -> Result<Vec<Token>, LexerError>
pub fn lex_all(&mut self) -> Result<Vec<Token>, LexerError>
Lexes the entire input into a token vector ending with Eof.
§Errors
Returns LexerError if an unrecognized token is encountered.
Trait Implementations§
Auto Trait Implementations§
impl<'a> Freeze for Lexer<'a>
impl<'a> RefUnwindSafe for Lexer<'a>
impl<'a> Send for Lexer<'a>
impl<'a> Sync for Lexer<'a>
impl<'a> Unpin for Lexer<'a>
impl<'a> UnsafeUnpin for Lexer<'a>
impl<'a> UnwindSafe for Lexer<'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