4
%% Copyright Ericsson AB 1996-2009. All Rights Reserved.
4
%% Copyright Ericsson AB 1996-2010. All Rights Reserved.
6
6
%% The contents of this file are subject to the Erlang Public License,
7
7
%% Version 1.1, (the "License"); you may not use this file except in
8
8
%% compliance with the License. You should have received a copy of the
9
9
%% Erlang Public License along with this software. If not, it can be
10
10
%% retrieved online at http://www.erlang.org/.
12
12
%% Software distributed under the License is distributed on an "AS IS"
13
13
%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
14
14
%% the License for the specific language governing rights and limitations
15
15
%% under the License.
24
24
-export([init/0,start/1,edit_line/2,prefix_arg/1]).
25
25
-export([erase_line/1,erase_inp/1,redraw_line/1]).
26
26
-export([length_before/1,length_after/1,prompt/1]).
27
-export([current_line/1]).
27
28
%%-export([expand/1]).
29
30
-export([edit_line1/2]).
31
32
-import(lists, [reverse/1, reverse/2]).
33
%-import([nthtail/2, keysearch/3, prefix/2]).
35
34
-export([over_word/3]).
281
280
%% Step over word/non-word characters pushing the stepped over ones on
284
over_word([C|Cs], Stack, N) ->
284
over_word(Cs, Stack, N) ->
285
L = length([1 || $\' <- Cs]),
288
over_word1(Cs, Stack, N);
290
until_quote(Cs, Stack, N)
293
until_quote([$\'|Cs], Stack, N) ->
294
{Cs, [$\'|Stack], N+1};
295
until_quote([C|Cs], Stack, N) ->
296
until_quote(Cs, [C|Stack], N+1).
298
over_word1([$\'=C|Cs], Stack, N) ->
299
until_quote(Cs, [C|Stack], N+1);
300
over_word1(Cs, Stack, N) ->
301
over_word2(Cs, Stack, N).
303
over_word2([C|Cs], Stack, N) ->
285
304
case word_char(C) of
286
true -> over_word(Cs, [C|Stack], N+1);
305
true -> over_word2(Cs, [C|Stack], N+1);
287
306
false -> {[C|Cs],Stack,N}
289
over_word([], Stack, N) when is_integer(N) ->
308
over_word2([], Stack, N) when is_integer(N) ->
292
311
over_non_word([C|Cs], Stack, N) ->
429
449
prompt({line,Pbs,_,_}) ->
452
current_line({line,_,{Bef, Aft},_}) ->
453
reverse(Bef, Aft ++ "\n").
432
455
%% %% expand(CurrentBefore) ->
433
456
%% %% {yes,Expansion} | no
434
457
%% %% Try to expand the word before as either a module name or a function
456
479
%% case erlang:module_loaded(Mod) of
458
481
%% L = apply(Mod, module_info, []),
459
%% case keysearch(exports, 1, L) of
460
%% {value, {_, Exports}} ->
482
%% case lists:keyfind(exports, 1, L) of
461
484
%% match(FuncPrefix, Exports, "(");
473
496
%% print_matches(Matches),
475
498
%% {partial, Str} ->
476
%% case nthtail(length(Prefix), Str) of
499
%% case lists:nthtail(length(Prefix), Str) of
478
501
%% print_matches(Matches),