Struct rune::Parser[][src]

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

Parser for the rune language.

Examples

use rune::{ast, Parser};

let mut parser = Parser::new("fn foo() {}");
parser.parse::<ast::ItemFn>().unwrap();

Implementations

Construct a new parser around the given source.

Try to consume a single thing matching T, returns true if any tokens were consumed.

Try to consume all things matching T, returns true if any tokens were consumed.

Construct a parser from a token stream.

Get the span for the given range offset of tokens.

Parse a specific item from the parser.

Parse a specific item from the parser and then expect end of input.

Peek for the given token.

Access the interior peeker of the parser.

Consume the next token from the parser.

Test if the parser is at end-of-file, after which there is no more input to parse.

Assert that the parser has reached its end-of-file.

Peek the token kind at the given position.

Get the span for the given offset.

Get the span at the given position.

The last known span in this parser.

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.