[][src]Struct ketos::lexer::Lexer

pub struct Lexer<'lex> { /* fields omitted */ }

Produces Tokens from an input string.

Methods

impl<'lex> Lexer<'lex>[src]

pub fn new(input: &str, offset: BytePos) -> Lexer[src]

Creates a new Lexer to read tokens from the input string.

pub fn next_token(&mut self) -> Result<(Span, Token<'lex>), ParseError>[src]

Scans the input stream for the next token, returning the token and the span of input text from which it was scanned.

pub fn skip_shebang(&mut self)[src]

Skips over a shebang line at the start of input. This is used when parsing files which, on Unix systems, may use a line consisting of #! followed by a path to the interpreter.

Panics

Panics if any tokens have already been scanned from the input stream.

pub fn current_position(&self) -> BytePos[src]

Returns the current position within the input string.

The next call to next_token will begin searching at this point.

Auto Trait Implementations

impl<'lex> RefUnwindSafe for Lexer<'lex>

impl<'lex> Send for Lexer<'lex>

impl<'lex> Sync for Lexer<'lex>

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

impl<'lex> UnwindSafe for Lexer<'lex>

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,