commit 2e90a3297e09e10cc66d6ccf62c772d891aae409
parent 2ecf1c5b82c89185f2ac2970eac5b178090be322
Author: tomas <tomas@logand.com>
Date: Sun, 18 Oct 2009 00:02:46 +0200
~ reader
Diffstat:
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/wl.java b/wl.java
@@ -189,6 +189,7 @@ class wl implements Runnable {
// reader
final static Any Lp = mkObj(null);
final static Any Rp = mkObj(null);
+ final static Any Tld = mkObj(null);
final Any Qte = mkIsym("quote", NIL);
final Any Dot = mkIsym(".", NIL);
@@ -296,6 +297,7 @@ class wl implements Runnable {
case '"': xchar(); Z = text(); break;
case '\'': xchar(); Z = mkCons(Qte, read1(false)); break;
case '`': xchar(); Z = eval(read1(false)); break;
+ case '~': if(Top) Z = symbol(); else {xchar(); Z = Tld;} break;
default: Z = symbol();
}
}
@@ -306,12 +308,15 @@ class wl implements Runnable {
Any Z = A;
Any X;
boolean D = false;
+ boolean E = false;
while(null != (X = read1(false)) && Rp != X) {
- if(Dot != X) {
+ if(Dot != X && Tld != X) {
+ if(E) {X = eval(X); E = false;}
Z.cdr(D ? X : mkCons(X, NIL));
if(Z.cdr().isCons()) Z = Z.cdr();
}
- D = Dot == X;
+ D = Dot == X || Tld == X;
+ E = Tld == X;
}
if(null == X) err("Reader underflow");
if(D) Z.cdr(A.cdr());