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)
| 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 |
no test coverage detected