summary refs log tree commit diff stats
path: root/tests/template/ttempl5.nim
blob: a020a8e2c205b1db336d532ada9801972652aa52 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import mtempl5

echo templ()

#bug #892

proc parse_to_close(value: string, index: int, open='(', close=')'): int =
    discard

# Call parse_to_close
template get_next_ident: stmt =
    discard "{something}".parse_to_close(0, open = '{', close = '}')

get_next_ident()


#identifier expected, but found '(open|open|open)'

#bug #880 (also example in the manual!)

template typedef(name: expr, typ: typedesc) {.immediate.} =
  type
    `T name`* {.inject.} = typ
    `P name`* {.inject.} = ref `T name`

typedef(myint, int)
var x: PMyInt