From 604bc457a63a2727326f9b98fbdaf397d81d8b45 Mon Sep 17 00:00:00 2001 From: Shawn Presser Date: Thu, 6 Sep 2018 18:43:44 -0500 Subject: [PATCH] Define and use %STASH --- bin/compiler.js | 6 +++++- bin/compiler.lua | 6 +++++- compiler.l | 5 ++++- 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/bin/compiler.js b/bin/compiler.js index f0ca439..07f1c60 100644 --- a/bin/compiler.js +++ b/bin/compiler.js @@ -65,7 +65,7 @@ var literal = function (s) { }; var stash42 = function (args) { if (keys63(args)) { - var __l = ["%object", "\"_stash\"", true]; + var __l = ["%stash"]; var ____o = args; var __k = undefined; for (__k in ____o) { @@ -1356,6 +1356,10 @@ setenv("%literal", {_stash: true, special: function () { var __args111 = unstash(Array.prototype.slice.call(arguments, 0)); return apply(cat, map(compile, __args111)); }}); +setenv("%stash", {_stash: true, special: function () { + var __args13 = unstash(Array.prototype.slice.call(arguments, 0)); + return compile(join(["%object", "\"_stash\"", true], __args13)); +}}); exports.run = run; exports["eval"] = _eval; exports.expand = expand; diff --git a/bin/compiler.lua b/bin/compiler.lua index 6768275..554a049 100644 --- a/bin/compiler.lua +++ b/bin/compiler.lua @@ -65,7 +65,7 @@ local function literal(s) end local function stash42(args) if keys63(args) then - local __l = {"%object", "\"_stash\"", true} + local __l = {"%stash"} local ____o = args local __k = nil for __k in next, ____o do @@ -1295,4 +1295,8 @@ setenv("%literal", {_stash = true, special = function (...) local __args111 = unstash({...}) return apply(cat, map(compile, __args111)) end}) +setenv("%stash", {_stash = true, special = function (...) + local __args13 = unstash({...}) + return compile(join({"%object", "\"_stash\"", true}, __args13)) +end}) return {run = run, ["eval"] = _eval, expand = expand, compile = compile} diff --git a/compiler.l b/compiler.l index bdaa4e7..3c12322 100644 --- a/compiler.l +++ b/compiler.l @@ -49,7 +49,7 @@ (define stash* (args) (if (keys? args) - (let l '(%object "_stash" true) + (let l `(%stash) (each (k v) args (unless (number? k) (add l (literal k)) @@ -736,6 +736,9 @@ (define-special %literal args (apply cat (map compile args))) +(define-special %stash args + (compile `(%object "_stash" true ,@args))) + (export run eval expand