Add a range to the character class, but exclude newline if asked. Also handle case folding.
| 1598 | // Add a range to the character class, but exclude newline if asked. |
| 1599 | // Also handle case folding. |
| 1600 | void CharClassBuilder::AddRangeFlags( |
| 1601 | Rune lo, Rune hi, Regexp::ParseFlags parse_flags) { |
| 1602 | |
| 1603 | // Take out \n if the flags say so. |
| 1604 | bool cutnl = !(parse_flags & Regexp::ClassNL) || |
| 1605 | (parse_flags & Regexp::NeverNL); |
| 1606 | if (cutnl && lo <= '\n' && '\n' <= hi) { |
| 1607 | if (lo < '\n') |
| 1608 | AddRangeFlags(lo, '\n' - 1, parse_flags); |
| 1609 | if (hi > '\n') |
| 1610 | AddRangeFlags('\n' + 1, hi, parse_flags); |
| 1611 | return; |
| 1612 | } |
| 1613 | |
| 1614 | // If folding case, add fold-equivalent characters too. |
| 1615 | if (parse_flags & Regexp::FoldCase) |
| 1616 | AddFoldedRange(this, lo, hi, 0); |
| 1617 | else |
| 1618 | AddRange(lo, hi); |
| 1619 | } |
| 1620 | |
| 1621 | // Look for a group with the given name. |
| 1622 | static const UGroup* LookupGroup(const StringPiece& name, |
no test coverage detected