lean4-htt/tests/lean/run/parserAliasShadow.lean
Leonardo de Moura f638269a71 fix: name resolution at syntax command
This commit also cleans up `toParserDescr`+`toParserDescrAux`.
2020-12-22 08:40:00 -08:00

27 lines
638 B
Text

namespace Foo
-- The following declaration shadows the builtin parser alias `letDecl`
syntax letDecl := term ">==>" term
syntax "foo!" letDecl : term
macro_rules
| `(foo! $x:term >==> $y) => `($x + $y)
end Foo
-- The following declaration shadows the builtin parser alias `letDecl`
syntax letDecl := term ">=>=>" term
syntax "bla!" letDecl : term
macro_rules
| `(bla! $x:term >=>=> $y) => `($x * $y)
syntax "boo!" Foo.letDecl : term
macro_rules
| `(boo! $x:term >==> $y) => `($x - $y)
theorem ex1 : (foo! 10 >==> 20) = 30 := rfl
theorem ex2 : (bla! 10 >=>=> 20) = 200 := rfl
theorem ex3 : (boo! 30 >==> 20) = 10 := rfl