From d5b6bcb035bf5150965129adee741740b7490883 Mon Sep 17 00:00:00 2001 From: Jan Wielemaker Date: Mon, 2 Dec 2024 11:04:10 +0100 Subject: [PATCH] ENHANCED: gui tracer support for `Head ==> Body` rules. --- library/prolog_clause.pl | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/library/prolog_clause.pl b/library/prolog_clause.pl index 691f1cf2ee..6dfc57e54a 100644 --- a/library/prolog_clause.pl +++ b/library/prolog_clause.pl @@ -3,7 +3,7 @@ Author: Jan Wielemaker E-mail: J.Wielemaker@vu.nl WWW: http://www.swi-prolog.org - Copyright (c) 2005-2023, University of Amsterdam + Copyright (c) 2005-2024, University of Amsterdam VU University Amsterdam CWI, Amsterdam SWI-Prolog Solutions b.v. @@ -280,8 +280,10 @@ functor(Bindings, varnames, L), do_make_varnames(Offsets, Names, Bindings). -dcg_head((Head --> _Body), Head). -dcg_head((Head ==> _Body), Head). +dcg_head((Head,_ --> _Body), Head). +dcg_head((Head --> _Body), Head). +dcg_head((Head,_ ==> _Body), Head). +dcg_head((Head ==> _Body), Head). do_make_varnames([], _, _). do_make_varnames([N=Var|TO], Names, Bindings) :- @@ -405,6 +407,12 @@ unify_clause((Head => Body), Compiled1, Module, TermPos0, TermPos) :- !, unify_clause2((Head :- Body), Compiled1, Module, TermPos0, TermPos). +unify_clause(Read, Compiled1, Module, TermPos0, TermPos) :- + Read = (_ ==> _), + ci_expand(Read, Compiled2, Module, TermPos0, TermPos1), + Compiled2 \= (_ ==> _), + !, + unify_clause(Compiled2, Compiled1, Module, TermPos1, TermPos). unify_clause(Read, Decompiled, Module, TermPos0, TermPos) :- unify_clause2(Read, Decompiled, Module, TermPos0, TermPos).