diff options
author | Andreas Rumpf <rumpf_a@web.de> | 2015-04-21 08:58:28 +0200 |
---|---|---|
committer | Andreas Rumpf <rumpf_a@web.de> | 2015-04-21 08:58:28 +0200 |
commit | 1b80e2f296ef839a5c3f77d4e04b6425e4ea6ba9 (patch) | |
tree | c7d9402bc9b1f2474bce64508e769e274cfa9eca /lib/impure/re.nim | |
parent | f7f5a690a91c6b2c5c769b7f1c733040bb91d958 (diff) | |
parent | b4337e1b0fe5eaf769e669d3684b82a504b5dd12 (diff) | |
download | Nim-1b80e2f296ef839a5c3f77d4e04b6425e4ea6ba9.tar.gz |
Merge pull request #2506 from BlaXpirit/update-pcre
Update and improve PCRE wrapper
Diffstat (limited to 'lib/impure/re.nim')
-rw-r--r-- | lib/impure/re.nim | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/lib/impure/re.nim b/lib/impure/re.nim index c2f93ce79..fb95610f6 100644 --- a/lib/impure/re.nim +++ b/lib/impure/re.nim @@ -44,11 +44,11 @@ type reExtended = 3, ## ignore whitespace and ``#`` comments reStudy = 4 ## study the expression (may be omitted if the ## expression will be used only once) - - RegexDesc = object - h: PPcre - e: ptr TExtra - + + RegexDesc = object + h: ptr Pcre + e: ptr ExtraData + Regex* = ref RegexDesc ## a compiled regular expression RegexError* = object of ValueError @@ -63,7 +63,7 @@ proc raiseInvalidRegex(msg: string) {.noinline, noreturn.} = e.msg = msg raise e -proc rawCompile(pattern: string, flags: cint): PPcre = +proc rawCompile(pattern: string, flags: cint): ptr Pcre = var msg: cstring offset: cint @@ -87,7 +87,7 @@ proc re*(s: string, flags = {reExtended, reStudy}): Regex = result.h = rawCompile(s, cast[cint](flags - {reStudy})) if reStudy in flags: var msg: cstring - result.e = pcre.study(result.h, 0, msg) + result.e = pcre.study(result.h, 0, addr msg) if not isNil(msg): raiseInvalidRegex($msg) proc matchOrFind(s: string, pattern: Regex, matches: var openArray[string], |