Struct rune::Lexer[][src]

pub struct Lexer<'a> { /* fields omitted */ }
Expand description

Lexer for the rune language.

Implementations

Construct a new lexer over the given source.

Examples

use rune::Lexer;
use rune::ast;
use runestick::span;

assert_eq! {
    Lexer::new("fn").next().unwrap().unwrap(),
    ast::Token {
        kind: ast::Kind::Fn,
        span: span!(0, 2),
    }
};

assert_eq! {
    Lexer::new("name").next().unwrap().unwrap(),
    ast::Token {
        kind: ast::Kind::Ident(ast::StringSource::Text),
        span: span!(0, 4),
    }
};

Access the span of the lexer.

Consume the next token from the lexer.

Trait Implementations

Formats the value using the given formatter. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.