From a573b8dd4b8b39adb6c4b1825855d07ae3e890c1 Mon Sep 17 00:00:00 2001 From: ZachJHansen Date: Fri, 3 Nov 2023 10:19:21 -0500 Subject: [PATCH] Fixing parsing of negation for fol --- src/parsing/fol/pest.rs | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/parsing/fol/pest.rs b/src/parsing/fol/pest.rs index 440f5499..60dfe3f3 100644 --- a/src/parsing/fol/pest.rs +++ b/src/parsing/fol/pest.rs @@ -434,8 +434,8 @@ impl PestParser for FormulaParser { quantification: QuantificationParser::translate_pair(op), formula: Box::new(arg), }, - internal::Rule::unary_connective => Formula::UnaryFormula { - connective: UnaryConnectiveParser::translate_pair(op), + internal::Rule::negation => Formula::UnaryFormula { + connective: UnaryConnective::Negation, formula: Box::new(arg), }, _ => Self::report_unexpected_pair(op), @@ -1016,6 +1016,17 @@ mod tests { #[test] fn parse_formula() { FormulaParser.should_parse_into([ + ( + "not p", + Formula::UnaryFormula { + connective: UnaryConnective::Negation, + formula: Formula::AtomicFormula(AtomicFormula::Atom(Atom { + predicate: "p".into(), + terms: vec![], + })) + .into(), + }, + ), ( "forall A p(A) -> q", Formula::BinaryFormula {