Simplifies a character class. Caller must Decref return value when done with it.
| 651 | // Simplifies a character class. |
| 652 | // Caller must Decref return value when done with it. |
| 653 | Regexp* SimplifyWalker::SimplifyCharClass(Regexp* re) { |
| 654 | CharClass* cc = re->cc(); |
| 655 | |
| 656 | // Special cases |
| 657 | if (cc->empty()) |
| 658 | return new Regexp(kRegexpNoMatch, re->parse_flags()); |
| 659 | if (cc->full()) |
| 660 | return new Regexp(kRegexpAnyChar, re->parse_flags()); |
| 661 | |
| 662 | return re->Incref(); |
| 663 | } |
| 664 | |
| 665 | } // namespace re2 |
nothing calls this directly
no test coverage detected