lean4-htt/src/Init/Data/ToString/Macro.lean
2020-10-23 12:50:03 -07:00

17 lines
484 B
Text

#lang lean4
/-
Copyright (c) 2020 Microsoft Corporation. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Author: Leonardo de Moura
-/
prelude
import Init.LeanInit
import Init.Data.ToString.Basic
syntax:max "s!" (interpolatedStr term) : term
macro_rules
| `(s! $interpStr) => do
let chunks := interpStr.getArgs
let r ← Lean.Syntax.expandInterpolatedStrChunks chunks (fun a b => `($a ++ $b)) (fun a => `(toString $a))
`(($r : String))