Files
Nim/tests/accept/compile/tgenericmatcher.nim
2011-07-10 15:48:13 +02:00

23 lines
388 B
Nim
Executable File

discard """
disabled: true
"""
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]