aboutsummaryrefslogtreecommitdiff
path: root/re2/re2.h
diff options
context:
space:
mode:
authorMike Nazarewicz <mpn@google.com>2014-01-09 21:43:59 -0500
committerRuss Cox <rsc@swtch.com>2014-01-09 21:43:59 -0500
commit9c26e80f62c7792469249d32cdbc5fbdaf3e35a1 (patch)
treeb4bbc488affd69ee1b51ef154dded32bd092687b /re2/re2.h
parent59d96121fea1bab268b5969b2a7344f0bdfdaeb0 (diff)
downloadregex-re2-9c26e80f62c7792469249d32cdbc5fbdaf3e35a1.tar.gz
re2: add dot_nl to the RE2::Options class
This allows clients to set the ā€œsā€ flag by default for a given regular expression without the need to mess with the pattern by prefixing it with ā€œ(?s)ā€. This matters if the pattern comes from the user. Fixes issue 70. R=rsc CC=re2-dev https://codereview.appspot.com/44070048
Diffstat (limited to 're2/re2.h')
-rw-r--r--re2/re2.h9
1 files changed, 8 insertions, 1 deletions
diff --git a/re2/re2.h b/re2/re2.h
index e0ee080..2774031 100644
--- a/re2/re2.h
+++ b/re2/re2.h
@@ -515,6 +515,7 @@ class RE2 {
// max_mem (see below) approx. max memory footprint of RE2
// literal (false) interpret string as literal, not regexp
// never_nl (false) never match \n, even if it is in regexp
+ // dot_nl (false) dot matches everything including new line
// never_capture (false) parse all parens as non-capturing
// case_sensitive (true) match is case-sensitive (regexp can override
// with (?i) unless in posix_syntax mode)
@@ -570,13 +571,14 @@ class RE2 {
max_mem_(kDefaultMaxMem),
literal_(false),
never_nl_(false),
+ dot_nl_(false),
never_capture_(false),
case_sensitive_(true),
perl_classes_(false),
word_boundary_(false),
one_line_(false) {
}
-
+
/*implicit*/ Options(CannedOptions);
Encoding encoding() const { return encoding_; }
@@ -611,6 +613,9 @@ class RE2 {
bool never_nl() const { return never_nl_; }
void set_never_nl(bool b) { never_nl_ = b; }
+ bool dot_nl() const { return dot_nl_; }
+ void set_dot_nl(bool b) { dot_nl_ = b; }
+
bool never_capture() const { return never_capture_; }
void set_never_capture(bool b) { never_capture_ = b; }
@@ -634,6 +639,7 @@ class RE2 {
max_mem_ = src.max_mem_;
literal_ = src.literal_;
never_nl_ = src.never_nl_;
+ dot_nl_ = src.dot_nl_;
never_capture_ = src.never_capture_;
case_sensitive_ = src.case_sensitive_;
perl_classes_ = src.perl_classes_;
@@ -651,6 +657,7 @@ class RE2 {
int64_t max_mem_;
bool literal_;
bool never_nl_;
+ bool dot_nl_;
bool never_capture_;
bool case_sensitive_;
bool perl_classes_;