]> git.eshelyaron.com Git - sweep.git/commitdiff
; Fix error with documentation at point for atom non-terminals
authorEshel Yaron <me@eshelyaron.com>
Sat, 2 Dec 2023 16:04:25 +0000 (17:04 +0100)
committerEshel Yaron <me@eshelyaron.com>
Sat, 2 Dec 2023 16:46:38 +0000 (17:46 +0100)
* sweep.pl (explicit_args_/3): Check whether G0 is an atom.
* sweeprolog-tests.el (eldoc-dcg-atom): Test it.

sweep.pl
sweeprolog-tests.el

index 9db524d806833281894893ddd6ebfe1195c0de44..48bf4b1df5bbcda0978e19e8539c4c283f3fa4b0 100644 (file)
--- 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).
index 096a8e1af7fc334da5af57c9b213fdac060592bc..c3897e6e50cffc5fd794e76a4c2a3aca6affe179 100644 (file)
@@ -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