Struct ketos::parser::Parser
[−]
[src]
pub struct Parser<'a, 'lex> { // some fields omitted }
Parses a stream of tokens into an expression.
Methods
impl<'a, 'lex> Parser<'a, 'lex>
[src]
fn new(names: &'a mut NameStore, lexer: Lexer<'lex>) -> Parser<'a, 'lex>
Creates a new Parser
using the given Lexer
.
Identifiers received from the lexer will be inserted into the given
NameStore
.
fn skip_shebang(&mut self)
Skips the "shebang" line of a source file.
fn parse_expr(&mut self) -> Result<Value, ParseError>
Parses an expression from the input stream.
fn parse_single_expr(&mut self) -> Result<Value, ParseError>
Parses a single expression from the input stream. If any tokens remain after the expression, an error is returned.
fn parse_exprs(&mut self) -> Result<Vec<Value>, ParseError>
Parse a series of expressions from the input stream.
fn read_doc_comment(&mut self) -> Result<Option<&'lex str>, ParseError>
Returns the the next token if it is a doc comment.
Otherwise, None
is returned and the token will be processed later.