This commit is contained in:
Vitor Santos Costa
2017-09-06 01:09:46 +01:00
parent a115024aee
commit abdc8a35f9
31 changed files with 579 additions and 815 deletions

View File

@@ -35,38 +35,69 @@ completions(S, Self) :-
strip_final_tokens(['EOT'|Ts], Ts) :- !.
strip_final_tokens( Ts, Ts ).
complete( [atom(F)|LibRest], C) :-
LibRest = [l, atom(Where)|Consult],
isconsult(Consult, Rest),
strip_final_tokens( Ts, Ts ).|_],
complete([E,l,C,l,A|More],
isconsult(A),
%B = l,
library(C,Lib),
%D=l,
E=atom(Prefix),
\+ arg( Rest ),
check_library( F, Where, C).
complete( [atom(F)|Consult], C) :-
isconsult(Consult, Rest),
check_library( Prefix, Lib, C).
complete([E,l,C,l,-,'['|More],
isconsult(A),
%B = l,
library(C,Lib),
%D=l,
E=atom(Prefix),
\+ arg( Rest ),
check_file( F, C).
check_library( Prefix, Lib, C).
complete([C,l,A|More],
isconsult(A),
%B = l,
C=atom(Prefix),
\+ arg( Rest ),
file_or_library( Prefix, C).
complete([C,l,-,'['|More],
isconsult(A),
%B = l,
C=atom(Prefix),
\+ arg( Rest ),
file_or_library( Prefix, C).
complete( [atom(F)|Rest], C) :-
\+ arg( Rest ),
predicate( F, Pred, Arity ),
cont( Arity, F, Pred, C).
isconsult( [l, use_module| Rest], Rest).
isconsult( [l, ensure_loaded| Rest], Rest).
isconsult( [l, compile| Rest], Rest).
isconsult( [l, consult| Rest], Rest).
isconsult( [l, reconsult| Rest], Rest).
isconsult( [l, load_files| Rest], Rest).
isconsult( ['-', ']'| Rest], Rest).
isconsult( [']'| Rest], Rest ).
isconsult( atom(use_module) ).
isconsult( atom(ensure_loaded) ).
isconsult( atom(compile) ).
isconsult( atom(consult) ).
isconsult( atom(reconsult) ).
isconsult( atom(load_files) ).
isconsult( '[' ).
arg([']'|_]).
arg([l|_]).
check_file(F,C) :-
fileerrors-or_library(F,C) :-
libsym(C0),
atom_cooncat(F,C,Co).
fileerrors-or_library(F,C) :-
check_file(F0,C).
check_file(F0,C) :-
atom_concat('\'',F,F0),
!,
absolute_file_name( F, FF, [access(none)] ),
atom_concat( F, '*' , Pat),
absolute_file_name( Pat, C0, [glob(true)] ),
atom_concat(['\'',C0,'\''], C).
atom_concat(Pat,C00,C0),
atom_conct(C00,'\'',C).
check_file(F0,C) :-
atom_concat( F, '*' , Pat),
absolute_file_name( Pat, C0, [glob(true)] ),
atom_concat(Pat,C,C0).
check_library( Lib, F, C) :-
atom_concat( F, '*' , Pat),