MCPcopy Create free account
hub / github.com/davidblewett/rure-python / parse_perl_class

Method parse_perl_class

regex/regex-syntax/src/ast/parse.rs:2094–2108  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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

Callers 1

parse_escapeMethod · 0.80

Calls 3

span_charMethod · 0.80
bumpMethod · 0.80
charMethod · 0.45

Tested by

no test coverage detected