summary refs log blame commit diff stats
path: root/examples/talk/quasiquote.nim
blob: df4003e6e38091e038416503996a95ef817a34f6 (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11










                                                  
import macros

macro check(ex: expr): stmt =
  var info = ex.lineinfo
  var expString = ex.toStrLit
  result = quote do:
    if not `ex`:
      echo `info`, ": Check failed: ", `expString`

check 1 < 2