Struct Lexer

Source
pub struct Lexer<'lex, 'src> { /* private fields */ }

Implementations§

Source§

impl<'lex, 'src> Lexer<'lex, 'src>

Source

pub fn new( text: &'src str, base_offset: usize, em: &'lex mut ErrorManager, ) -> Self

Builds a new Lexer

§Arguments
  • text: Source code to tokenize
  • em: An ErrorManager, where all the errors will be sent
Source

pub fn into_token_stream(self) -> TokenStream<'lex, 'src>

Turns this Lexer into a TokenStream

Source

pub fn next_token(&mut self) -> Option<Token>

Parses the next token

Returns None if the EOF was reached

Trait Implementations§

Source§

impl<'lex, 'src> IntoIterator for Lexer<'lex, 'src>

Source§

fn into_iter(self) -> Self::IntoIter

Converts this Lexer into an iterator of tokens

This is the same as calling Self::into_token_stream

Source§

type Item = Token

The type of the elements being iterated over.
Source§

type IntoIter = TokenStream<'lex, 'src>

Which kind of iterator are we turning this into?

Auto Trait Implementations§

§

impl<'lex, 'src> Freeze for Lexer<'lex, 'src>

§

impl<'lex, 'src> !RefUnwindSafe for Lexer<'lex, 'src>

§

impl<'lex, 'src> !Send for Lexer<'lex, 'src>

§

impl<'lex, 'src> !Sync for Lexer<'lex, 'src>

§

impl<'lex, 'src> Unpin for Lexer<'lex, 'src>

§

impl<'lex, 'src> !UnwindSafe for Lexer<'lex, 'src>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.