| 1472 | // to cc and returns true. The iterator is advanced past the escape |
| 1473 | // on success, undefined on failure, in which case false is returned. |
| 1474 | private boolean parsePerlClassEscape(StringIterator t, CharClass cc) { |
| 1475 | int beforePos = t.pos(); |
| 1476 | if ((flags & RE2.PERL_X) == 0 |
| 1477 | || !t.more() |
| 1478 | || t.pop() != '\\' |
| 1479 | || // consume '\\' |
| 1480 | !t.more()) { |
| 1481 | return false; |
| 1482 | } |
| 1483 | t.pop(); // e.g. advance past 'd' in "\\d" |
| 1484 | CharGroup g = CharGroup.PERL_GROUPS.get(t.from(beforePos)); |
| 1485 | if (g == null) { |
| 1486 | return false; |
| 1487 | } |
| 1488 | cc.appendGroup(g, (flags & RE2.FOLD_CASE) != 0); |
| 1489 | return true; |
| 1490 | } |
| 1491 | |
| 1492 | // parseNamedClass parses a leading POSIX named character class like |
| 1493 | // [:alnum:] from the beginning of t. If one is present, it appends the |