summary refs log blame commit diff stats
path: root/tests/accept/compile/tgenericmatcher2.nim
blob: aa2f9dbb3228e314addaadabe83124e463d92ab8 (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18

















                                                   
type
  TMatcherKind = enum
    mkTerminal, mkSequence, mkAlternation, mkRepeat
  TMatcher[T] = object
    case kind: TMatcherKind
    of mkTerminal:
      value: T
    of mkSequence, mkAlternation:
      matchers: seq[TMatcher[T]]
    of mkRepeat:
      matcher: ref TMatcher[T]
      min, max: int

var 
  m: ref TMatcher[int]