mirror of
https://github.com/nim-lang/Nim.git
synced 2025-12-30 09:54:49 +00:00
23 lines
389 B
Nim
23 lines
389 B
Nim
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]
|
|
|
|
|