pub enum ParseError {
Show 13 variants
Lex(LexError),
UnexpectedToken {
found: Token,
expected: &'static str,
pos: Position,
},
UnexpectedEof {
expected: &'static str,
},
UnknownOpcode {
found: String,
pos: Position,
},
BadKeyword {
keyword: String,
form: &'static str,
pos: Position,
},
DuplicateKeyword {
keyword: String,
pos: Position,
},
MissingRequiredKeyword {
missing: &'static str,
form: &'static str,
},
ArityMismatch {
form: &'static str,
expected: usize,
found: usize,
pos: Position,
},
ExpectedValue {
found: Token,
pos: Position,
},
UnbalancedList {
pos: Position,
},
ExpectedSymbolInList {
found: RawValue,
pos: Position,
},
InvalidTimestamp {
text: String,
pos: Position,
},
NestingTooDeep {
pos: Position,
max: usize,
},
}Expand description
Errors produced by parse.
Per ir-write-surface.md § 8 — fail-fast on first violation, no
partial recovery.
Variants§
Lex(LexError)
The lexer failed before the parser could start.
UnexpectedToken
Got a token that isn’t allowed here.
Fields
UnexpectedEof
Input ended before the parser could complete a form.
UnknownOpcode
The opcode at the head of a form isn’t one of the registered ten.
BadKeyword
A form received an unexpected keyword.
Fields
DuplicateKeyword
A keyword appears twice in the same form.
MissingRequiredKeyword
A form is missing a required keyword.
ArityMismatch
A form has the wrong number of positional arguments.
Fields
ExpectedValue
A RawValue was expected but a non-value token was found.
UnbalancedList
A list parse saw unbalanced parens.
ExpectedSymbolInList
A list position required symbols but saw a non-symbol value.
InvalidTimestamp
An ISO timestamp value could not be normalised to a ClockTime.
NestingTooDeep
Parser nesting exceeded MAX_NESTING_DEPTH. Surfaced before
the recursive descent blows the host stack — closes Security
F3 (P2) from the v1.1 fresh assessment. Triggered by inputs
like (((…))) of pathological depth, whether through nested
list values (parse_value → parse_value_list_body) or
through nested correct forms (parse_correct →
parse_form).
Fields
max: usizeThe hard limit (currently MAX_NESTING_DEPTH).
Trait Implementations§
Source§impl Debug for ParseError
impl Debug for ParseError
Source§impl Display for ParseError
impl Display for ParseError
Source§impl Error for ParseError
impl Error for ParseError
Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()