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
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.
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 at the given position.