Skip to content

Commit

Permalink
Fixing parsing bug and adding test
Browse files Browse the repository at this point in the history
  • Loading branch information
ZachJHansen committed Dec 8, 2023
1 parent cb25ed4 commit 1edc8ed
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/parsing/asp/grammar.pest
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ relation = _{ equal | not_equal | less_equal | less | greater_equal | greater }

comparison = { term ~ relation ~ term }

atomic_formula = { literal | comparison }
atomic_formula = { comparison | literal }

head = { basic_head | choice_head | falsity }
basic_head = { atom }
Expand Down
16 changes: 16 additions & 0 deletions src/parsing/asp/pest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -969,6 +969,22 @@ mod tests {
},
},
),
(
"p :- a != b.",
Rule {
head: Head::Basic(Atom {
predicate: "p".into(),
terms: vec![],
}),
body: Body {
formulas: vec![AtomicFormula::Comparison(Comparison {
lhs: Term::PrecomputedTerm(PrecomputedTerm::Symbol("a".into())),
rhs: Term::PrecomputedTerm(PrecomputedTerm::Symbol("b".into())),
relation: Relation::NotEqual,
})],
},
},
),
(
"a :-.",
Rule {
Expand Down

0 comments on commit 1edc8ed

Please sign in to comment.