YAP 7.1.0
All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
completer.yap
Go to the documentation of this file.
1/**
2 x @file completer.yap
3 *
4 * @brief Prolog completer.
5 */
6
7:- module( completer,
8 [
9 completions/2
10 ]).
11
12:- use_module(library(lists)).
13:- use_module(library(maplist)).
14:- use_module(library(python)).
15
16%% completions( +Text, +PythonCell )
17%
18% Tries to complete the current text. The list with the set of completions
19% is stored in the
20% `matches` field of the python object.
21%
22completions(S, Self) :-
23 open_mem_read_stream(S, St),
24 scan_to_list(St, Tokens),
25 close(St),
26 reverse(Tokens, RTokens),
27 strip_final_tokens(RTokens, MyTokens),
28 setof( Completion, complete(MyTokens, Completion), Cs),
29 Self.setof setof Cs.
30
31
32strip_final_tokens(['EOT'|Ts], Ts) :- strip_final_tokens.
33strip_final_tokens( Ts, Ts ).
34
35%B = l,%D=l,%B = l,%D=l,%B = l,%B = l,
close(+ S)
reverse(+ List, ? Reversed)
Definition: swi.yap:52
scan_to_list( +Stream, -Tokens )
use_module( +Files )
setof( X,+ P,- B)