fix: antiquotation for all categories
This commit is contained in:
parent
e8c54ad1bf
commit
642850efb2
1 changed files with 8 additions and 1 deletions
|
|
@ -1755,13 +1755,20 @@ match (parserExtension.getState env).categories.find? catName with
|
|||
| none => false
|
||||
| some cat => cat.leadingIdentAsSymbol
|
||||
|
||||
def categoryParserFnImpl (catName : Name) : ParserFn leading :=
|
||||
def categoryParserFnImplAux (catName : Name) : ParserFn leading :=
|
||||
fun rbp ctx s =>
|
||||
let categories := (parserExtension.getState ctx.env).categories;
|
||||
match categories.find? catName with
|
||||
| some cat => prattParser catName cat.tables cat.leadingIdentAsSymbol rbp ctx s
|
||||
| none => s.mkUnexpectedError ("unknown parser category '" ++ toString catName ++ "'")
|
||||
|
||||
private def catNameToString : Name → String
|
||||
| Name.str Name.anonymous s _ => s
|
||||
| n => n.toString
|
||||
|
||||
def categoryParserFnImpl (catName : Name) : ParserFn leading :=
|
||||
orelseFn (mkAntiquot (catNameToString catName) none false).fn (categoryParserFnImplAux catName)
|
||||
|
||||
@[init] def setCategoryParserFnRef : IO Unit :=
|
||||
categoryParserFnRef.set categoryParserFnImpl
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue