commit 1d767ce574d27b622d697bd641c3a483fd5cf85d
parent a1415132896a285c70bdb46d5cfc40d9f148790a
Author: tomas <tomas@logand.com>
Date: Sun, 24 Jan 2010 14:35:15 +0100
// reader: immediate literals implemented
Diffstat:
1 file changed, 13 insertions(+), 3 deletions(-)
diff --git a/wps.js b/wps.js
@@ -43,7 +43,7 @@ function member(C, L) {
return 0 <= L.indexOf(C);
}
-function PsParser() {
+function PsParser(Ds) {
var Self = this;
function init(L) {
Self.L = L;
@@ -129,7 +129,17 @@ function PsParser() {
case "]": return new Symbol(xchar());
case "{": Self.D++; return new Symbol(xchar());
case "}": Self.D--; return new Symbol(xchar());
- case "/": xchar(); var X = symbol(); return quote(X);
+ case "/":
+ xchar();
+ if("/" == peek()) {
+ xchar();
+ var X = symbol();
+ //throw "Immediate literals not implemented yet " + X.nm;
+ return inDs(Ds, symbolName(X));
+ } else {
+ var X = symbol();
+ return quote(X);
+ }
case "(": return text();
case "<":
xchar();
@@ -180,7 +190,7 @@ function Ps0(Os, Ds, Es) {
Os.push(C[I]);
run(X, true);
}
- var PsP = new PsParser;
+ var PsP = new PsParser(Ds);
function parse(L) {
PsP.init(L);
while(PsP.peek()) {