File: .lake/packages/lean4/src/lean/Lean/LabelAttribute.lean

full_name: Lean.LabelExtension
code: /-- An environment extension that just tracks an array of names. -/
abbrev LabelExtension 
goal: Type

full_name: Lean.LabelExtensionMap
code: /-- The collection of all current `LabelExtension`s, indexed by name. -/
abbrev LabelExtensionMap 
goal: Type

full_name: Lean.labelExtensionMapRef
code: /-- Store the current `LabelExtension`s. -/
builtin_initialize labelExtensionMapRef : IO.Ref LabelExtensionMap ← IO.mkRef {}
goal: IO.Ref Lean.LabelExtensionMap

full_name: Lean.initFn._@..lake.packages.lean4.src.lean.Lean.LabelAttribute._hyg.20
code: /-- Store the current `LabelExtension`s. -/
builtin_initialize labelExtensionMapRef : IO.Ref LabelExtensionMap ← IO.mkRef {}
goal: IO (IO.Ref Lean.LabelExtensionMap)

full_name: Lean.mkLabelExt
code: /-- Helper function for `registerLabelAttr`. -/
def mkLabelExt (name : Name := by exact decl_name%) : IO LabelExtension 
goal: IO Lean.LabelExtension

full_name: Lean.mkLabelAttr
code: /-- Helper function for `registerLabelAttr`. -/
def mkLabelAttr (attrName : Name) (attrDescr : String) (ext : LabelExtension)
  (ref : Name := by exact decl_name%) : IO Unit 
goal: IO Unit

full_name: Lean.registerLabelAttr
code: /--
Construct a new "label attribute",
which does nothing except keep track of the names of the declarations with that attribute.

Users will generally use the `register_label_attr` macro defined below.
-/
def registerLabelAttr (attrName : Name) (attrDescr : String)
    (ref : Name := by exact decl_name%) : IO LabelExtension 
goal: IO Lean.LabelExtension

full_name: Lean.«_aux_.lake_packages_lean4_src_lean_Lean_LabelAttribute___macroRules_Lean__root__Lean_Parser_Command_registerLabelAttr_1»
code: macro (name := _root_.Lean.Parser.Command.registerLabelAttr)
  doc:(docComment)? "register_label_attr " id:ident : command => do
  let str := id.getId.toString
  let idParser := mkIdentFrom id (`Parser.Attr ++ id.getId)
  let descr := quote ((doc.map (·.getDocString) |>.getD ("labelled declarations for " ++ id.getId.toString)).removeLeadingSpaces)
  `($[$doc:docComment]? initialize ext : Lean.LabelExtension ←
      registerLabelAttr $(quote id.getId) $descr $(quote id.getId)
    $[$doc:docComment]? syntax (name := $idParser:ident) $(quote str):str : attr)
goal: Lean.Macro

full_name: Lean.Parser.Command.registerLabelAttr
code: macro (name := _root_.Lean.Parser.Command.registerLabelAttr)
  doc:(docComment)? "register_label_attr " id:ident : command => do
  let str := id.getId.toString
  let idParser := mkIdentFrom id (`Parser.Attr ++ id.getId)
  let descr := quote ((doc.map (·.getDocString) |>.getD ("labelled declarations for " ++ id.getId.toString)).removeLeadingSpaces)
  `($[$doc:docComment]? initialize ext : Lean.LabelExtension ←
      registerLabelAttr $(quote id.getId) $descr $(quote id.getId)
    $[$doc:docComment]? syntax (name := $idParser:ident) $(quote str):str : attr)
goal: Lean.ParserDescr

full_name: Lean.labelled
code: /-- When `attrName` is an attribute created using `register_labelled_attr`,
return the names of all declarations labelled using that attribute. -/
def labelled (attrName : Name) : CoreM (Array Name) 
goal: Lean.CoreM (Array Lean.Name)