@@ -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)
0 commit comments