make ParserError a struct with an enum kind field

This commit is contained in:
Skgland
2026-01-24 03:24:02 +01:00
committed by Bennet Bleßmann
parent bd233fedfd
commit 18b476af28
6 changed files with 120 additions and 131 deletions

View File

@@ -1952,7 +1952,7 @@ impl MachineState {
) -> Result<Stream, ParserError> {
match stream.peek_char() {
None => Ok(stream), // empty stream is handled gracefully by Lexer::eof
Some(Err(e)) => Err(ParserError::IO(e)),
Some(Err(e)) => Err(ParserError::from(e)),
Some(Ok(c)) => {
if c == '\u{feff}' {
// skip UTF-8 BOM

View File

@@ -1016,7 +1016,7 @@ impl MachineState {
self.unify_fixnum(n, nx);
}
_ => {
let err = ParserError::ParseBigInt(parser.lexer.location.clone());
let err = parser.lexer.parse_big_int_error();
let err = self.syntax_error(err);
return Err(self.error_form(err, stub_gen()));
@@ -1026,7 +1026,7 @@ impl MachineState {
return Ok(());
}
Ok(c) => {
let err = ParserError::UnexpectedChar(c, lexer.location);
let err = lexer.unexpected_char(c);
let err = self.syntax_error(err);
return Err(self.error_form(err, stub_gen()));