diff options
author | Flaviu Tamas <tamasflaviu@gmail.com> | 2015-01-10 13:31:13 -0500 |
---|---|---|
committer | Flaviu Tamas <tamasflaviu@gmail.com> | 2015-01-10 13:31:13 -0500 |
commit | 613d12c7bfc9e191c1dfcf697d55dbe434e47d06 (patch) | |
tree | f6e625de6a14ca95ceb573b32e9401747c283201 /src/nre.nim | |
parent | be984d3b0758dae281f2778b2ee07519715d474d (diff) | |
download | Nim-613d12c7bfc9e191c1dfcf697d55dbe434e47d06.tar.gz |
Simplify thin wrapper
Diffstat (limited to 'src/nre.nim')
-rw-r--r-- | src/nre.nim | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/nre.nim b/src/nre.nim index 2611ee7f6..1cd534cc0 100644 --- a/src/nre.nim +++ b/src/nre.nim @@ -78,6 +78,7 @@ type StudyError* = ref object of Exception +# Creation & Destruction {{{ proc destroyRegex(self: Regex) = pcre.free_substring(cast[cstring](self.pcreObj)) self.pcreObj = nil @@ -106,11 +107,13 @@ proc initRegex*(pattern: string, options = "Sx"): Regex = result.pcreExtra = pcre.study(result.pcreObj, 0x0, addr errorMsg) if result.pcreExtra == nil: raise StudyError(msg: $errorMsg) +# }}} proc getinfo[T](self: Regex, opt: cint): T = let retcode = pcre.fullinfo(self.pcreObj, self.pcreExtra, opt, addr result) if retcode < 0: + # XXX Error message that doesn't expose implementation details raise newException(FieldError, "Invalid getinfo for $1, errno $2" % [$opt, $retcode]) proc getCaptureCount(self: Regex): int = |