lean4-htt/tests/lean/529.lean
Leonardo de Moura d93c4317d1 feat: add withOpenDecl and withOpen parsers
It allow us to process `open .. in ..` while parsing.
This is useful for activating a scoped parser while parsing.
TODO: `openOnly` and `openHiding`, these two cases are rarely used
with `open .. in ..`

closes #529
2021-08-22 20:50:35 -07:00

24 lines
422 B
Text

import Lean
namespace Foo
def f (x y : Nat) := x + y + x
scoped infix:65 " ++ " => f
end Foo
open Foo in
def f1 (x : Nat) := x ++ x
#print f1
def f2 (x : Nat) := open Foo in x ++ x
#print f2
open Foo in
#print f1
open Lean.Parser.Command in
def syntaxMatcher : Unit :=
match Lean.Syntax.missing with
| `(declId|$id:ident$[.{$ls,*}]?) => () -- unknown parser declId
| _ => ()