feat: add structInstFieldDecl syntax category (#6265)

This PR is preparation for changes to structure instance notation in
#6165. It adds a syntax category that will be used for field syntax.
This commit is contained in:
Kyle Miller 2024-11-30 04:12:53 -08:00 committed by GitHub
parent 27df5e968a
commit f3f00451c8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 12 additions and 0 deletions

View file

@ -48,6 +48,11 @@ def tactic : Category := {}
For example, `let x ← e` is a `doElem`, and a `do` block consists of a list of `doElem`s. -/
def doElem : Category := {}
/-- `structInstFieldDecl` is the syntax category for value declarations for fields in structure instance notation.
For example, the `:= 1` and `where a := 3` in `{ x := 1, y where a := 3 }` are in the `structInstFieldDecl` class.
This category is necessary because structure instance notation is recursive due to the `x where ...` field notation. -/
def structInstFieldDecl : Category := {}
/-- `level` is a builtin syntax category for universe levels.
This is the `u` in `Sort u`: it can contain `max` and `imax`, addition with
constants, and variables. -/

View file

@ -387,6 +387,13 @@ use `(_)` to inhibit this and have it be solved for by unification instead, like
explicitBinder requireType <|> strictImplicitBinder requireType <|>
implicitBinder requireType <|> instBinder
/-
Syntax category for structure instance notation fields.
Does not initialize `registerBuiltinDynamicParserAttribute` since this category is not meant to be user-extensible.
-/
builtin_initialize
registerBuiltinParserAttribute `builtin_structInstFieldDecl_parser ``Category.structInstFieldDecl
/-
It is feasible to support dependent arrows such as `{α} → αα` without sacrificing the quality of the error messages for the longer case.
`{α} → αα` would be short for `{α : Type} → αα`