commit dae5e3f1f3df14b8e3945ebc11c96fafebfe481c
parent d76cee3eee656547ee497be4d4f68e73f2c60b24
Author: Alexander Burger <abu@software-lab.de>
Date: Fri, 5 Jul 2013 22:32:14 +0200
'read' and REPL comments
Diffstat:
11 files changed, 349 insertions(+), 266 deletions(-)
diff --git a/ersatz/fun.src b/ersatz/fun.src
@@ -1,4 +1,4 @@
-# 06may13abu
+# 05jul13abu
# (c) Software Lab. Alexander Burger
# Ersatz PicoLisp Functions
@@ -3316,7 +3316,7 @@ char (x)
# (skip ['any]) -> sym
skip (c)
- return InFile.skip(firstChar(ex.Cdr.Car.eval())) < 0? Nil : mkChar(InFile.Chr);
+ return InFile.skipc(firstChar(ex.Cdr.Car.eval())) < 0? Nil : mkChar(InFile.Chr);
# (eol) -> flg
eol ()
diff --git a/ersatz/picolisp.jar b/ersatz/picolisp.jar
Binary files differ.
diff --git a/ersatz/sys.src b/ersatz/sys.src
@@ -1,4 +1,4 @@
-// 31jan13abu
+// 05jul13abu
// (c) Software Lab. Alexander Burger
import java.util.*;
@@ -477,8 +477,19 @@ public class PicoLisp {
OutFile.Wr.flush();
}
y = InFile.read('\n');
- if (InFile.Chr == '\n')
- InFile.Chr = 0;
+ while (InFile.Chr > 0) {
+ if (InFile.Chr == '\n') {
+ InFile.Chr = 0;
+ break;
+ }
+ if (InFile.Chr == '#')
+ InFile.comment();
+ else {
+ if (InFile.Chr > ' ')
+ break;
+ InFile.get();
+ }
+ }
}
if (y == Nil) {
Env.Intern = ns;
@@ -1387,10 +1398,10 @@ public class PicoLisp {
return false;
}
- final int skip(int c) {
+ final int skipc(int c) {
+ if (Chr < 0)
+ return Chr;
for (;;) {
- if (Chr < 0)
- return Chr;
while (Chr <= ' ') {
get();
if (Chr < 0)
@@ -1399,26 +1410,50 @@ public class PicoLisp {
if (Chr != c)
return Chr;
get();
- if (c != '#' || Chr != '{') {
- while (Chr != '\n') {
- if (Chr < 0)
- return Chr;
- get();
- }
+ while (Chr != '\n') {
+ if (Chr < 0)
+ return Chr;
+ get();
}
- else {
- for (;;) {
- get();
- if (Chr < 0)
- return Chr;
- if (Chr == '}' && (get() == '#'))
- break;
- }
+ }
+ }
+
+ final void comment() {
+ get();
+ if (Chr != '{') {
+ while (Chr != '\n') {
+ if (Chr < 0)
+ return;
+ get();
+ }
+ }
+ else {
+ for (;;) {
+ get();
+ if (Chr < 0)
+ return;
+ if (Chr == '}' && (get() == '#'))
+ break;
}
get();
}
}
+ final int skip() {
+ for (;;) {
+ if (Chr < 0)
+ return Chr;
+ while (Chr <= ' ') {
+ get();
+ if (Chr < 0)
+ return Chr;
+ }
+ if (Chr != '#')
+ return Chr;
+ comment();
+ }
+ }
+
final boolean testEsc() {
for (;;) {
if (Chr < 0)
@@ -1475,7 +1510,7 @@ public class PicoLisp {
Any x, res;
get();
for (;;) {
- if (skip('#') == ')') {
+ if (skip() == ')') {
get();
return Nil;
}
@@ -1493,7 +1528,7 @@ public class PicoLisp {
}
}
for (;;) {
- if (skip('#') == ')') {
+ if (skip() == ')') {
get();
break;
}
@@ -1502,8 +1537,8 @@ public class PicoLisp {
if (Chr == '.') {
get();
if (Delim.indexOf(Chr) >= 0) {
- x.Cdr = skip('#')==')' || Chr==']'? res : read0(false);
- if (skip('#') == ')')
+ x.Cdr = skip()==')' || Chr==']'? res : read0(false);
+ if (skip() == ')')
get();
else if (Chr != ']')
err(null, x, "Bad dotted pair");
@@ -1525,7 +1560,7 @@ public class PicoLisp {
final Any read0(boolean top) {
Any x, y;
- if (skip('#') < 0) {
+ if (skip() < 0) {
if (top)
return Nil;
eofErr();
@@ -1592,16 +1627,13 @@ public class PicoLisp {
get();
if (Chr == end)
return Nil;
- Any x = read0(true);
- while (Chr != 0 && " \t)]".indexOf(Chr) >= 0)
- get();
- return x;
+ return read0(true);
}
final Any token(Any x, char c) {
if (Chr == 0)
get();
- if (skip(c) < 0)
+ if (skipc(c) < 0)
return null;
if (Chr == '"') {
get();
diff --git a/lib/map b/lib/map
@@ -29,7 +29,7 @@ adr (597 . "@src64/main.l")
alarm (477 . "@src64/main.l")
all (788 . "@src64/sym.l")
and (1624 . "@src64/flow.l")
-any (3990 . "@src64/io.l")
+any (3995 . "@src64/io.l")
append (1339 . "@src64/subr.l")
apply (713 . "@src64/apply.l")
arg (2614 . "@src64/main.l")
@@ -83,12 +83,12 @@ cdddr (245 . "@src64/subr.l")
cddr (79 . "@src64/subr.l")
cdr (17 . "@src64/subr.l")
chain (1142 . "@src64/subr.l")
-char (3472 . "@src64/io.l")
+char (3477 . "@src64/io.l")
chop (1228 . "@src64/sym.l")
circ (817 . "@src64/subr.l")
circ? (2403 . "@src64/subr.l")
clip (1800 . "@src64/subr.l")
-close (4403 . "@src64/io.l")
+close (4422 . "@src64/io.l")
cmd (3233 . "@src64/main.l")
cnt (1413 . "@src64/apply.l")
co (2548 . "@src64/flow.l")
@@ -99,7 +99,7 @@ cond (1919 . "@src64/flow.l")
connect (227 . "@src64/net.l")
cons (747 . "@src64/subr.l")
copy (1226 . "@src64/subr.l")
-ctl (4276 . "@src64/io.l")
+ctl (4295 . "@src64/io.l")
ctty (3019 . "@src64/main.l")
cut (1931 . "@src64/sym.l")
date (2728 . "@src64/main.l")
@@ -116,14 +116,14 @@ dir (3163 . "@src64/main.l")
dm (545 . "@src64/flow.l")
do (2141 . "@src64/flow.l")
e (2984 . "@src64/flow.l")
-echo (4434 . "@src64/io.l")
+echo (4453 . "@src64/io.l")
env (609 . "@src64/main.l")
-eof (3549 . "@src64/io.l")
-eol (3540 . "@src64/io.l")
-err (4256 . "@src64/io.l")
+eof (3554 . "@src64/io.l")
+eol (3545 . "@src64/io.l")
+err (4275 . "@src64/io.l")
errno (1614 . "@src64/main.l")
eval (175 . "@src64/flow.l")
-ext (5168 . "@src64/io.l")
+ext (5187 . "@src64/io.l")
ext? (1166 . "@src64/sym.l")
extern (1032 . "@src64/sym.l")
extra (1269 . "@src64/flow.l")
@@ -138,13 +138,13 @@ find (1322 . "@src64/apply.l")
fish (1613 . "@src64/apply.l")
flg? (2446 . "@src64/subr.l")
flip (1700 . "@src64/subr.l")
-flush (5143 . "@src64/io.l")
+flush (5162 . "@src64/io.l")
fold (3521 . "@src64/sym.l")
for (2230 . "@src64/flow.l")
fork (3297 . "@src64/flow.l")
format (2089 . "@src64/big.l")
free (1960 . "@src64/db.l")
-from (3568 . "@src64/io.l")
+from (3573 . "@src64/io.l")
full (1076 . "@src64/subr.l")
fun? (750 . "@src64/sym.l")
gc (449 . "@src64/gc.l")
@@ -157,14 +157,14 @@ gt0 (2718 . "@src64/big.l")
hash (2976 . "@src64/big.l")
head (1821 . "@src64/subr.l")
heap (523 . "@src64/main.l")
-hear (3253 . "@src64/io.l")
+hear (3258 . "@src64/io.l")
host (193 . "@src64/net.l")
id (1028 . "@src64/db.l")
idx (2171 . "@src64/sym.l")
if (1805 . "@src64/flow.l")
if2 (1824 . "@src64/flow.l")
ifn (1865 . "@src64/flow.l")
-in (4216 . "@src64/io.l")
+in (4235 . "@src64/io.l")
inc (2256 . "@src64/big.l")
index (2638 . "@src64/subr.l")
info (3056 . "@src64/main.l")
@@ -173,7 +173,7 @@ ipid (3242 . "@src64/flow.l")
isa (967 . "@src64/flow.l")
job (1429 . "@src64/flow.l")
journal (971 . "@src64/db.l")
-key (3401 . "@src64/io.l")
+key (3406 . "@src64/io.l")
kill (3274 . "@src64/flow.l")
last (2045 . "@src64/subr.l")
le0 (2693 . "@src64/big.l")
@@ -181,14 +181,14 @@ length (2742 . "@src64/subr.l")
let (1479 . "@src64/flow.l")
let? (1540 . "@src64/flow.l")
lieu (1157 . "@src64/db.l")
-line (3724 . "@src64/io.l")
-lines (3877 . "@src64/io.l")
+line (3729 . "@src64/io.l")
+lines (3882 . "@src64/io.l")
link (1173 . "@src64/subr.l")
lisp (2283 . "@src64/main.l")
list (888 . "@src64/subr.l")
listen (160 . "@src64/net.l")
lit (150 . "@src64/flow.l")
-load (4193 . "@src64/io.l")
+load (4212 . "@src64/io.l")
lock (1185 . "@src64/db.l")
loop (2173 . "@src64/flow.l")
low? (3387 . "@src64/sym.l")
@@ -238,30 +238,30 @@ offset (2678 . "@src64/subr.l")
on (1717 . "@src64/sym.l")
onOff (1747 . "@src64/sym.l")
one (1780 . "@src64/sym.l")
-open (4360 . "@src64/io.l")
+open (4379 . "@src64/io.l")
opid (3258 . "@src64/flow.l")
opt (3354 . "@src64/main.l")
or (1640 . "@src64/flow.l")
-out (4236 . "@src64/io.l")
+out (4255 . "@src64/io.l")
pack (1279 . "@src64/sym.l")
pair (2395 . "@src64/subr.l")
pass (754 . "@src64/apply.l")
pat? (736 . "@src64/sym.l")
path (1270 . "@src64/io.l")
-peek (3456 . "@src64/io.l")
+peek (3461 . "@src64/io.l")
pick (1369 . "@src64/apply.l")
-pipe (4297 . "@src64/io.l")
-poll (3345 . "@src64/io.l")
+pipe (4316 . "@src64/io.l")
+poll (3350 . "@src64/io.l")
pool (651 . "@src64/db.l")
pop (1907 . "@src64/sym.l")
port (5 . "@src64/net.l")
-pr (5251 . "@src64/io.l")
+pr (5270 . "@src64/io.l")
pre? (1545 . "@src64/sym.l")
-prin (5067 . "@src64/io.l")
-prinl (5081 . "@src64/io.l")
-print (5107 . "@src64/io.l")
-println (5138 . "@src64/io.l")
-printsp (5123 . "@src64/io.l")
+prin (5086 . "@src64/io.l")
+prinl (5100 . "@src64/io.l")
+print (5126 . "@src64/io.l")
+println (5157 . "@src64/io.l")
+printsp (5142 . "@src64/io.l")
prior (2714 . "@src64/subr.l")
prog (1760 . "@src64/flow.l")
prog1 (1768 . "@src64/flow.l")
@@ -281,12 +281,12 @@ rand (3003 . "@src64/big.l")
range (998 . "@src64/subr.l")
rank (3049 . "@src64/subr.l")
raw (455 . "@src64/main.l")
-rd (5185 . "@src64/io.l")
-read (2665 . "@src64/io.l")
+rd (5204 . "@src64/io.l")
+read (2670 . "@src64/io.l")
replace (1500 . "@src64/subr.l")
rest (2643 . "@src64/main.l")
reverse (1679 . "@src64/subr.l")
-rewind (5151 . "@src64/io.l")
+rewind (5170 . "@src64/io.l")
rollback (1803 . "@src64/db.l")
rot (849 . "@src64/subr.l")
run (306 . "@src64/flow.l")
@@ -299,33 +299,33 @@ set (1616 . "@src64/sym.l")
setq (1649 . "@src64/sym.l")
sigio (493 . "@src64/main.l")
size (2809 . "@src64/subr.l")
-skip (3526 . "@src64/io.l")
+skip (3531 . "@src64/io.l")
sort (3978 . "@src64/subr.l")
sp? (727 . "@src64/sym.l")
-space (5085 . "@src64/io.l")
+space (5104 . "@src64/io.l")
split (1593 . "@src64/subr.l")
stack (552 . "@src64/main.l")
state (2009 . "@src64/flow.l")
stem (1990 . "@src64/subr.l")
-str (4044 . "@src64/io.l")
+str (4049 . "@src64/io.l")
str? (1145 . "@src64/sym.l")
strip (1577 . "@src64/subr.l")
struct (2074 . "@src64/main.l")
sub? (1578 . "@src64/sym.l")
sum (1460 . "@src64/apply.l")
super (1225 . "@src64/flow.l")
-sym (4030 . "@src64/io.l")
+sym (4035 . "@src64/io.l")
sym? (2435 . "@src64/subr.l")
symbols (942 . "@src64/sym.l")
-sync (3213 . "@src64/io.l")
+sync (3218 . "@src64/io.l")
sys (856 . "@src64/main.l")
t (1751 . "@src64/flow.l")
tail (1912 . "@src64/subr.l")
-tell (3285 . "@src64/io.l")
+tell (3290 . "@src64/io.l")
text (1407 . "@src64/sym.l")
throw (2493 . "@src64/flow.l")
tick (3210 . "@src64/flow.l")
-till (3635 . "@src64/io.l")
+till (3640 . "@src64/io.l")
time (2861 . "@src64/main.l")
touch (1181 . "@src64/sym.l")
trail (708 . "@src64/main.l")
@@ -343,12 +343,12 @@ use (1573 . "@src64/flow.l")
usec (2965 . "@src64/main.l")
val (1597 . "@src64/sym.l")
version (3368 . "@src64/main.l")
-wait (3175 . "@src64/io.l")
+wait (3180 . "@src64/io.l")
when (1884 . "@src64/flow.l")
while (2061 . "@src64/flow.l")
wipe (3262 . "@src64/sym.l")
with (1332 . "@src64/flow.l")
-wr (5268 . "@src64/io.l")
+wr (5287 . "@src64/io.l")
xchg (1672 . "@src64/sym.l")
xor (1701 . "@src64/flow.l")
x| (2887 . "@src64/big.l")
diff --git a/src/io.c b/src/io.c
@@ -1,4 +1,4 @@
-/* 23feb13abu
+/* 05jul13abu
* (c) Software Lab. Alexander Burger
*/
@@ -996,10 +996,10 @@ int getChar(void) {
}
/* Skip White Space and Comments */
-static int skip(int c) {
+static int skipc(int c) {
+ if (Chr < 0)
+ return Chr;
for (;;) {
- if (Chr < 0)
- return Chr;
while (Chr <= ' ') {
Env.get();
if (Chr < 0)
@@ -1008,26 +1008,50 @@ static int skip(int c) {
if (Chr != c)
return Chr;
Env.get();
- if (c != '#' || Chr != '{') {
- while (Chr != '\n') {
- if (Chr < 0)
- return Chr;
- Env.get();
- }
+ while (Chr != '\n') {
+ if (Chr < 0)
+ return Chr;
+ Env.get();
}
- else {
- for (;;) { // #{block-comment}# from Kriangkrai Soatthiyanont
- Env.get();
- if (Chr < 0)
- return Chr;
- if (Chr == '}' && (Env.get(), Chr == '#'))
- break;
- }
+ }
+}
+
+static void comment(void) {
+ Env.get();
+ if (Chr != '{') {
+ while (Chr != '\n') {
+ if (Chr < 0)
+ return;
+ Env.get();
+ }
+ }
+ else {
+ for (;;) { // #{block-comment}# from Kriangkrai Soatthiyanont
+ Env.get();
+ if (Chr < 0)
+ return;
+ if (Chr == '}' && (Env.get(), Chr == '#'))
+ break;
}
Env.get();
}
}
+static int skip(void) {
+ for (;;) {
+ if (Chr < 0)
+ return Chr;
+ while (Chr <= ' ') {
+ Env.get();
+ if (Chr < 0)
+ return Chr;
+ }
+ if (Chr != '#')
+ return Chr;
+ comment();
+ }
+}
+
/* Test for escaped characters */
static bool testEsc(void) {
for (;;) {
@@ -1110,7 +1134,7 @@ static any rdList(void) {
Env.get();
for (;;) {
- if (skip('#') == ')') {
+ if (skip() == ')') {
Env.get();
return Nil;
}
@@ -1130,7 +1154,7 @@ static any rdList(void) {
drop(c1);
}
for (;;) {
- if (skip('#') == ')') {
+ if (skip() == ')') {
Env.get();
break;
}
@@ -1139,8 +1163,8 @@ static any rdList(void) {
if (Chr == '.') {
Env.get();
if (strchr(Delim, Chr)) {
- cdr(x) = skip('#')==')' || Chr==']'? data(c1) : read0(NO);
- if (skip('#') == ')')
+ cdr(x) = skip()==')' || Chr==']'? data(c1) : read0(NO);
+ if (skip() == ')')
Env.get();
else if (Chr != ']')
err(NULL, x, "Bad dotted pair");
@@ -1167,7 +1191,7 @@ static any read0(bool top) {
any x, y, *h;
cell c1;
- if (skip('#') < 0) {
+ if (skip() < 0) {
if (top)
return Nil;
eofErr();
@@ -1259,16 +1283,11 @@ static any read0(bool top) {
}
any read1(int end) {
- any x;
-
if (!Chr)
Env.get();
if (Chr == end)
return Nil;
- x = read0(YES);
- while (Chr > 0 && strchr(" \t)]", Chr))
- Env.get();
- return x;
+ return read0(YES);
}
/* Read one token */
@@ -1279,7 +1298,7 @@ any token(any x, int c) {
if (!Chr)
Env.get();
- if (skip(c) < 0)
+ if (skipc(c) < 0)
return NULL;
if (Chr == '"') {
Env.get();
@@ -1722,7 +1741,7 @@ any doChar(any ex) {
// (skip ['any]) -> sym
any doSkip(any x) {
x = evSym(cdr(x));
- return skip(symChar(name(x)))<0? Nil : mkChar(Chr);
+ return skipc(symChar(name(x)))<0? Nil : mkChar(Chr);
}
// (eol) -> flg
@@ -2048,8 +2067,19 @@ any load(any ex, int pr, any x) {
if (pr && !Chr)
prin(run(val(Prompt))), Env.put(pr), space(), flushAll();
data(c1) = read1(isatty(STDIN_FILENO)? '\n' : 0);
- if (Chr == '\n')
- Chr = 0;
+ while (Chr > 0) {
+ if (Chr == '\n') {
+ Chr = 0;
+ break;
+ }
+ if (Chr == '#')
+ comment();
+ else {
+ if (Chr > ' ')
+ break;
+ Env.get();
+ }
+ }
}
if (isNil(data(c1))) {
popInFiles();
diff --git a/src/vers.h b/src/vers.h
@@ -1 +1 @@
-static byte Version[4] = {3,1,3,2};
+static byte Version[4] = {3,1,3,3};
diff --git a/src64/io.l b/src64/io.l
@@ -1,4 +1,4 @@
-# 12jun13abu
+# 05jul13abu
# (c) Software Lab. Alexander Burger
# Close file descriptor
@@ -2004,6 +2004,59 @@
# Skip White Space and Comments
(code 'skipC_A 0)
ld A (Chr)
+ null A # EOF?
+ if ns # No
+ do
+ do
+ cmp B 32 # White space?
+ while le # Yes
+ call (Get_A) # Get next
+ null A # EOF?
+ js 90 # Yes
+ loop
+ cmp A C # Comment char?
+ while eq # Yes
+ call (Get_A)
+ do
+ cmp B 10 # Linefeed?
+ while ne #No
+ null A # EOF?
+ js 90 # Yes
+ call (Get_A)
+ loop
+ loop
+ end
+90 ret
+
+(code 'comment_A 0)
+ call (Get_A)
+ cmp B (char "{")
+ if ne # No
+ do
+ cmp B 10 # Linefeed?
+ while ne #No
+ null A # EOF?
+ js 90 # Yes
+ call (Get_A)
+ loop
+ else # Block comment
+ do
+ call (Get_A)
+ null A # EOF?
+ js 90 # Yes
+ cmp B (char "}") # End of block comment?
+ if eq
+ call (Get_A)
+ cmp B (char "#")
+ break eq # Yes
+ end
+ loop
+ call (Get_A)
+ end
+90 ret
+
+(code 'skip_A 0)
+ ld A (Chr)
do
null A # EOF?
while ns # No
@@ -2014,34 +2067,9 @@
null A # EOF?
js ret # Yes
loop
- cmp A C # Comment char?
+ cmp B (char "#") # Comment char?
while eq # Yes
- call (Get_A)
- cmp C (char "#") # Block comment?
- jne 10 # No
- cmp B (char "{")
- if ne # No
-10 do
- cmp B 10 # Linefeed?
- while ne #No
- null A # EOF?
- js ret # Yes
- call (Get_A)
- loop
- else # Block comment
- do
- call (Get_A)
- null A # EOF?
- js ret # Yes
- cmp B (char "}") # End of block comment?
- if eq
- call (Get_A)
- cmp B (char "#")
- break eq # Yes
- end
- loop
- end
- call (Get_A)
+ call comment_A # Skip comment
loop
ret
@@ -2169,8 +2197,7 @@
jlt stkErr
call (Get_A) # Skip paren
do
- ld C (char "#")
- call skipC_A # and white space
+ call skip_A # and white space
cmp B (char ")") # Empty list?
if eq # Yes
call (Get_A) # Skip paren
@@ -2212,8 +2239,7 @@
drop # Continue
loop
10 do
- ld C (char "#")
- call skipC_A # Skip white space
+ call skip_A # Skip white space
cmp B (char ")") # Done?
if eq # Yes
call (Get_A) # Skip paren
@@ -2226,8 +2252,7 @@
call (Get_A) # Skip dot
memb Delim "(DelimEnd-Delim)" # Delimiter?
if eq # Yes
- ld C (char "#")
- call skipC_A # and white space
+ call skip_A # and white space
cmp B (char ")") # Circular list?
jz 20 # Yes
cmp B (char "]")
@@ -2241,8 +2266,7 @@
pop E
ld (E CDR) A # Store in CDR
end
- ld C (char "#")
- call skipC_A # Skip white space
+ call skip_A # Skip white space
cmp B (char ")") # Done?
if eq # Yes
call (Get_A) # Skip paren
@@ -2302,12 +2326,23 @@
drop
ret
+(code 'readC_E)
+ null (Chr) # Empty channel?
+ if z # Yes
+ call (Get_A) # Fill 'Chr'
+ end
+ cmp C (Chr) # Terminator?
+ if eq # Yes
+ ld E Nil # Return 'NIL'
+ ret
+ end
+ ld A 1 # Read top level expression
+
(code 'readA_E)
push X
push Y
push A # <S> Top flag
- ld C (char "#")
- call skipC_A
+ call skip_A
null A # EOF?
if s # Yes
null (S) # Top?
@@ -2486,36 +2521,6 @@
pop X
ret
-(code 'readC_E)
- null (Chr) # Empty channel?
- if z # Yes
- call (Get_A) # Fill 'Chr'
- end
- cmp C (Chr) # Terminator?
- if eq # Yes
- ld E Nil # Return 'NIL'
- else
- ld A 1 # Top level
- call readA_E # Read expression
- push E
- ld A (Chr)
- do
- null A # EOF?
- while nsz # No
- cmp B 32 # Space?
- jz 10
- cmp B 9 # Tab?
- jz 10
- cmp B (char ")") # or closing parens?
- jz 10
- cmp B (char "]")
- while eq # Yes
-10 call (Get_A)
- loop
- pop E
- end
- ret
-
(code 'tokenCE_E) # X
null (Chr) # Look ahead char?
if z # No
@@ -4149,10 +4154,24 @@
nul4 # on a tty?
ldz C 0 # No
call readC_E # Read expression
- cmp (Chr) 10 # Hit linefeed?
- if eq # Yes
- ld (Chr) 0 # Clear it
- end
+ ld A (Chr)
+ do
+ null A # EOF?
+ while nsz # No
+ cmp B 10 # Linefeed?
+ if eq # Yes
+ ld (Chr) 0 # Clear it
+ break T
+ end
+ cmp B (char "#") # Comment char?
+ if eq # Yes
+ call comment_A # Skip comment
+ else
+ cmp B 32 # White space?
+ break gt # No
+ call (Get_A)
+ end
+ loop
end
cmp E Nil
while ne
diff --git a/src64/tags b/src64/tags
@@ -589,7 +589,7 @@ sys/x86-64.freeBsd.defs.l,1994
doHash2976,70791
doRand3003,71394
-./io.l,2942
+./io.l,2983
closeAX5,75
unLockFileAC15,253
wrLockFileC23,487
@@ -652,81 +652,83 @@ sys/x86-64.freeBsd.defs.l,1994
popCtlFiles1959,51287
getChar_A1973,51678
skipC_A2005,52549
-testEscA_F2048,53470
-anonymousX_FE2082,54223
-rdAtomBY_E2115,55086
-rdList_E2167,56513
-readA_E2305,60045
-readC_E2489,64362
-tokenCE_E2519,64953
-doRead2665,68490
-inReadyC_F2703,69330
-fdSetCL_X2715,69611
-fdRdSetCZL2727,69845
-fdWrSetCZL2734,69987
-rdSetCL_F2741,70136
-wrSetCL_F2746,70252
-rdSetRdyCL_F2751,70375
-waitFdCEX_A2773,70836
-doWait3175,84262
-doSync3213,84985
-doHear3253,85925
-doTell3285,86619
-fdSetC_Y3334,87707
-doPoll3345,87941
-doKey3401,89312
-doPeek3456,90751
-doChar3472,91029
-doSkip3526,91974
-doEol3540,92321
-doEof3549,92487
-doFrom3568,92844
-doTill3635,94513
-eolA_F3709,96462
-doLine3724,96766
-doLines3877,100806
-parseBCE_E3918,101707
-doAny3990,103362
-doSym4030,104300
-doStr4044,104559
-loadBEX_E4097,105685
-doLoad4193,108035
-doIn4216,108447
-doOut4236,108777
-doErr4256,109111
-doCtl4276,109446
-doPipe4297,109801
-doOpen4360,111347
-doClose4403,112327
-doEcho4434,112918
-putStdoutB4647,118442
-newline4690,119424
-space4694,119466
-outNumE4699,119530
-outWordA4706,119658
-prExtNmX4718,119896
-outOctA4726,120090
-outAoA4739,120358
-outStringS4751,120606
-outStringC4753,120676
-outNameE4763,120815
-prNameX4771,120932
-printE_E4781,121087
-printE4790,121223
-prinE_E5003,126839
-prinE5012,126975
-doPrin5067,128237
-doPrinl5081,128507
-doSpace5085,128575
-doPrint5107,128974
-doPrintsp5123,129269
-doPrintln5138,129558
-doFlush5143,129646
-doRewind5151,129783
-doExt5168,130173
-doRd5185,130512
-doPr5251,132292
-doWr5268,132624
+comment_A2031,53064
+skip_A2058,53582
+testEscA_F2076,53927
+anonymousX_FE2110,54680
+rdAtomBY_E2143,55543
+rdList_E2195,56970
+readC_E2329,60398
+readA_E2341,60635
+tokenCE_E2524,64932
+doRead2670,68469
+inReadyC_F2708,69309
+fdSetCL_X2720,69590
+fdRdSetCZL2732,69824
+fdWrSetCZL2739,69966
+rdSetCL_F2746,70115
+wrSetCL_F2751,70231
+rdSetRdyCL_F2756,70354
+waitFdCEX_A2778,70815
+doWait3180,84241
+doSync3218,84964
+doHear3258,85904
+doTell3290,86598
+fdSetC_Y3339,87686
+doPoll3350,87920
+doKey3406,89291
+doPeek3461,90730
+doChar3477,91008
+doSkip3531,91953
+doEol3545,92300
+doEof3554,92466
+doFrom3573,92823
+doTill3640,94492
+eolA_F3714,96441
+doLine3729,96745
+doLines3882,100785
+parseBCE_E3923,101686
+doAny3995,103341
+doSym4035,104279
+doStr4049,104538
+loadBEX_E4102,105664
+doLoad4212,108387
+doIn4235,108799
+doOut4255,109129
+doErr4275,109463
+doCtl4295,109798
+doPipe4316,110153
+doOpen4379,111699
+doClose4422,112679
+doEcho4453,113270
+putStdoutB4666,118794
+newline4709,119776
+space4713,119818
+outNumE4718,119882
+outWordA4725,120010
+prExtNmX4737,120248
+outOctA4745,120442
+outAoA4758,120710
+outStringS4770,120958
+outStringC4772,121028
+outNameE4782,121167
+prNameX4790,121284
+printE_E4800,121439
+printE4809,121575
+prinE_E5022,127191
+prinE5031,127327
+doPrin5086,128589
+doPrinl5100,128859
+doSpace5104,128927
+doPrint5126,129326
+doPrintsp5142,129621
+doPrintln5157,129910
+doFlush5162,129998
+doRewind5170,130135
+doExt5187,130525
+doRd5204,130864
+doPr5270,132644
+doWr5287,132976
./apply.l,445
applyXYZ_E4,51
diff --git a/src64/version.l b/src64/version.l
@@ -1,6 +1,6 @@
# 05jul13abu
# (c) Software Lab. Alexander Burger
-(de *Version 3 1 3 2)
+(de *Version 3 1 3 3)
# vi:et:ts=3:sw=3
diff --git a/test/lib.l b/test/lib.l
@@ -1,4 +1,4 @@
-# 07apr12abu
+# 05jul13abu
# (c) Software Lab. Alexander Burger
### task ###
@@ -88,12 +88,12 @@
### scl ###
(scl 0)
-(test 123 (any "123.45")))
+(test 123 (any "123.45"))
(scl 1)
(test (1235) (scl 1 (str "123.45")))
-(test 1235 (any "123.45")))
+(test 1235 (any "123.45"))
(scl 3)
-(test 123450 (any "123.45")))
+(test 123450 (any "123.45"))
### script ###
diff --git a/test/src/sym.l b/test/src/sym.l
@@ -1,4 +1,4 @@
-# 14jul12abu
+# 05jul13abu
# (c) Software Lab. Alexander Burger
### name ###
@@ -97,7 +97,7 @@
### chop ###
-(test '("c" "a" "r") (chop 'car)))
+(test '("c" "a" "r") (chop 'car))
(test '("H" "e" "l" "l" "o") (chop "Hello"))
(test '("1" "2" "3") (chop 123))
(test (1 2 3) (chop (1 2 3)))
@@ -126,17 +126,17 @@
### pre? ###
-(test "abcdef" (pre? "" "abcdef")))
-(test NIL (pre? "abc" "")))
-(test "abcdef" (pre? "abc" "abcdef")))
+(test "abcdef" (pre? "" "abcdef"))
+(test NIL (pre? "abc" ""))
+(test "abcdef" (pre? "abc" "abcdef"))
(test NIL (pre? "def" "abcdef"))
(test "abcdef" (pre? "" "abcdef"))
(test "7fach" (pre? (+ 3 4) "7fach"))
### sub? ###
-(test "abcdef" (sub? "" "abcdef")))
-(test NIL (sub? "abc" "")))
+(test "abcdef" (sub? "" "abcdef"))
+(test NIL (sub? "abc" ""))
(test "abcdef" (sub? "cde" "abcdef"))
(test "abcdef" (sub? "def" "abcdef"))
(test NIL (sub? "abb" "abcdef"))