Skip to content

Commit

Permalink
Fixing parsing of negation for fol
Browse files Browse the repository at this point in the history
  • Loading branch information
ZachJHansen authored and teiesti committed Nov 3, 2023
1 parent ba3dd4e commit a573b8d
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions src/parsing/fol/pest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down Expand Up @@ -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 {
Expand Down

0 comments on commit a573b8d

Please sign in to comment.