Compare commits

...

1 Commits

Author SHA1 Message Date
Leonardo de Moura
1410994ce3 fix: missing atomic at match_expr parser 2024-03-02 12:30:57 -08:00
2 changed files with 14 additions and 1 deletions

View File

@@ -160,7 +160,7 @@ def doMatchAlts := ppDedent <| matchAlts (rhsParser := doSeq)
def doMatchExprAlts := ppDedent <| matchExprAlts (rhsParser := doSeq)
def optMetaFalse :=
optional ("(" >> nonReservedSymbol "meta" >> " := " >> nonReservedSymbol "false" >> ") ")
optional (atomic ("(" >> nonReservedSymbol "meta" >> " := " >> nonReservedSymbol "false" >> ") "))
@[builtin_doElem_parser] def doMatchExpr := leading_parser:leadPrec
"match_expr " >> optMetaFalse >> termParser >> " with" >> doMatchExprAlts

View File

@@ -0,0 +1,13 @@
import Lean
open Lean Meta
def f1 (e : Expr) : MetaM Expr := do
match_expr ( whnf e) with
| And a b => mkAppM ``And #[b, a]
| _ => return e
def f2 (e : Expr) : MetaM Expr := do
match_expr (meta := false) ( whnf e) with
| And a b => mkAppM ``And #[b, a]
| _ => return e