- afterTypeChecking : Lean.AttributeApplicationTime
- afterCompilation : Lean.AttributeApplicationTime
- beforeElaboration : Lean.AttributeApplicationTime
Instances For
Equations
Instances For
Equations
- One or more equations did not get rendered due to their size.
- ref : Lean.Name
This is used as the target for go-to-definition queries for simple attributes
- name : Lean.Name
- descr : String
- applicationTime : Lean.AttributeApplicationTime
Instances For
Equations
- Lean.instInhabitedAttributeImplCore = { default := { ref := default, name := default, descr := default, applicationTime := default } }
You can tag attributes with the 'local' or 'scoped' kind.
For example: attribute [local myattr, scoped yourattr, theirattr]
.
This is used to indicate how an attribute should be scoped.
- local means that the attribute should only be applied in the current scope and forgotten once the current section, namespace, or file is closed.
- scoped means that the attribute should only be applied while the namespace is open.
- global means that the attribute should always be applied.
Note that the attribute handler (AttributeImpl.add
) is responsible for interpreting the kind and
making sure that these kinds are respected.
- global : Lean.AttributeKind
- local : Lean.AttributeKind
- scoped : Lean.AttributeKind
Instances For
Equations
- Lean.instBEqAttributeKind = { beq := Lean.beqAttributeKind✝ }
Equations
- Lean.instInhabitedAttributeKind = { default := Lean.AttributeKind.global }
Equations
- One or more equations did not get rendered due to their size.
This is run when the attribute is applied to a declaration
decl
.stx
is the syntax of the attribute including arguments.- erase (decl : Lean.Name) : Lean.AttrM Unit
Instances For
Equations
- Lean.instInhabitedAttributeImpl = { default := { toAttributeImplCore := default, add := default, erase := default } }
Low level attribute registration function.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Helper methods for decoding the parameters of builtin attributes that are defined before Lean.Parser
.
We have the following ones:
@[builtin_attr_parser] def simple := leading_parser ident >> optional (ppSpace >> (priorityParser <|> ident))
@[builtin_attr_parser] def «macro» := leading_parser "macro " >> ident
@[builtin_attr_parser] def «export» := leading_parser "export " >> ident
Note that we need the parsers for class
, instance
, export
and macros
because they are keywords.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- Lean.Attribute.Builtin.getId? stx = do let ident? ← Lean.Attribute.Builtin.getIdent? stx pure (Lean.Syntax.getId <$> ident?)
Instances For
Equations
- Lean.Attribute.Builtin.getId stx = do let __do_lift ← Lean.Attribute.Builtin.getIdent stx pure __do_lift.getId
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
Tag attributes are simple and efficient. They are useful for marking declarations in the modules where they were defined.
The startup cost for this kind of attribute is very small since addImportedFn
is a constant function.
They provide the predicate tagAttr.hasTag env decl
which returns true iff declaration decl
is tagged in the environment env
.
- attr : Lean.AttributeImpl
Instances For
Equations
- Lean.instInhabitedTagAttribute = { default := { attr := default, ext := default } }
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
A TagAttribute
variant where we can attach parameters to attributes.
It is slightly more expensive and consumes a little bit more memory than TagAttribute
.
They provide the function pAttr.getParam env decl
which returns some p
iff declaration decl
contains the attribute pAttr
with parameter p
.
- attr : Lean.AttributeImpl
- ext : Lean.PersistentEnvExtension (Lean.Name × α) (Lean.Name × α) (Lean.NameMap α)
Instances For
Equations
- Lean.instInhabitedParametricAttribute = { default := { attr := default, ext := default } }
- getParam : Lean.Name → Lean.Syntax → Lean.AttrM α
- afterSet : Lean.Name → α → Lean.AttrM Unit
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
Given a list [a₁, ..., a_n]
of elements of type α
, EnumAttributes
provides an attribute Attr_i
for
associating a value a_i
with an declaration. α
is usually an enumeration type.
Note that whenever we register an EnumAttributes
, we create n
attributes, but only one environment extension.
- attrs : List Lean.AttributeImpl
- ext : Lean.PersistentEnvExtension (Lean.Name × α) (Lean.Name × α) (Lean.NameMap α)
Instances For
Equations
- Lean.instInhabitedEnumAttributes = { default := { attrs := default, ext := default } }
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
Attribute extension and builders. We use builders to implement attribute factories for parser categories.
Equations
Instances For
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
- builderId : Lean.Name
- ref : Lean.Name
- args : List Lean.DataValue
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
- newEntries : List Lean.AttributeExtensionOLeanEntry
Instances For
Equations
- Lean.instInhabitedAttributeExtensionState = { default := { newEntries := default, map := default } }
Equations
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
Return true iff n
is the name of a registered attribute.
Equations
- Lean.isBuiltinAttribute n = do let m ← ST.Ref.get Lean.attributeMapRef pure (m.contains n)
Instances For
Return the name of all registered attributes.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- Lean.getBuiltinAttributeApplicationTime n = do let attr ← Lean.getBuiltinAttributeImpl n pure attr.applicationTime
Instances For
Equations
- Lean.isAttribute env attrName = (Lean.PersistentEnvExtension.getState Lean.attributeExtension env).map.contains attrName
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- Lean.Attribute.add declName attrName stx kind = do let __do_lift ← Lean.getEnv let attr ← Lean.ofExcept (Lean.getAttributeImpl __do_lift attrName) attr.add declName stx kind
Instances For
Equations
- Lean.Attribute.erase declName attrName = do let __do_lift ← Lean.getEnv let attr ← Lean.ofExcept (Lean.getAttributeImpl __do_lift attrName) attr.erase declName
Instances For
updateEnvAttributes
implementation
Equations
- One or more equations did not get rendered due to their size.
Instances For
getNumBuiltinAttributes
implementation
Equations
- Lean.getNumBuiltinAttributesImpl = do let __do_lift ← ST.Ref.get Lean.attributeMapRef pure __do_lift.size