function read_quote(port, tok) {
if ("'" === tok) return [ sym.quote, read_port(port) ];
if ('`' === tok) return [ sym.quasiquote, read_port(port) ];
if (',' === tok) return [ sym.unquote, read_port(port) ];
if (',@' === tok) return [ sym.unatquote, read_port(port) ];
throw new Error("unknown quote "+tok+ " : "+writeString(fileHandler(port, 'info')).str);
}
/* ... */
qq: function (x) {
if (!(x instanceof Array)) {
return [ env.quote, x ];
}
if (x.length >= 1) {
if (x[0][0] === sym.unatquote) {
if (1 < x.length)
return [ env.append, x[0][1], helper.qq(x.slice(1)) ];
else
return [ env.append, x[0][1] ];
}
}
if (x.length === 2) {
if (x[0] === sym.unquote) {
return x[1];
}
if (x[0] === sym.quasiquote) {
return helper.qq( helper.qq( x[1] ) );
}
}
if (2 > x.length) {
return [ env.list, helper.qq(x[0])];
}
return [ env.cons, helper.qq(x[0]), helper.qq(x.slice(1)) ];
},
/* ... */
quasiquote: function(a) {
constrain['(.)']('quasiquote', a);
var r = helper.qq(a[0]);
debugList("quasi" , r);
code.push({ q:r, e:this.e, p:this.p });
return; /* continuation */
},