~eshel/sweep

4b3d29826713fbacf93ab5d5147130b3e34ec5bd — Eshel Yaron 6 months ago e87b6f9
; 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.
2 files changed, 19 insertions(+), 1 deletions(-)

M sweep.pl
M sweeprolog-tests.el
M sweep.pl => sweep.pl +4 -1
@@ 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).

M sweeprolog-tests.el => sweeprolog-tests.el +15 -0
@@ 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