Index: third_party/re2/re2/tostring.cc |
diff --git a/third_party/re2/re2/tostring.cc b/third_party/re2/re2/tostring.cc |
index 0230c8c9ca141ea18c5b7ff273ccb45bce2c70df..555524f291bca34a4a3e6dba0a29c3f9a98e8a6a 100644 |
--- a/third_party/re2/re2/tostring.cc |
+++ b/third_party/re2/re2/tostring.cc |
@@ -42,7 +42,7 @@ |
private: |
string* t_; // The string the walker appends to. |
- DISALLOW_COPY_AND_ASSIGN(ToStringWalker); |
+ DISALLOW_EVIL_CONSTRUCTORS(ToStringWalker); |
}; |
string Regexp::ToString() { |
@@ -94,8 +94,6 @@ |
case kRegexpCapture: |
t_->append("("); |
- if (re->cap() == 0) |
- LOG(DFATAL) << "kRegexpCapture cap() == 0"; |
if (re->name()) { |
t_->append("?P<"); |
t_->append(*re->name()); |
@@ -122,13 +120,13 @@ |
static void AppendLiteral(string *t, Rune r, bool foldcase) { |
if (r != 0 && r < 0x80 && strchr("(){}[]*+?|.^$\\", r)) { |
t->append(1, '\\'); |
- t->append(1, static_cast<char>(r)); |
+ t->append(1, r); |
} else if (foldcase && 'a' <= r && r <= 'z') { |
if ('a' <= r && r <= 'z') |
r += 'A' - 'a'; |
t->append(1, '['); |
- t->append(1, static_cast<char>(r)); |
- t->append(1, static_cast<char>(r) + 'a' - 'A'); |
+ t->append(1, r); |
+ t->append(1, r + 'a' - 'A'); |
t->append(1, ']'); |
} else { |
AppendCCRange(t, r, r); |
@@ -156,14 +154,12 @@ |
break; |
case kRegexpLiteral: |
- AppendLiteral(t_, re->rune(), |
- (re->parse_flags() & Regexp::FoldCase) != 0); |
+ AppendLiteral(t_, re->rune(), re->parse_flags() & Regexp::FoldCase); |
break; |
case kRegexpLiteralString: |
for (int i = 0; i < re->nrunes(); i++) |
- AppendLiteral(t_, re->runes()[i], |
- (re->parse_flags() & Regexp::FoldCase) != 0); |
+ AppendLiteral(t_, re->runes()[i], re->parse_flags() & Regexp::FoldCase); |
if (prec < PrecConcat) |
t_->append(")"); |
break; |
@@ -301,7 +297,7 @@ |
if (0x20 <= r && r <= 0x7E) { |
if (strchr("[]^-\\", r)) |
t->append("\\"); |
- t->append(1, static_cast<char>(r)); |
+ t->append(1, r); |
return; |
} |
switch (r) { |