Skip to content

Commit

Permalink
print_compound_type uses prolog_term_start/1
Browse files Browse the repository at this point in the history
  • Loading branch information
TeamSPoon committed Dec 28, 2024
1 parent ad7b8e1 commit 4366e68
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions prolog/metta_lang/metta_parser.pl
Original file line number Diff line number Diff line change
Expand Up @@ -872,17 +872,17 @@
read_list(')', Stream, Item).

% If '[', read an S-expression list.
cont_sexpr_from_char(_EndChar, Stream, '[', Item) :- prolog_term_char('['),
cont_sexpr_from_char(_EndChar, Stream, '[', Item) :- prolog_term_start('['),
read_list(']', Stream, List),
univ_list_to_item(List,Item).

% If '[', read an S-expression list.
cont_sexpr_from_char(_EndChar, Stream, '{', Item) :- prolog_term_char('{'),
cont_sexpr_from_char(_EndChar, Stream, '{', Item) :- prolog_term_start('{'),
read_list('}', Stream, List),
univ_list_to_item(List,Item).

% If '[', '{', etc. - using paren_pair
cont_sexpr_from_char(_EndChar, Stream, Char, Item) :- paren_pair(Char, EndOfParen, Functor),
% If '[', '{', etc. - using paren_pair_functor
cont_sexpr_from_char(_EndChar, Stream, Char, Item) :- paren_pair_functor(Char, EndOfParen, Functor),
read_list(EndOfParen, Stream, It3m),
Item = [Functor, It3m].

Expand All @@ -892,7 +892,7 @@
univ_maybe_var(Item, Subr).

% Unexpected start character
cont_sexpr_from_char(EndChar, Stream, Char, Item) :- paren_pair(_, Char, _),
cont_sexpr_from_char(EndChar, Stream, Char, Item) :- paren_pair_functor(_, Char, _),
nb_current('$file_src_depth', 0),
sformat(Reason, "Unexpected start character: '~w'", [Char]),
throw_stream_error(Stream, syntax_error(unexpected_char(Char), Reason)),
Expand Down Expand Up @@ -932,7 +932,7 @@

univ_list_to_item([H|List],Item):- is_list(List),atom(H),!,compound_name_arguments(Item,H,List).
univ_list_to_item([H|List],Item):- is_list(List), \+ atom(H),!,Item=..['holds',H|List].
univ_list_to_item(Else,Item):- prolog_term_char(S), paren_pair(S,_,Functor), !, Item = [Functor,Else].
univ_list_to_item(Else,Item):- prolog_term_start(S), paren_pair_functor(S,_,Functor), !, Item = [Functor,Else].
univ_list_to_item(Else,Item):- Item = ['???',Else].

can_do_level(0).
Expand Down

0 comments on commit 4366e68

Please sign in to comment.