tweak lambda evaluator
authorJim Pryor <profjim@jimpryor.net>
Thu, 23 Sep 2010 08:19:58 +0000 (04:19 -0400)
committerJim Pryor <profjim@jimpryor.net>
Thu, 23 Sep 2010 08:19:58 +0000 (04:19 -0400)
Signed-off-by: Jim Pryor <profjim@jimpryor.net>
code/parse.js

index 7749c69..fc3b83d 100644 (file)
@@ -213,7 +213,11 @@ var make_parse = function () {
                     n = token;
                     advance();
                 }
-                if (token.id === ".") {
+                               if (token.arity === "literal" && t.first.length === 0) {
+                                       t.first.push(n);
+                                       t.second = token;
+                                       advance();
+                               } else if (token.id === ".") {
                     t.first.push(n);
                     advance();
                     t.second = expression(in_let);
@@ -249,8 +253,8 @@ var make_parse = function () {
                     n = token;
                     advance(")");
                 } else {
-                    if (token.arity !== "name") {
-                        token.error("Expected a variable name.");
+                    if (token.arity !== "name" && token.arity !== "literal") {
+                        token.error("Expected a variable name or literal.");
                     }
                     token.first = n;
                     n = token;