YAP
7.1.0
Toggle main menu visibility
Main Page
Related Pages
Modules
Classes
Class List
Class Index
Class Hierarchy
Class Members
All
a
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
y
~
Functions
a
c
d
e
f
g
h
i
l
m
n
o
p
q
r
s
t
u
v
y
~
Variables
a
c
e
f
g
i
k
m
n
o
p
q
r
s
t
v
Files
File List
File Members
All
a
b
c
d
e
f
g
h
i
j
l
m
n
o
p
r
s
t
u
v
w
y
Functions
c
e
m
y
Variables
Typedefs
Enumerations
Enumerator
a
b
c
d
e
f
g
h
i
j
l
m
n
o
p
r
s
t
u
v
w
y
Macros
•
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
%
22
completions(
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
32
strip_final_tokens([
'EOT'
|
Ts
],
Ts
)
:-
strip_final_tokens.
33
strip_final_tokens(
Ts
,
Ts
).
34
35
%B = l,
%D=l,
%B = l,
%D=l,
%B = l,
%B = l,
close/1
close(+ S)
reverse/2
reverse(+ List, ? Reversed)
Definition:
swi.yap:52
scan_to_list/2
scan_to_list( +Stream, -Tokens )
use_module/1
use_module( +Files )
setof/3
setof( X,+ P,- B)
library
completer.yap
Generated by
1.9.3