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§
Sourcefn new(msg: &str) -> ParseError
fn new(msg: &str) -> ParseError
Create a generic parse error with a message.
Sourcefn at(msg: &str, line: u32, col: u32) -> ParseError
fn at(msg: &str, line: u32, col: u32) -> ParseError
Create an error at a specific source location.
Sourcefn unexpected_token(
found: &str,
expected: &str,
line: u32,
col: u32,
) -> ParseError
fn unexpected_token( found: &str, expected: &str, line: u32, col: u32, ) -> ParseError
Create an “unexpected token” error.
Sourcefn unexpected_eof() -> ParseError
fn unexpected_eof() -> ParseError
Create an “unexpected end of file” error.
Sourcefn invalid_syntax(msg: &str, line: u32, col: u32) -> ParseError
fn invalid_syntax(msg: &str, line: u32, col: u32) -> ParseError
Create an “invalid syntax” error.
Sourcefn unterminated_string(line: u32, col: u32) -> ParseError
fn unterminated_string(line: u32, col: u32) -> ParseError
Create an “unterminated string literal” error.
Sourcefn reserved_keyword(kw: &str, line: u32, col: u32) -> ParseError
fn reserved_keyword(kw: &str, line: u32, col: u32) -> ParseError
Create a “reserved keyword used as identifier” error.
Sourcefn duplicate_binder(name: &str, line: u32, col: u32) -> ParseError
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.