Parse a Perl character class, e.g., `\d` or `\W`. This assumes the parser is currently at a valid character class name and will be advanced to the character immediately following the class.
(&self)
| 2092 | /// parser is currently at a valid character class name and will be |
| 2093 | /// advanced to the character immediately following the class. |
| 2094 | fn parse_perl_class(&self) -> ast::ClassPerl { |
| 2095 | let c = self.char(); |
| 2096 | let span = self.span_char(); |
| 2097 | self.bump(); |
| 2098 | let (negated, kind) = match c { |
| 2099 | 'd' => (false, ast::ClassPerlKind::Digit), |
| 2100 | 'D' => (true, ast::ClassPerlKind::Digit), |
| 2101 | 's' => (false, ast::ClassPerlKind::Space), |
| 2102 | 'S' => (true, ast::ClassPerlKind::Space), |
| 2103 | 'w' => (false, ast::ClassPerlKind::Word), |
| 2104 | 'W' => (true, ast::ClassPerlKind::Word), |
| 2105 | c => panic!("expected valid Perl class but got '{}'", c), |
| 2106 | }; |
| 2107 | ast::ClassPerl { span: span, kind: kind, negated: negated } |
| 2108 | } |
| 2109 | } |
| 2110 | |
| 2111 | /// A type that traverses a fully parsed Ast and checks whether its depth |
no test coverage detected