Zulip Chat Archive

Stream: lean4

Topic: pretty printing syntax quotations


Damiano Testa (Aug 05 2024 at 07:18):

I copy-pasted some command to obtain a pretty-printed format and I get an error in the example below: am I using this wrong?

import Lean.Elab.Command

open Lean Elab Command in
elab "pretty " cmd:command : command => do
  let fmt  liftCoreM do PrettyPrinter.ppCategory `command cmd
  dbg_trace fmt

-- fails, the `|` in `command|` confuses `pretty`
pretty run_cmd `(command| end)
/-
unknown constant '«|»'
-/

-- works
pretty run_cmd `(end)
/-
run_cmd
  `(end)
-/

Sebastian Ullrich (Aug 05 2024 at 07:58):

#lean4 > prettyprint command quotation

Damiano Testa (Aug 05 2024 at 07:59):

Thanks! And I had even looked for some related topic before posting! :man_facepalming:


Last updated: May 02 2025 at 03:31 UTC