if var then cfg[var] = val else table.insert (cfg.inputs, a) end
end
--- metalua.mlc doesn't exit yet; this preload manager loads a mockup which is just
+-- metalua.mlc doesn't exist yet; this preload manager loads a mockup which is just
-- sufficient to compile the real mlc.mlua
package.preload['metalua.mlc'] = function()
elseif type(p[1])=="string" then -- find name based on 1st keyword
if #p==1 then p.name=p[1]
elseif type(p[#p])=="string" then
- p.name = p[1] .. " ... " . p[#p]
+ p.name = p[1] .. " ... " .. p[#p]
else p.name = p[1] .. " ..." end
else -- can't find a decent name
p.name = "<anonymous>"
-- That is, without sugar:
return {tag="String", {tag="Index", {tag="Splice", id[1] },
{tag="Number", 1 } } }
- else error ("Identifier expected: ".._G.table.tostring(id)) end
+ else error ("Identifier expected: ".._G.table.tostring(id, 'nohash')) end
end
--------------------------------------------------------------------------------
"separated by semicolons, or not separated at all") end
if e[1].tag ~= "Call" and e[1].tag ~= "Invoke" then
local typename
- if e[1].tag == 'Id' then typename = "an identifier"
- elseif e[1].tag == 'Op' then typename = "an arithmetic operation"
- else typename = "of type '"..(e[1].tag or "<list>".."'" end
-
- gg.parse_error (lx, "This expression is " .. typename ..
- "; only function and method call expressions "..
- "can be used as statements");
+ if e[1].tag == 'Id' then
+ typename = '("'..e[1][1]..'") is an identifier'
+ elseif e[1].tag == 'Op' then
+ typename = "is an arithmetic operation"
+ else typename = "is of type '"..(e[1].tag or "<list>").."'" end
+
+ gg.parse_error (lx, "This expression " .. typename ..
+ "; a statement was expected, and only function and method call "..
+ "expressions can be used as statements");
end
return e[1]
end
-- anywhere or assigned to inside a function.
--
+local getinfo, error, rawset, rawget = debug.getinfo, error, rawset, rawget
+
local mt = getmetatable(_G)
if mt == nil then
mt = {}
setmetatable(_G, mt)
end
-__STRICT = true
+__strict = true
mt.__declared = {}
+local function what ()
+ local d = getinfo(3, "S")
+ return d and d.what or "C"
+end
+
mt.__newindex = function (t, n, v)
- if __STRICT and not mt.__declared[n] then
- local w = debug.getinfo(2, "S").what
+ if __strict and not mt.__declared[n] then
+ local w = what()
if w ~= "main" and w ~= "C" then
error("assign to undeclared variable '"..n.."'", 2)
end
end
mt.__index = function (t, n)
- if not mt.__declared[n] and debug.getinfo(2, "S").what ~= "C" then
+ if __strict and not mt.__declared[n] and what() ~= "C" then
error("variable '"..n.."' is not declared", 2)
end
return rawget(t, n)
# Upon installation, everything will be moved to ${INSTALL_LIB} and ${INSTALL_BIN}
if [ -z "${BUILD}" ]; then
- BUILD= $(cd ../build; pwd)
+ BUILD=$(mkdir -p ../build; cd ../build; pwd)
fi
if [ -z "${BUILD_BIN}" ]; then