From 1dc362dcd4e4752fce4d81800d965da8381790c8 Mon Sep 17 00:00:00 2001 From: Araq Date: Fri, 7 Dec 2012 17:20:51 +0100 Subject: compiler support for babel --- lib/pure/strtabs.nim | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/pure/strtabs.nim b/lib/pure/strtabs.nim index 09a243e97..77b463fc0 100755 --- a/lib/pure/strtabs.nim +++ b/lib/pure/strtabs.nim @@ -36,11 +36,23 @@ proc len*(t: PStringTable): int {.rtl, extern: "nst$1".} = result = t.counter iterator pairs*(t: PStringTable): tuple[key, value: string] = - ## iterates over any (key, value) pair in the table `t`. + ## iterates over every (key, value) pair in the table `t`. for h in 0..high(t.data): if not isNil(t.data[h].key): yield (t.data[h].key, t.data[h].val) +iterator keys*(t: PStringTable): string = + ## iterates over every key in the table `t`. + for h in 0..high(t.data): + if not isNil(t.data[h].key): + yield t.data[h].key + +iterator values*(t: PStringTable): string = + ## iterates over every value in the table `t`. + for h in 0..high(t.data): + if not isNil(t.data[h].key): + yield t.data[h].val + type TFormatFlag* = enum ## flags for the `%` operator useEnvironment, ## use environment variable if the ``$key`` -- cgit 1.4.1-2-gfad0