Extend Regex, add RegexMatch
This commit is contained in:
parent
3a6e7941cf
commit
c4d536f581
1 changed files with 8 additions and 2 deletions
10
src/nre.nim
10
src/nre.nim
|
|
@ -65,8 +65,13 @@ proc tokenizeOptions(opts: string): tuple[flags: int, study: bool] =
|
|||
|
||||
type
|
||||
Regex* = ref object
|
||||
pcreObj: ptr pcre.Pcre
|
||||
pcreExtra: ptr pcre.ExtraData
|
||||
pattern: string # not nil
|
||||
pcreObj: ptr pcre.Pcre # not nil
|
||||
pcreExtra: ptr pcre.ExtraData ## nil
|
||||
|
||||
RegexMatch* = object
|
||||
pattern: Regex
|
||||
matchBounds: Slice[int]
|
||||
|
||||
SyntaxError* = ref object of Exception
|
||||
pos*: int ## the location of the syntax error in bytes
|
||||
|
|
@ -76,6 +81,7 @@ type
|
|||
|
||||
proc initRegex*(pattern: string, options = "Sx"): Regex =
|
||||
new result
|
||||
result.pattern = pattern
|
||||
|
||||
var errorMsg: cstring
|
||||
var errOffset: cint
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue