Renaming.
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
-- Prototype for nel
|
||||
require("interpreter")
|
||||
|
||||
function Bind(scope,abstract,callback)
|
||||
@@ -19,6 +20,7 @@ end
|
||||
|
||||
NelliScope = Scope()
|
||||
local ns = NelliScope
|
||||
--[[
|
||||
-- Replace all :text() occurrences with ones in 'exp_map'
|
||||
local function substitute(target,exp_map)
|
||||
local text = target:text()
|
||||
@@ -64,7 +66,7 @@ local function Bexpands(s,e,c)
|
||||
--[[error(string.format(
|
||||
"nel: Abstract parameter \"%s\" not in 'quotes'.",
|
||||
text
|
||||
))]]
|
||||
))]]--[[
|
||||
else
|
||||
table.insert(bound,text)
|
||||
end
|
||||
@@ -78,8 +80,8 @@ local function Bexpands(s,e,c)
|
||||
local expanded = substitute(e.expression,map)
|
||||
return Run(_s,expanded,_c,"means: "..tostring(expanded))
|
||||
end)
|
||||
end
|
||||
Bind(ns,"(abstract) means (expression)",Bexpands)
|
||||
end]]
|
||||
--[[Bind(ns,"(abstract) means (expression)",Bexpands)
|
||||
local function Bevaluate(s,e,c)
|
||||
return Binding(e.abstract,function(_s,_e,_c)
|
||||
local scope = Scope()
|
||||
@@ -259,27 +261,20 @@ Bind(ns,"evaluate (text) in (scope)",function(s,e,c)
|
||||
local scope = Run(s,e.scope,c,"evaluate: scope")
|
||||
return Run(s,interpret(Run(scope,e.text,c,"include: source")),c,"include: result")
|
||||
end)
|
||||
Bind(ns,"print (text)",function(s,e,c)
|
||||
log(Run(s,e.text,c,"print: text"))
|
||||
end)
|
||||
Bind(ns,"text (literal)",function(s,e,c)
|
||||
return e.literal:text()
|
||||
end)
|
||||
Bind(ns,"return (expression)",function(s,e,c)
|
||||
return Run(s,e.expression,c,"return: result")
|
||||
end)
|
||||
Bind(ns,"(macro) means (expansion)",function(s,e,c)
|
||||
|
||||
end)
|
||||
Bind(ns,"(identifier) is (value)",function(s,e,c)
|
||||
|
||||
end)
|
||||
Bind(ns,"(expression) becomes (result)",function(s,e,c)
|
||||
|
||||
end)
|
||||
Bind(ns,"let (binding) in (scope)",function(s,e,c)
|
||||
|
||||
end)
|
||||
]]
|
||||
|
||||
Bind(ns,"print (text)",function(s,e,c)
|
||||
log(Run(s,e.text,c,"print: text"))
|
||||
end)
|
||||
|
||||
local Hpath = "nel/helper.nel"
|
||||
local Hchain = Chain("in internal: "..Hpath)
|
||||
@@ -288,6 +283,8 @@ local success,result = Hchain:call(function(chain)
|
||||
end)
|
||||
|
||||
--[[ Documentation:
|
||||
(log (text)) -> Log text to the output stream (print?)
|
||||
|
||||
|
||||
(a new scope) -> Becomes a created new scope
|
||||
(this scope) -> Becomes the current scope
|
||||
0
tests/print.nel
Normal file
0
tests/print.nel
Normal file
1
tests/test.lua
Normal file
1
tests/test.lua
Normal file
@@ -0,0 +1 @@
|
||||
require("")
|
||||
Reference in New Issue
Block a user