diff options
author | Flaviu Tamas <tamasflaviu@gmail.com> | 2015-01-18 12:29:10 -0500 |
---|---|---|
committer | Flaviu Tamas <tamasflaviu@gmail.com> | 2015-01-18 12:29:10 -0500 |
commit | d62b41fa1cd7746166d7951f74f8599473c2e148 (patch) | |
tree | ebba1bffb6cbc17d81b52ed5ae65778a0cabe9d3 /src/nre.nim | |
parent | 1bcaa2172967f78513cb638bfc958e2e39d9a049 (diff) | |
download | Nim-d62b41fa1cd7746166d7951f74f8599473c2e148.tar.gz |
s/asTable/toTable/
toTable is more consistent with toSeq
Diffstat (limited to 'src/nre.nim')
-rw-r--r-- | src/nre.nim | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/nre.nim b/src/nre.nim index 6ba5f560f..fbc143cd1 100644 --- a/src/nre.nim +++ b/src/nre.nim @@ -137,7 +137,7 @@ proc `[]`*(pattern: Captures, name: string): string = let pattern = RegexMatch(pattern) return pattern.captures[pattern.pattern.captureNameToId.fget(name)] -template asTableImpl(cond: bool): stmt {.immediate, dirty.} = +template toTableImpl(cond: bool): stmt {.immediate, dirty.} = for key in RegexMatch(pattern).pattern.captureNameId.keys: let nextVal = pattern[key] if cond: @@ -145,16 +145,16 @@ template asTableImpl(cond: bool): stmt {.immediate, dirty.} = else: result[key] = nextVal -proc asTable*(pattern: Captures, default: string = nil): Table[string, string] = +proc toTable*(pattern: Captures, default: string = nil): Table[string, string] = ## Gets all the named captures and returns them result = initTable[string, string]() - asTableImpl(nextVal == nil) + toTableImpl(nextVal == nil) -proc asTable*(pattern: CaptureBounds, default = None[Slice[int]]()): +proc toTable*(pattern: CaptureBounds, default = None[Slice[int]]()): Table[string, Option[Slice[int]]] = ## Gets all the named captures and returns them result = initTable[string, Option[Slice[int]]]() - asTableImpl(nextVal.isNone) + toTableImpl(nextVal.isNone) template itemsImpl(cond: bool): stmt {.immediate, dirty.} = for i in 0 .. <RegexMatch(pattern).pattern.captureCount: |