-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #290 from HEPLean/Docs
feat: Update TODO list mechanism
- Loading branch information
Showing
37 changed files
with
183 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
/- | ||
Copyright (c) 2024 Joseph Tooby-Smith. All rights reserved. | ||
Released under Apache 2.0 license. | ||
Authors: Joseph Tooby-Smith | ||
-/ | ||
import Batteries.Lean.HashSet | ||
import Mathlib.Lean.Expr.Basic | ||
import Mathlib.Lean.CoreM | ||
import ImportGraph.RequiredModules | ||
/-! | ||
# Basic underlying structure for TODOs. | ||
-/ | ||
|
||
namespace HepLean | ||
open Lean System Meta | ||
|
||
/-- The information from a `TODO ...` command. -/ | ||
structure todoInfo where | ||
/-- The content of the note. -/ | ||
content : String | ||
/-- The file name where the note came from. -/ | ||
fileName : Name | ||
/-- The line from where the note came from. -/ | ||
line : Nat | ||
|
||
/-- Environment extension to store `todo ...`. -/ | ||
initialize todoExtension : SimplePersistentEnvExtension todoInfo (Array todoInfo) ← | ||
registerSimplePersistentEnvExtension { | ||
name := `todoExtension | ||
addEntryFn := fun arr todoInfor => arr.push todoInfor | ||
addImportedFn := fun es => es.foldl (· ++ ·) #[] | ||
} | ||
|
||
/-- Syntax for the `TODO ...` command. -/ | ||
syntax (name := todo_comment) "TODO " str : command | ||
|
||
/-- Elaborator for the `TODO ...` command -/ | ||
@[command_elab todo_comment] | ||
def elabTODO : Lean.Elab.Command.CommandElab := fun stx => | ||
match stx with | ||
| `(TODO $s) => do | ||
let str : String := s.getString | ||
let pos := stx.getPos? | ||
match pos with | ||
| some pos => do | ||
let env ← getEnv | ||
let fileMap ← getFileMap | ||
let filePos := fileMap.toPosition pos | ||
let line := filePos.line | ||
let modName := env.mainModule | ||
let todoInfo : todoInfo := { content := str, fileName := modName, line := line } | ||
modifyEnv fun env => todoExtension.addEntry env todoInfo | ||
| none => throwError "Invalid syntax for `TODO` command" | ||
| _ => throwError "Invalid syntax for `TODO` command" | ||
|
||
end HepLean |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.