Skip to main content

ParseErrorFactory

Trait ParseErrorFactory 

Source
pub trait ParseErrorFactory {
    // Required methods
    fn new(msg: &str) -> ParseError;
    fn at(msg: &str, line: u32, col: u32) -> ParseError;
    fn unexpected_token(
        found: &str,
        expected: &str,
        line: u32,
        col: u32,
    ) -> ParseError;
    fn unexpected_eof() -> ParseError;
    fn invalid_syntax(msg: &str, line: u32, col: u32) -> ParseError;
    fn unterminated_string(line: u32, col: u32) -> ParseError;
    fn reserved_keyword(kw: &str, line: u32, col: u32) -> ParseError;
    fn duplicate_binder(name: &str, line: u32, col: u32) -> ParseError;
}
Expand description

Extension trait providing factory methods on ParseError.

Required Methods§

Source

fn new(msg: &str) -> ParseError

Create a generic parse error with a message.

Source

fn at(msg: &str, line: u32, col: u32) -> ParseError

Create an error at a specific source location.

Source

fn unexpected_token( found: &str, expected: &str, line: u32, col: u32, ) -> ParseError

Create an “unexpected token” error.

Source

fn unexpected_eof() -> ParseError

Create an “unexpected end of file” error.

Source

fn invalid_syntax(msg: &str, line: u32, col: u32) -> ParseError

Create an “invalid syntax” error.

Source

fn unterminated_string(line: u32, col: u32) -> ParseError

Create an “unterminated string literal” error.

Source

fn reserved_keyword(kw: &str, line: u32, col: u32) -> ParseError

Create a “reserved keyword used as identifier” error.

Source

fn duplicate_binder(name: &str, line: u32, col: u32) -> ParseError

Create a “duplicate binder name” 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§