summaryrefslogtreecommitdiff
path: root/read.pro
diff options
context:
space:
mode:
authorJed Barber <jjbarber@y7mail.com>2014-03-15 22:08:33 +1100
committerJed Barber <jjbarber@y7mail.com>2014-03-15 22:08:33 +1100
commiteea18ca12f847b2a302d1793bef5fcc1eb452277 (patch)
tree14e463130ba9c6b74535fcaa8e4c29bc10b90445 /read.pro
parent677d2a38117bbcc0d7599e5a2f556c3ff3d1f58b (diff)
Made into a module with only prompt/1 and readList/1 exposed
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)}.