Fix deprecation warnings in re
This commit is contained in:
parent
7d06fc2165
commit
fd8c6d0a32
1 changed files with 7 additions and 7 deletions
|
|
@ -43,8 +43,8 @@ type
|
|||
## expression will be used only once)
|
||||
|
||||
RegexDesc = object
|
||||
h: PPcre
|
||||
e: ptr TExtra
|
||||
h: ptr Pcre
|
||||
e: ptr ExtraData
|
||||
|
||||
Regex* = ref RegexDesc ## a compiled regular expression
|
||||
|
||||
|
|
@ -60,7 +60,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
|
||||
|
|
@ -84,7 +84,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],
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue