better detect syntax errors in lexer.rs (#1771)
This commit is contained in:
@@ -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).
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user