lean2/src/builtin/util.lua
Leonardo de Moura 29fec3fecc fix(builtin/util): bug incorrect encoding of \t and \n in regular expression, and missing local
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-01-12 17:40:41 -08:00

16 lines
400 B
Lua

-- Extra useful functions
-- Create sequence of expressions.
-- Examples:
-- local a, b, c = Consts("a,b,c")
-- We can use ';', ' ', ',', tabs ad line breaks for separating the constant names
-- local a, b, c = Consts("a b c")
function Consts(s)
local r = {}
local i = 1
for c in string.gmatch(s, '[^ ,;\t\n]+') do
r[i] = Const(c)
i = i + 1
end
return unpack(r)
end