don't parse bracketed non-operators as functor terms (#2033)

This commit is contained in:
Mark
2023-09-23 14:26:28 -06:00
parent 1c8cd85f6c
commit 142e0c2c3a
3 changed files with 12 additions and 6 deletions

View File

@@ -34,6 +34,7 @@ pub const FY: u32 = 0x0080;
pub const DELIMITER: u32 = 0x0100;
pub const TERM: u32 = 0x1000;
pub const LTERM: u32 = 0x3000;
pub const BTERM: u32 = 0x11000;
pub const NEGATIVE_SIGN: u32 = 0x0200;

View File

@@ -612,6 +612,10 @@ impl<'a, R: CharRead> Parser<'a, R> {
ref mut unfold_bounds,
}) = self.stack.last_mut()
{
if *spec == BTERM {
return false;
}
*tt = TokenType::Term;
*priority = 0;
*spec = TERM;
@@ -878,7 +882,7 @@ impl<'a, R: CharRead> Parser<'a, R> {
.push(Term::Literal(Cell::default(), Literal::Atom(atom)));
}
self.stack[idx].spec = TERM;
self.stack[idx].spec = if self.stack[idx].priority > 0 { TERM } else { BTERM };
self.stack[idx].tt = TokenType::Term;
self.stack[idx].priority = 0;