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

Method into_class_set_item

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

Convert this primitive into an item in a character class. If this primitive is not a legal item (i.e., an assertion or a dot), then return an error.

(
        self,
        p: &ParserI<P>,
    )

Source from the content-addressed store, hash-verified

67 /// If this primitive is not a legal item (i.e., an assertion or a dot),
68 /// then return an error.
69 fn into_class_set_item<P: Borrow<Parser>>(
70 self,
71 p: &ParserI<P>,
72 ) -> Result<ast::ClassSetItem> {
73 use ast::ClassSetItem;
74 use self::Primitive::*;
75
76 match self {
77 Literal(lit) => Ok(ClassSetItem::Literal(lit)),
78 Perl(cls) => Ok(ClassSetItem::Perl(cls)),
79 Unicode(cls) => Ok(ClassSetItem::Unicode(cls)),
80 x => Err(p.error(*x.span(), ast::ErrorKind::ClassEscapeInvalid)),
81 }
82 }
83
84 /// Convert this primitive into a literal in a character class. In
85 /// particular, literals are the only valid items that can appear in

Callers 1

parse_set_class_rangeMethod · 0.80

Calls 4

UnicodeClass · 0.85
LiteralClass · 0.70
errorMethod · 0.45
spanMethod · 0.45

Tested by

no test coverage detected