From efb4f7d89caaabfb845c77fd6301e7dba7467faa Mon Sep 17 00:00:00 2001 From: Flaviu Tamas Date: Mon, 12 Jan 2015 21:06:25 -0500 Subject: [PATCH] Added some documentation --- src/nre.nim | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/nre.nim b/src/nre.nim index 72a5aa7607..d2ee0f13b1 100644 --- a/src/nre.nim +++ b/src/nre.nim @@ -11,13 +11,15 @@ from unicode import runeLenAt # Type definitions {{{ type Regex* = ref object - pattern*: string # not nil - pcreObj: ptr pcre.Pcre # not nil + ## Represents a compiled pattern + pattern*: string ## not nil + pcreObj: ptr pcre.Pcre ## not nil pcreExtra: ptr pcre.ExtraData ## nil captureNameToId: Table[string, int] RegexMatch* = ref object + ## Is returned upon a match. pattern*: Regex ## The regex doing the matching. ## Not nil. str*: string ## The string that was matched against. @@ -31,10 +33,15 @@ type CaptureBounds* = distinct RegexMatch 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 pattern*: string ## the pattern that caused the problem 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 =