BackQuotedString(usize, usize),
IO(IOError),
IncompleteReduction(usize, usize),
+ InfiniteFloat(usize, usize),
InvalidSingleQuotedCharacter(char),
LexicalError(lexical::Error),
MissingQuote(usize, usize),
match self {
&ParserError::BackQuotedString(line_num, col_num)
| &ParserError::IncompleteReduction(line_num, col_num)
+ | &ParserError::InfiniteFloat(line_num, col_num)
| &ParserError::MissingQuote(line_num, col_num)
| &ParserError::NonPrologChar(line_num, col_num)
| &ParserError::ParseBigInt(line_num, col_num)
ParserError::InvalidSingleQuotedCharacter(..) => {
atom!("invalid_single_quoted_character")
}
+ ParserError::InfiniteFloat(..) => {
+ atom!("infinite_float")
+ }
ParserError::IO(e) if e.kind() == ErrorKind::UnexpectedEof => {
atom!("unexpected_end_of_file")
}
Token::Literal(Literal::Rational(n)) => {
self.negate_number(n, negate_rat_rc, |r, _| Literal::Rational(r))
}
- Token::Literal(Literal::Float(n)) => self.negate_number(
+ Token::Literal(Literal::Float(n)) if F64Ptr::from_offset(n).is_infinite() => {
+ return Err(ParserError::InfiniteFloat(
+ self.lexer.line_num,
+ self.lexer.col_num,
+ ));
+ }
+ Token::Literal(Literal::Float(n)) => self.negate_number(
**n.as_ptr(),
|n, _| -n,
|n, arena| Literal::from(float_alloc!(n, arena)),
- ),
+ ),
Token::Literal(c) => {
let atomized = atomize_constant(&self.lexer.machine_st.atom_tbl, c);