@@ 307,6 307,16 @@ sweep_short_documentation_head(brace_term_position(Beg, End, _), Head, Neck, Poi
; Arg = 0
),
sweep_short_documentation_(FileName, Mod, Head, Arg, Neck, PIString, Doc, ArgSpan).
+sweep_short_documentation_head(term_position(_, _, _, _, [HeadPos, GuardPos]), (Head,Guard), Neck, Point, FileName, Mod, PIString, Doc, ArgSpan) :-
+ % SSU guard or DCG pushback
+ !,
+ ( pos_bounds(HeadPos, HeadBeg, HeadEnd),
+ HeadBeg =< Point, Point =< HeadEnd
+ -> sweep_short_documentation_head(HeadPos, Head, Neck, Point, FileName, Mod, PIString, Doc, ArgSpan)
+ ; pos_bounds(GuardPos, GuardBeg, GuardEnd),
+ GuardBeg =< Point, Point =< GuardEnd
+ -> sweep_short_documentation_body(GuardPos, Guard, Neck, Point, FileName, Mod, PIString, Doc, ArgSpan)
+ ).
sweep_short_documentation_head(term_position(_, _, _, _, [_, Pos]), Mod:Head, Neck, Point, FileName, _, PIString, Doc, ArgSpan) :-
!,
sweep_short_documentation_head(Pos, Head, Neck, Point, FileName, Mod, PIString, Doc, ArgSpan).
@@ 1488,6 1498,7 @@ source_arg(load_files, 1).
source_arg(use_module, 1).
source_arg(consult, 1).
source_arg(ensure_loaded, 1).
+source_arg(process_create, 1).
callable_arg(N, N) :- integer(N), !.
callable_arg((^), 0) :- !.
@@ 1846,6 1846,21 @@ body.
head,
right_hand_context -->
body.
+")
+ (sweeprolog-test-indentation
+ "/** <module> Foo
+
+This module provides foo bar
+ baz spam
+ foo bar baz
+*/
+"
+ "/** <module> Foo
+
+This module provides foo bar
+baz spam
+foo bar baz
+*/
"))
(sweeprolog-deftest forward-sexp-with-adjacent-operators ()
@@ 2426,5 2441,42 @@ foo(Bar) --> baz(Bar).
Skip zero or more white-space characters.
" nil))))
+(sweeprolog-deftest eldoc-ssu-guard ()
+ "Test `sweep_short_documentation/2' with SSU guard."
+ "
+:- module(eldocssuguard, []).
+
+:- use_module(library(lists)).
+"
+ (should (equal (sweeprolog--query-once
+ "sweep" "sweep_short_documentation"
+ (list "foo(X), member(X,_) => true." 15 (buffer-file-name)))
+ '("lists:member/2" "member(?Elem,?List) is unspec.
+ True if Elem is a member of List.
+"
+ (7 . 12)))))
+
+
+(sweeprolog-deftest eldoc-dcg-pushback ()
+ "Test `sweep_short_documentation/2' with DCG pushback list."
+ "
+:- module(eldocdcgpushback, []).
+
+%! foo(-Baz:string)// is det.
+%
+% Doit.
+
+foo(_) --> [].
+
+"
+ (should (equal (sweeprolog--query-once
+ "sweep" "sweep_short_documentation"
+ (list "foo(X), [1,2,3] --> []." 5 (buffer-file-name)))
+ '("eldocdcgpushback:foo//1" "foo(-Baz:string)// is det.
+ Doit.
+"
+ (4 . 15)))))
+
+
;;; sweeprolog-tests.el ends here