fix: disambiguate fun syntax alternatives to help the pretty printer
This commit is contained in:
parent
20ed65605b
commit
912d24a3ee
1 changed files with 3 additions and 1 deletions
|
|
@ -139,7 +139,9 @@ def matchDiscr := parser! optional («try» (ident >> checkNoWsBefore "no space
|
|||
|
||||
def funImplicitBinder := «try» (lookahead ("{" >> many1 binderIdent >> (" : " <|> "}"))) >> implicitBinder
|
||||
def funBinder : Parser := funImplicitBinder <|> instBinder <|> termParser maxPrec
|
||||
@[builtinTermParser] def «fun» := parser!:maxPrec unicodeSymbol "λ" "fun" >> ((many1 (ppSpace >> funBinder) >> darrow >> termParser) <|> matchAlts false)
|
||||
-- NOTE: we use `nodeWithAntiquot` to ensure that `fun $b => ...` remains a `term` antiquotation
|
||||
def basicFun : Parser := nodeWithAntiquot "basicFun" `Lean.Parser.Term.basicFun (many1 (ppSpace >> funBinder) >> darrow >> termParser)
|
||||
@[builtinTermParser] def «fun» := parser!:maxPrec unicodeSymbol "λ" "fun" >> (checkInsideQuot >> basicFun <|> checkOutsideQuot >> (many1 (ppSpace >> funBinder) >> darrow >> termParser) <|> matchAlts false)
|
||||
|
||||
def optExprPrecedence := optional («try» ":" >> termParser maxPrec)
|
||||
@[builtinTermParser] def «parser!» := parser!:leadPrec "parser! " >> optExprPrecedence >> termParser
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue