better detect syntax errors in lexer.rs (#1771)

This commit is contained in:
Mark
2023-06-27 16:39:10 -06:00
parent 8613513b9c
commit 039fffb339
2 changed files with 8 additions and 1 deletions

View File

@@ -193,6 +193,7 @@ get_single_char(C) :-
% ```
read_from_chars(Chars, Term) :-
must_be(chars, Chars),
must_be(var, Term),
'$read_term_from_chars'(Chars, Term).
%% write_term_to_chars(+Term, +Options, -Chars).

View File

@@ -859,7 +859,13 @@ impl<'a, R: CharRead> Lexer<'a, R> {
self.get_single_quoted_char()
.map(|c| Token::Literal(Literal::Fixnum(Fixnum::build_with(c as i64))))
.or_else(|_| {
.or_else(|err| {
match err {
ParserError::UnexpectedChar('\'', ..) => {
}
err => return Err(err),
}
self.return_char(c);
i64::from_str_radix(&token, 10)