Skip to main content

ErrorTolerantParser

Trait ErrorTolerantParser 

Source
pub trait ErrorTolerantParser<'ast, T> {
    // Required methods
    fn parse_tolerant<'input>(
        &self,
        alloc: &'ast AstAlloc,
        file_id: FileId,
        lexer: impl Iterator<Item = Result<SpannedToken<'input>, LexicalError>>,
    ) -> Result<(T, ParseErrors), ParseError>;
    fn parse_strict<'input>(
        &self,
        alloc: &'ast AstAlloc,
        file_id: FileId,
        lexer: impl Iterator<Item = Result<SpannedToken<'input>, LexicalError>>,
    ) -> Result<T, ParseErrors>;
}
Expand description

General interface of the various specialized Nickel parsers.

T is the product of the parser (a term, a type, etc.).

Required Methods§

Source

fn parse_tolerant<'input>( &self, alloc: &'ast AstAlloc, file_id: FileId, lexer: impl Iterator<Item = Result<SpannedToken<'input>, LexicalError>>, ) -> Result<(T, ParseErrors), ParseError>

Parse a value from a lexer with the given file_id in an error-tolerant way. This methods can still fail for non-recoverable errors.

Source

fn parse_strict<'input>( &self, alloc: &'ast AstAlloc, file_id: FileId, lexer: impl Iterator<Item = Result<SpannedToken<'input>, LexicalError>>, ) -> Result<T, ParseErrors>

Parse a value from a lexer with the given file_id, failing at the first encountered error.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl<'ast, T, P> ErrorTolerantParser<'ast, T> for P
where P: LalrpopParser<'ast, T>,