chore: update stage0
This commit is contained in:
parent
7dcd011be0
commit
8f58351a2c
4 changed files with 2777 additions and 1643 deletions
4
stage0/src/Lean/Elab/Do.lean
generated
4
stage0/src/Lean/Elab/Do.lean
generated
|
|
@ -127,10 +127,10 @@ private partial def expandDoElems : Bool → Array Syntax → Nat → MacroM Syn
|
|||
rest ← mkRest ();
|
||||
newBody ←
|
||||
if optElse.isNone then do
|
||||
`(do let x ← $discr; match x with | $pat => $rest)
|
||||
`(do let x ← $discr; (match x with | $pat => $rest))
|
||||
else
|
||||
let elseBody := optElse.getArg 1;
|
||||
`(do let x ← $discr; match x with | $pat => $rest | _ => $elseBody);
|
||||
`(do let x ← $discr; (match x with | $pat => $rest | _ => $elseBody));
|
||||
addPrefix newBody
|
||||
else if i < doElems.size - 1 && doElem.getKind == `Lean.Parser.Term.doExpr then do
|
||||
-- def doExpr := parser! termParser
|
||||
|
|
|
|||
8
stage0/src/Lean/Parser/Do.lean
generated
8
stage0/src/Lean/Parser/Do.lean
generated
|
|
@ -131,7 +131,13 @@ def doMatchAlts : Parser := parser! withPosition fun pos => (optional "| ") >> s
|
|||
@[builtinDoElemParser] def «break» := parser! "break"
|
||||
@[builtinDoElemParser] def «continue» := parser! "continue"
|
||||
|
||||
@[builtinDoElemParser] def doExpr := parser! notFollowedBy "let " >> notFollowedBy "have " >> termParser
|
||||
/-
|
||||
We use `notFollowedBy` to avoid counterintuitive behavior. For example, the `if`-term parser
|
||||
doesn't enforce indentation restrictions, but we don't want it to be used when `doIf` fails.
|
||||
Note that parser priorities would not solve this problem since the `doIf` parser is failing while the `if`
|
||||
parser is succeeding.
|
||||
-/
|
||||
@[builtinDoElemParser] def doExpr := parser! notFollowedBy ("if" <|> "match" <|> "let" <|> "have" <|> "do") >> termParser
|
||||
|
||||
@[builtinTermParser] def «do» := parser!:maxPrec "do " >> doSeq
|
||||
|
||||
|
|
|
|||
2429
stage0/stdlib/Lean/Elab/Do.c
generated
2429
stage0/stdlib/Lean/Elab/Do.c
generated
File diff suppressed because it is too large
Load diff
1979
stage0/stdlib/Lean/Parser/Do.c
generated
1979
stage0/stdlib/Lean/Parser/Do.c
generated
File diff suppressed because it is too large
Load diff
Loading…
Add table
Reference in a new issue