feat: add elabModuleDoc
This commit is contained in:
parent
1fc1c4fe8b
commit
dca9278e09
1 changed files with 8 additions and 0 deletions
|
|
@ -3,11 +3,19 @@ Copyright (c) 2021 Microsoft Corporation. All rights reserved.
|
|||
Released under Apache 2.0 license as described in the file LICENSE.
|
||||
Authors: Leonardo de Moura
|
||||
-/
|
||||
import Lean.DocString
|
||||
import Lean.Elab.Command
|
||||
import Lean.Elab.Open
|
||||
|
||||
namespace Lean.Elab.Command
|
||||
|
||||
@[builtinCommandElab moduleDoc] def elabModuleDoc : CommandElab := fun stx =>
|
||||
match stx[1] with
|
||||
| Syntax.atom _ val =>
|
||||
let doc := val.extract 0 (val.bsize - 2)
|
||||
modifyEnv fun env => addMainModuleDoc env doc
|
||||
| _ => throwErrorAt stx "unexpected module doc string{indentD stx[1]}"
|
||||
|
||||
private def addScope (isNewNamespace : Bool) (header : String) (newNamespace : Name) : CommandElabM Unit := do
|
||||
modify fun s => { s with
|
||||
env := s.env.registerNamespace newNamespace,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue