Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Define and use %STASH #195

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion bin/compiler.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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;
Expand Down
6 changes: 5 additions & 1 deletion bin/compiler.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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}
5 changes: 4 additions & 1 deletion compiler.l
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down Expand Up @@ -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
Expand Down