Added some documentation
This commit is contained in:
parent
e0cdad635b
commit
efb4f7d89c
1 changed files with 9 additions and 2 deletions
11
src/nre.nim
11
src/nre.nim
|
|
@ -11,13 +11,15 @@ from unicode import runeLenAt
|
||||||
# Type definitions {{{
|
# Type definitions {{{
|
||||||
type
|
type
|
||||||
Regex* = ref object
|
Regex* = ref object
|
||||||
pattern*: string # not nil
|
## Represents a compiled pattern
|
||||||
pcreObj: ptr pcre.Pcre # not nil
|
pattern*: string ## not nil
|
||||||
|
pcreObj: ptr pcre.Pcre ## not nil
|
||||||
pcreExtra: ptr pcre.ExtraData ## nil
|
pcreExtra: ptr pcre.ExtraData ## nil
|
||||||
|
|
||||||
captureNameToId: Table[string, int]
|
captureNameToId: Table[string, int]
|
||||||
|
|
||||||
RegexMatch* = ref object
|
RegexMatch* = ref object
|
||||||
|
## Is returned upon a match.
|
||||||
pattern*: Regex ## The regex doing the matching.
|
pattern*: Regex ## The regex doing the matching.
|
||||||
## Not nil.
|
## Not nil.
|
||||||
str*: string ## The string that was matched against.
|
str*: string ## The string that was matched against.
|
||||||
|
|
@ -31,10 +33,15 @@ type
|
||||||
CaptureBounds* = distinct RegexMatch
|
CaptureBounds* = distinct RegexMatch
|
||||||
|
|
||||||
SyntaxError* = ref object of Exception
|
SyntaxError* = ref object of Exception
|
||||||
|
## Thrown when there is a syntax error in the
|
||||||
|
## regular expression string passed in
|
||||||
pos*: int ## the location of the syntax error in bytes
|
pos*: int ## the location of the syntax error in bytes
|
||||||
pattern*: string ## the pattern that caused the problem
|
pattern*: string ## the pattern that caused the problem
|
||||||
|
|
||||||
StudyError* = ref object of Exception
|
StudyError* = ref object of Exception
|
||||||
|
## Thrown when studying the regular expression failes
|
||||||
|
## for whatever reason. The message contains the error
|
||||||
|
## code.
|
||||||
# }}}
|
# }}}
|
||||||
|
|
||||||
proc getinfo[T](pattern: Regex, opt: cint): T =
|
proc getinfo[T](pattern: Regex, opt: cint): T =
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue