Add $ operator

This commit is contained in:
Flaviu Tamas
2015-01-18 13:10:19 -05:00
parent f141737b9f
commit 2598909ffd
2 changed files with 4 additions and 0 deletions

View File

@@ -104,6 +104,7 @@ is inclusive.
`(captureBounds|captures).toTable` :: returns a table with each named capture
as a key.
`(captureBounds|capture).toSeq` :: returns all the captures by their number.
`$: string` :: same as `match`
=== Pattern

View File

@@ -175,6 +175,9 @@ proc toSeq*(pattern: CaptureBounds, default = None[Slice[int]]()): seq[Option[Sl
proc toSeq*(pattern: Captures, default: string = nil): seq[string] =
accumulateResult(pattern.items(default))
proc `$`*(pattern: RegexMatch): string =
return pattern.captures[-1]
# }}}
# Creation & Destruction {{{