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

Method into_class_literal

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

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>,
    )

Source from the content-addressed store, hash-verified

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.

Callers 1

parse_set_class_rangeMethod · 0.80

Calls 2

errorMethod · 0.45
spanMethod · 0.45

Tested by

no test coverage detected