From: Eshel Yaron Date: Sat, 2 Dec 2023 16:04:25 +0000 (+0100) Subject: ; Fix error with documentation at point for atom non-terminals X-Git-Tag: V9.1.21-sweep-0.27.3~4 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=4b3d29826713fbacf93ab5d5147130b3e34ec5bd;p=sweep.git ; Fix error with documentation at point for atom non-terminals * sweep.pl (explicit_args_/3): Check whether G0 is an atom. * sweeprolog-tests.el (eldoc-dcg-atom): Test it. --- diff --git a/sweep.pl b/sweep.pl index 9db524d..48bf4b1 100644 --- a/sweep.pl +++ b/sweep.pl @@ -436,7 +436,10 @@ explicit_args_(0, G, G) :- atom(G), !. explicit_args_(N, G0, G) :- - compound_name_arguments(G0, F, A0), + ( atom(G0) + -> F = G0, A0 = [] + ; compound_name_arguments(G0, F, A0) + ), length(A1, N), append(A0, A1, A), compound_name_arguments(G, F, A). diff --git a/sweeprolog-tests.el b/sweeprolog-tests.el index 096a8e1..c3897e6 100644 --- a/sweeprolog-tests.el +++ b/sweeprolog-tests.el @@ -2412,4 +2412,19 @@ foo(Bar) --> baz(Bar). Doit. " (cons 4 15))))) +(sweeprolog-deftest eldoc-dcg-atom () + "Test `sweep_short_documentation/2' with atom non-terminals." + " +:- module(eldocdcgatom, []). + +:- use_module(library(dcg/basics)). +" + (should (equal (sweeprolog--query-once + "sweep" "sweep_short_documentation" + (list "bar --> blanks." 9 (buffer-file-name))) + (list "dcg_basics:blanks//0" "blanks// is det. + Skip zero or more white-space characters. +" nil)))) + + ;;; sweeprolog-tests.el ends here