summaryrefslogtreecommitdiff
path: root/read.pro
diff options
context:
space:
mode:
Diffstat (limited to 'read.pro')
-rw-r--r--read.pro12
1 files changed, 7 insertions, 5 deletions
diff --git a/read.pro b/read.pro
index a554a22..35bfb52 100644
--- a/read.pro
+++ b/read.pro
@@ -1,4 +1,6 @@
+:- module(read, [prompt/1, readList/1]).
+
% functions for obtaining a line of input text and parsing
% it into a list of words
@@ -19,19 +21,19 @@ readList(L) :-
readLine(L) :-
get0(C),
- buildList(C,L).
+ buildLine(C,L).
-buildList(10,[]) :- !.
-buildList(C,[C|X]) :-
+buildLine(10,[]) :- !.
+buildLine(C,[C|X]) :-
get0(C2),
- buildList(C2,X).
+ buildLine(C2,X).
wordList([X|Y]) --> word(X), whitespace, wordList(Y).
wordList([X]) --> whitespace, wordList(X).
wordList([X]) --> word(X).
-wordList([X]) --> whitespace, word(X).
+wordList([X]) --> word(X), whitespace.
word(W) --> charList(X), {name(W,X)}.