lean2/tests/lua/parser2.lua
Leonardo de Moura 4ba097a141 feat(frontends/lean): use lowercase commands, replace 'endscope' and 'endnamespace' with 'end'
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-01-05 13:06:36 -08:00

27 lines
744 B
Lua

import("util.lua")
local env = environment()
parse_lean_cmds([[
variable N : Type
variables x y : N
variable f : N -> N -> N
setoption pp::colors false
]], env)
local f, x, y = Consts("f, x, y")
print(env:type_check(f(x, y)))
assert(env:type_check(f(x, y)) == Const("N"))
assert(not get_options():get{"pp", "colors"})
parse_lean_cmds([[
setoption pp::colors true
]], env)
assert(get_options():get{"pp", "colors"})
local o = get_options()
o:update({"lean", "pp", "notation"}, false)
assert(not o:get{"lean", "pp", "notation"})
o = parse_lean_cmds([[
check fun x : N, y
setoption pp::notation true
check fun x : N, y
]], env, o)
print(o)
assert(o:get{"lean", "pp", "notation"})
assert(parse_lean("f x y", env) == f(x, y))