Zulip Chat Archive
Stream: metaprogramming / tactics
Topic: Constructing `docComment`
Leni Aniva (Jul 22 2025 at 05:52):
How can I programmatically construct a TSyntax Lean.Parser.Command.docComment`?
Is the only option to use Parser.runParserCategory?
Chris Bailey (Jul 22 2025 at 06:32):
I remember seeing this defined in a package:
def Lean.mkDocComment (s : String) :=
mkNode ``Parser.Command.docComment #[mkAtom "/--", mkAtom (s ++ "-/")]
/- Lean.mkDocComment "some text" : Lean.TSyntax `Lean.Parser.Command.docComment -/
#check Lean.mkDocComment "some text"
Leni Aniva (Jul 23 2025 at 21:18):
Chris Bailey said:
I remember seeing this defined in a package:
def Lean.mkDocComment (s : String) := mkNode ``Parser.Command.docComment #[mkAtom "/--", mkAtom (s ++ "-/")] /- Lean.mkDocComment "some text" : Lean.TSyntax `Lean.Parser.Command.docComment -/ #check Lean.mkDocComment "some text"
This seems to work well! Thanks!
Last updated: Dec 20 2025 at 21:32 UTC