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

Method parse_set_class_item

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

Parse a single item in a character class as a primitive, where the primitive either consists of a verbatim literal or a single escape sequence. This assumes the parser is positioned at the beginning of a primitive, and advances the parser to the first position after the primitive if successful. Note that it is the caller's responsibility to report an error if an illegal primitive was parsed.

(&self)

Source from the content-addressed store, hash-verified

1849 /// Note that it is the caller's responsibility to report an error if an
1850 /// illegal primitive was parsed.
1851 fn parse_set_class_item(&self) -> Result<Primitive> {
1852 if self.char() == '\\' {
1853 self.parse_escape()
1854 } else {
1855 let x = Primitive::Literal(ast::Literal {
1856 span: self.span_char(),
1857 kind: ast::LiteralKind::Verbatim,
1858 c: self.char(),
1859 });
1860 self.bump();
1861 Ok(x)
1862 }
1863 }
1864
1865 /// Parses the opening of a character class set. This includes the opening
1866 /// bracket along with `^` if present to indicate negation. This also

Callers 1

parse_set_class_rangeMethod · 0.80

Calls 5

parse_escapeMethod · 0.80
span_charMethod · 0.80
bumpMethod · 0.80
LiteralClass · 0.70
charMethod · 0.45

Tested by

no test coverage detected