Enum regex_syntax::ast::parse::Primitive
source · enum Primitive {
Literal(Literal),
Assertion(Assertion),
Dot(Span),
Perl(ClassPerl),
Unicode(ClassUnicode),
}
Expand description
A primitive is an expression with no sub-expressions. This includes literals, assertions and non-set character classes. This representation is used as intermediate state in the parser.
This does not include ASCII character classes, since they can only appear within a set character class.
Variants§
Implementations§
source§impl Primitive
impl Primitive
sourcefn into_class_set_item<P: Borrow<Parser>>(
self,
p: &ParserI<'_, P>,
) -> Result<ClassSetItem, Error>
fn into_class_set_item<P: Borrow<Parser>>( self, p: &ParserI<'_, P>, ) -> Result<ClassSetItem, Error>
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.
sourcefn into_class_literal<P: Borrow<Parser>>(
self,
p: &ParserI<'_, P>,
) -> Result<Literal, Error>
fn into_class_literal<P: Borrow<Parser>>( self, p: &ParserI<'_, P>, ) -> Result<Literal, Error>
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.
Trait Implementations§
source§impl PartialEq for Primitive
impl PartialEq for Primitive
impl Eq for Primitive
impl StructuralPartialEq for Primitive
Auto Trait Implementations§
impl Freeze for Primitive
impl RefUnwindSafe for Primitive
impl Send for Primitive
impl Sync for Primitive
impl Unpin for Primitive
impl UnwindSafe for Primitive
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more