@@ -39,30 +39,31 @@ namespace Lean.Elab.Command
3939 | _ => throwErrorAt stx "unexpected module doc string{indentD <| stx}"
4040
4141private def addScope (isNewNamespace : Bool) (header : String) (newNamespace : Name)
42- (isNoncomputable isPublic : Bool := false ) (attrs : List (TSyntax ``Parser.Term.attrInstance) := []) :
42+ (isNoncomputable isPublic isMeta : Bool := false ) (attrs : List (TSyntax ``Parser.Term.attrInstance) := []) :
4343 CommandElabM Unit := do
4444 modify fun s => { s with
4545 env := s.env.registerNamespace newNamespace,
4646 scopes := { s.scopes.head! with
4747 header := header, currNamespace := newNamespace
4848 isNoncomputable := s.scopes.head!.isNoncomputable || isNoncomputable
4949 isPublic := s.scopes.head!.isPublic || isPublic
50+ isMeta := s.scopes.head!.isMeta || isMeta
5051 attrs := s.scopes.head!.attrs ++ attrs
5152 } :: s.scopes
5253 }
5354 pushScope
5455 if isNewNamespace then
5556 activateScoped newNamespace
5657
57- private def addScopes (header : Name) (isNewNamespace : Bool) (isNoncomputable isPublic : Bool := false )
58+ private def addScopes (header : Name) (isNewNamespace : Bool) (isNoncomputable isPublic isMeta : Bool := false )
5859 (attrs : List (TSyntax ``Parser.Term.attrInstance) := []) : CommandElabM Unit :=
5960 go header
6061where go
6162 | .anonymous => pure ()
6263 | .str p header => do
6364 go p
6465 let currNamespace ← getCurrNamespace
65- addScope isNewNamespace header (if isNewNamespace then Name.mkStr currNamespace header else currNamespace) isNoncomputable isPublic attrs
66+ addScope isNewNamespace header (if isNewNamespace then Name.mkStr currNamespace header else currNamespace) isNoncomputable isPublic isMeta attrs
6667 | _ => throwError "invalid scope"
6768
6869private def addNamespace (header : Name) : CommandElabM Unit :=
@@ -99,16 +100,16 @@ private def checkEndHeader : Name → List Scope → Option Name
99100
100101@[builtin_command_elab «section»] def elabSection : CommandElab := fun stx => do
101102 match stx with
102- | `(Parser.Command.section| $[@[expose%$expTk] ]? $[public%$publicTk]? $[noncomputable %$ncTk]? section $(header?)?) =>
103+ | `(Parser.Command.section| $[@[expose%$expTk] ]? $[public%$publicTk]? $[noncomputable %$ncTk]? $[meta%$metaTk]? section $(header?)?) =>
103104 -- TODO: allow more attributes?
104105 let attrs ← if expTk.isSome then
105106 pure [← `(Parser.Term.attrInstance| expose)]
106107 else
107108 pure []
108109 if let some header := header? then
109- addScopes (isNewNamespace := false ) (isNoncomputable := ncTk.isSome) (isPublic := publicTk.isSome) (attrs := attrs) header.getId
110+ addScopes (isNewNamespace := false ) (isNoncomputable := ncTk.isSome) (isPublic := publicTk.isSome) (isMeta := metaTk.isSome) ( attrs := attrs) header.getId
110111 else
111- addScope (isNewNamespace := false ) (isNoncomputable := ncTk.isSome) (isPublic := publicTk.isSome) (attrs := attrs) "" (← getCurrNamespace)
112+ addScope (isNewNamespace := false ) (isNoncomputable := ncTk.isSome) (isPublic := publicTk.isSome) (isMeta := metaTk.isSome) ( attrs := attrs) "" (← getCurrNamespace)
112113 | _ => throwUnsupportedSyntax
113114
114115@[builtin_command_elab InternalSyntax.end_local_scope] def elabEndLocalScope : CommandElab := fun _ => do
0 commit comments