From ca299504d1dc3a23968c4ddf33fd64aa3f1a9422 Mon Sep 17 00:00:00 2001 From: Flaviu Tamas Date: Sun, 18 Jan 2015 12:49:22 -0500 Subject: [PATCH] Make study a negatable option instead --- README.asciidoc | 5 ++--- test/find.nim | 4 ++-- test/split.nim | 6 +++--- 3 files changed, 7 insertions(+), 8 deletions(-) diff --git a/README.asciidoc b/README.asciidoc index 46dfa1f5de..54afe8dcf7 100644 --- a/README.asciidoc +++ b/README.asciidoc @@ -109,7 +109,7 @@ as a key. Represents the pattern that things are matched against, constructed with `initRegex(string)` or `re(string)`. Examples: `re"foo"`, `re(r"foo # comment", -"Sx")`. +"x")`. `pattern: string` :: the string that was used to create the pattern. `captureCount: int` :: the number of captures that the pattern has. @@ -127,8 +127,6 @@ Represents the pattern that things are matched against, constructed with subject string - `N` - turn off auto-capture, `(?foo)` is necessary to capture. - `s` - `.` matches newline - - `S` - study the pattern to hopefully improve performance. JIT is unspported at - the moment. - `U` - expressions are not greedy by default. `?` can be added to a qualifier to make it greedy. - `u` - same as `8` @@ -152,3 +150,4 @@ ____ - `` - `\R` matches CR, LF, or CRLF - `` - `\R` matches any unicode newline - `` - Javascript compatibility + - `` - turn off studying; study is enabled by deafault diff --git a/test/find.nim b/test/find.nim index 1fd91f0d28..06f4d22cc5 100644 --- a/test/find.nim +++ b/test/find.nim @@ -4,12 +4,12 @@ include nre suite "find": test "find text": check("3213a".find(initRegex(r"[a-z]")).match == "a") - check("1 2 3 4 5 6 7 8 ".findAll(initRegex(r" ", "S")).map( + check("1 2 3 4 5 6 7 8 ".findAll(re" ").map( proc (a: RegexMatch): string = a.match ) == @[" ", " ", " ", " ", " ", " ", " ", " "]) test "find bounds": - check("1 2 3 4 5 ".findAll(initRegex(r" ", "S")).map( + check("1 2 3 4 5 ".findAll(re" ")).map( proc (a: RegexMatch): Slice[int] = a.matchBounds ) == @[1..2, 3..4, 5..6, 7..8, 9..10]) diff --git a/test/split.nim b/test/split.nim index 838f06261b..2dbb835d2b 100644 --- a/test/split.nim +++ b/test/split.nim @@ -4,9 +4,9 @@ include nre suite "string splitting": test "splitting strings": check("12345".split(initRegex("")) == @["1", "2", "3", "4", "5"]) - check("1 2 3 4 5 6 ".split(initRegex(" ", "S")) == @["1", "2", "3", "4", "5", "6", ""]) - check("1 2 ".split(initRegex(" ", "S")) == @["1", "", "2", "", ""]) - check("1 2".split(initRegex(" ", "S")) == @["1", "2"]) + check("1 2 3 4 5 6 ".split(re" ") == @["1", "2", "3", "4", "5", "6", ""]) + check("1 2 ".split(initRegex(" ")) == @["1", "", "2", "", ""]) + check("1 2".split(initRegex(" ")) == @["1", "2"]) check("foo".split(initRegex("foo")) == @["", ""]) test "captured patterns":