Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Public Member Functions | List of all members
dart::UnicodeRangeSplitter Class Reference

#include <regexp.h>

Inheritance diagram for dart::UnicodeRangeSplitter:
dart::ValueObject

Public Member Functions

 UnicodeRangeSplitter (Zone *zone, ZoneGrowableArray< CharacterRange > *base)
 
void Call (uint32_t from, ChoiceTable::Entry entry)
 
ZoneGrowableArray< CharacterRange > * bmp ()
 
ZoneGrowableArray< CharacterRange > * lead_surrogates ()
 
ZoneGrowableArray< CharacterRange > * trail_surrogates ()
 
ZoneGrowableArray< CharacterRange > * non_bmp () const
 
- Public Member Functions inherited from dart::ValueObject
 ValueObject ()
 
 ~ValueObject ()
 

Detailed Description

Definition at line 180 of file regexp.h.

Constructor & Destructor Documentation

◆ UnicodeRangeSplitter()

dart::UnicodeRangeSplitter::UnicodeRangeSplitter ( Zone zone,
ZoneGrowableArray< CharacterRange > *  base 
)

Definition at line 3899 of file regexp.cc.

3902 : zone_(zone),
3903 table_(zone),
3904 bmp_(nullptr),
3905 lead_surrogates_(nullptr),
3906 trail_surrogates_(nullptr),
3907 non_bmp_(nullptr) {
3908 // The unicode range splitter categorizes given character ranges into:
3909 // - Code points from the BMP representable by one code unit.
3910 // - Code points outside the BMP that need to be split into surrogate pairs.
3911 // - Lone lead surrogates.
3912 // - Lone trail surrogates.
3913 // Lone surrogates are valid code points, even though no actual characters.
3914 // They require special matching to make sure we do not split surrogate pairs.
3915 // We use the dispatch table to accomplish this. The base range is split up
3916 // by the table by the overlay ranges, and the Call callback is used to
3917 // filter and collect ranges for each category.
3918 for (intptr_t i = 0; i < base->length(); i++) {
3919 table_.AddRange(base->At(i), kBase, zone_);
3920 }
3921 // Add overlay ranges.
3923 kBmpCodePoints, zone_);
3926 kLeadSurrogates, zone_);
3929 kTrailSurrogates, zone_);
3930 table_.AddRange(
3932 kBmpCodePoints, zone_);
3933 table_.AddRange(
3935 kNonBmpCodePoints, zone_);
3936 table_.ForEach(this);
3937}
static CharacterRange Range(int32_t from, int32_t to)
Definition regexp.h:40
void AddRange(CharacterRange range, int32_t value, Zone *zone)
Definition regexp.cc:4989
void ForEach(Callback *callback)
Definition regexp.h:166
static constexpr int32_t kLeadSurrogateStart
Definition unicode.h:159
static constexpr int32_t kMaxCodeUnit
Definition unicode.h:158
static constexpr int32_t kTrailSurrogateStart
Definition unicode.h:161
static constexpr int32_t kTrailSurrogateEnd
Definition unicode.h:162
static constexpr int32_t kLeadSurrogateEnd
Definition unicode.h:160
static constexpr int32_t kMaxCodePoint
Definition unicode.h:18

Member Function Documentation

◆ bmp()

ZoneGrowableArray< CharacterRange > * dart::UnicodeRangeSplitter::bmp ( )
inline

Definition at line 185 of file regexp.h.

185{ return bmp_; }

◆ Call()

void dart::UnicodeRangeSplitter::Call ( uint32_t  from,
ChoiceTable::Entry  entry 
)

Definition at line 3939 of file regexp.cc.

3939 {
3940 OutSet* outset = entry.out_set();
3941 if (!outset->Get(kBase)) return;
3942 ZoneGrowableArray<CharacterRange>** target = nullptr;
3943 if (outset->Get(kBmpCodePoints)) {
3944 target = &bmp_;
3945 } else if (outset->Get(kLeadSurrogates)) {
3946 target = &lead_surrogates_;
3947 } else if (outset->Get(kTrailSurrogates)) {
3948 target = &trail_surrogates_;
3949 } else {
3950 ASSERT(outset->Get(kNonBmpCodePoints));
3951 target = &non_bmp_;
3952 }
3953 if (*target == nullptr) {
3954 *target = new (zone_) ZoneGrowableArray<CharacterRange>(2);
3955 }
3956 (*target)->Add(CharacterRange::Range(entry.from(), entry.to()));
3957}
static const int outset
Definition BlurTest.cpp:58
#define ASSERT(E)
uint32_t * target

◆ lead_surrogates()

ZoneGrowableArray< CharacterRange > * dart::UnicodeRangeSplitter::lead_surrogates ( )
inline

Definition at line 186 of file regexp.h.

186 {
187 return lead_surrogates_;
188 }

◆ non_bmp()

ZoneGrowableArray< CharacterRange > * dart::UnicodeRangeSplitter::non_bmp ( ) const
inline

Definition at line 192 of file regexp.h.

192{ return non_bmp_; }

◆ trail_surrogates()

ZoneGrowableArray< CharacterRange > * dart::UnicodeRangeSplitter::trail_surrogates ( )
inline

Definition at line 189 of file regexp.h.

189 {
190 return trail_surrogates_;
191 }

The documentation for this class was generated from the following files: