Skip to main content

Parser

Trait Parser 

Source
pub trait Parser: Send + Sync {
    // Required methods
    fn parse<'a>(
        &self,
        tokens: &[Token<'a>],
    ) -> Result<Vec<AstNode<'a>>, AamlError>;
    fn parse_with_recovery<'a>(&self, tokens: &[Token<'a>]) -> ParseOutput<'a>;
    fn generate_parse_tasks<'a>(
        &self,
        ast: &[AstNode<'a>],
    ) -> Vec<ParseTask<'a>>;
    fn generate_execution_tasks<'a>(
        &self,
        ast: &[AstNode<'a>],
    ) -> Vec<ExecutionTask<'a>>;
}
Expand description

Trait for parsing tokens into an AST.

Required Methods§

Source

fn parse<'a>(&self, tokens: &[Token<'a>]) -> Result<Vec<AstNode<'a>>, AamlError>

Parses a token stream into an AST.

§Errors

Returns AamlError::ParseError if the token stream is malformed.

Source

fn parse_with_recovery<'a>(&self, tokens: &[Token<'a>]) -> ParseOutput<'a>

Parses with recovery and returns both partial AST and all parse errors.

Source

fn generate_parse_tasks<'a>(&self, ast: &[AstNode<'a>]) -> Vec<ParseTask<'a>>

Generates parse tasks from an AST

Source

fn generate_execution_tasks<'a>( &self, ast: &[AstNode<'a>], ) -> Vec<ExecutionTask<'a>>

Generates execution tasks from an AST

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§