summary refs log blame commit diff stats
path: root/tests/compile/tgenericmatcher.nim
blob: edd0c4cf132a7af783f19f3573ce0651ada3e882 (plain) (tree)
1
2
3
           
                 
   


















                                                   
discard """
  disabled: false
"""

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: PMatcher[T]
      min, max: int
  PMatcher[T] = ref TMatcher[T]

var 
  m: PMatcher[int]