pub struct RE {
pub nullable: bool,
/* private fields */
}
Expand description
Regular expression structure
A regular expression includes an expression of type BaseRegLan, which is an abstract syntax tree.
In addition, each regular expression e has a unique integer id and three attributes:
- e.nullable is true if the language of e contains the empty string
- e.singleton is true if the language of e contains a single string
- e.deriv_class is the list of derivative classes of e.
The derivative classes are disjoint interval characters that cover
a subset of the alphabet, and a complementary class that covers the rest.
See CharPartition. The deriv_class
partition is
constructed to ensure that all the characters in a class produce the same
derivative of e: if c1 and c2 are in the same derivative class of e then
deriv(e, c1) and deriv(e, c2) are equal.
Operations on regular expressions use hash-consing and are performed with an ReManager.
Fields§
§nullable: bool
Whether the language contains the empty string
Implementations§
Source§impl RE
impl RE
Sourcepub fn empty_complement(&self) -> bool
pub fn empty_complement(&self) -> bool
check whether the complementary class is empty
Sourcepub fn num_deriv_classes(&self) -> usize
pub fn num_deriv_classes(&self) -> usize
number of derivative classes (not including the complementary class)
Sourcepub fn valid_class_id(&self, cid: ClassId) -> bool
pub fn valid_class_id(&self, cid: ClassId) -> bool
check whether cid is a valid class id
Sourcepub fn class_ids(&self) -> ClassIdIterator<'_> ⓘ
pub fn class_ids(&self) -> ClassIdIterator<'_> ⓘ
iterator to go through valid classIds
Sourcepub fn char_ranges(&self) -> impl Iterator<Item = &CharSet>
pub fn char_ranges(&self) -> impl Iterator<Item = &CharSet>
iterator to go through the intervals in an RE derivative classes
Sourcepub fn included_in(&self, other: &Self) -> bool
pub fn included_in(&self, other: &Self) -> bool
incomplete check for inclusion
- if this returns true then self is included in other
- otherwise, we don’t know
Trait Implementations§
Source§impl Ord for RE
impl Ord for RE
Source§impl PartialEq for RE
Equality on RE is derived from the unique ids.
impl PartialEq for RE
Equality on RE is derived from the unique ids.
Two REs are equal iff they have the same id.
Source§impl PartialOrd for RE
Ordering on REs is based on unique ids.
impl PartialOrd for RE
Ordering on REs is based on unique ids.
We have re1 < re2 iff re1.id < re2.id