Skip to content

Commit 98ebd4c

Browse files
committed
fix: reflect review comments in PR
1 parent 45a5f09 commit 98ebd4c

2 files changed

Lines changed: 7 additions & 6 deletions

File tree

src/annot.rs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -420,7 +420,7 @@ where
420420
Ok(AnnotPath { segments })
421421
}
422422

423-
fn parse_datatype_ctor_args(&mut self) -> Result<Vec<chc::Term<T::Output>>> {
423+
fn parse_arg_terms(&mut self) -> Result<Vec<chc::Term<T::Output>>> {
424424
if self.look_ahead_token(0).is_none() {
425425
return Ok(Vec::new());
426426
}
@@ -477,7 +477,9 @@ where
477477
chc::Term::FormulaExistentialVar(sort.clone(), ident.name.to_string());
478478
FormulaOrTerm::Term(var, sort.clone())
479479
}
480-
_ => {
480+
_ => {
481+
// If the single-segment identifier is followed by parethesized arguments,
482+
// parse them as user-defined predicate calls.
481483
let next_tt = self.look_ahead_token_tree(0);
482484

483485
if let Some(TokenTree::Delimited(_, _, Delimiter::Parenthesis, args)) = next_tt {
@@ -492,7 +494,7 @@ where
492494
cursor: args.trees(),
493495
formula_existentials: self.formula_existentials.clone(),
494496
};
495-
let args = parser.parse_datatype_ctor_args()?;
497+
let args = parser.parse_arg_terms()?;
496498

497499
let atom = chc::Atom::new(pred, args);
498500
let formula = chc::Formula::Atom(atom);
@@ -517,7 +519,7 @@ where
517519
cursor: s.trees(),
518520
formula_existentials: self.formula_existentials.clone(),
519521
};
520-
let args = parser.parse_datatype_ctor_args()?;
522+
let args = parser.parse_arg_terms()?;
521523
parser.end_of_input()?;
522524
let (term, sort) = path.to_datatype_ctor(args);
523525
FormulaOrTerm::Term(term, sort)

src/chc.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -902,7 +902,6 @@ impl MatcherPred {
902902
}
903903
}
904904

905-
// TODO: This struct is almost copy of `DatatypeSymbol`. Two traits maight be unified with aliases.
906905
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
907906
pub struct UserDefinedPredSymbol {
908907
inner: String,
@@ -1035,7 +1034,7 @@ impl Pred {
10351034
Pred::Known(p) => p.name().into(),
10361035
Pred::Var(p) => p.to_string().into(),
10371036
Pred::Matcher(p) => p.name().into(),
1038-
Pred::UserDefined(p) => p.inner.clone().into(),
1037+
Pred::UserDefined(p) => p.to_string().into(),
10391038
}
10401039
}
10411040

0 commit comments

Comments
 (0)