Convert this primitive into a literal in a character class. In particular, literals are the only valid items that can appear in ranges. If this primitive is not a legal item (i.e., a class, assertion or a dot), then return an error.
(
self,
p: &ParserI<P>,
)
| 88 | /// If this primitive is not a legal item (i.e., a class, assertion or a |
| 89 | /// dot), then return an error. |
| 90 | fn into_class_literal<P: Borrow<Parser>>( |
| 91 | self, |
| 92 | p: &ParserI<P>, |
| 93 | ) -> Result<ast::Literal> { |
| 94 | use self::Primitive::*; |
| 95 | |
| 96 | match self { |
| 97 | Literal(lit) => Ok(lit), |
| 98 | x => Err(p.error(*x.span(), ast::ErrorKind::ClassRangeLiteral)), |
| 99 | } |
| 100 | } |
| 101 | } |
| 102 | |
| 103 | /// Returns true if the given character is a hexadecimal digit. |
no test coverage detected