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

#include <regexp.h>

Inheritance diagram for dart::BoyerMoorePositionInfo:
dart::ZoneAllocated

Public Member Functions

 BoyerMoorePositionInfo (Zone *zone)
 
bool & at (intptr_t i)
 
intptr_t map_count () const
 
void Set (intptr_t character)
 
void SetInterval (const Interval &interval)
 
void SetAll ()
 
bool is_non_word ()
 
bool is_word ()
 
- Public Member Functions inherited from dart::ZoneAllocated
 ZoneAllocated ()
 
void * operator new (size_t size)
 
void * operator new (size_t size, Zone *zone)
 
void operator delete (void *pointer)
 

Static Public Attributes

static constexpr intptr_t kMapSize = 128
 
static constexpr intptr_t kMask = kMapSize - 1
 

Detailed Description

Definition at line 1096 of file regexp.h.

Constructor & Destructor Documentation

◆ BoyerMoorePositionInfo()

dart::BoyerMoorePositionInfo::BoyerMoorePositionInfo ( Zone zone)
inlineexplicit

Definition at line 1098 of file regexp.h.

1099 : map_(new(zone) ZoneGrowableArray<bool>(kMapSize)),
1100 map_count_(0),
1101 w_(kNotYet),
1102 s_(kNotYet),
1103 d_(kNotYet),
1104 surrogate_(kNotYet) {
1105 for (intptr_t i = 0; i < kMapSize; i++) {
1106 map_->Add(false);
1107 }
1108 }
void Add(const T &value)
static constexpr intptr_t kMapSize
Definition regexp.h:1112
@ kNotYet
Definition regexp.h:1081

Member Function Documentation

◆ at()

bool & dart::BoyerMoorePositionInfo::at ( intptr_t  i)
inline

Definition at line 1110 of file regexp.h.

1110{ return (*map_)[i]; }

◆ is_non_word()

bool dart::BoyerMoorePositionInfo::is_non_word ( )
inline

Definition at line 1120 of file regexp.h.

1120{ return w_ == kLatticeOut; }
@ kLatticeOut
Definition regexp.h:1083

◆ is_word()

bool dart::BoyerMoorePositionInfo::is_word ( )
inline

Definition at line 1121 of file regexp.h.

1121{ return w_ == kLatticeIn; }
@ kLatticeIn
Definition regexp.h:1082

◆ map_count()

intptr_t dart::BoyerMoorePositionInfo::map_count ( ) const
inline

Definition at line 1115 of file regexp.h.

1115{ return map_count_; }

◆ Set()

void dart::BoyerMoorePositionInfo::Set ( intptr_t  character)

Definition at line 2788 of file regexp.cc.

2788 {
2790}
void SetInterval(const Interval &interval)
Definition regexp.cc:2792

◆ SetAll()

void dart::BoyerMoorePositionInfo::SetAll ( )

Definition at line 2816 of file regexp.cc.

2816 {
2817 s_ = w_ = d_ = kLatticeUnknown;
2818 if (map_count_ != kMapSize) {
2819 map_count_ = kMapSize;
2820 for (intptr_t i = 0; i < kMapSize; i++)
2821 (*map_)[i] = true;
2822 }
2823}
@ kLatticeUnknown
Definition regexp.h:1084

◆ SetInterval()

void dart::BoyerMoorePositionInfo::SetInterval ( const Interval interval)

Definition at line 2792 of file regexp.cc.

2792 {
2793 s_ = AddRange(s_, kSpaceRanges, kSpaceRangeCount, interval);
2794 w_ = AddRange(w_, kWordRanges, kWordRangeCount, interval);
2795 d_ = AddRange(d_, kDigitRanges, kDigitRangeCount, interval);
2796 surrogate_ =
2797 AddRange(surrogate_, kSurrogateRanges, kSurrogateRangeCount, interval);
2798 if (interval.to() - interval.from() >= kMapSize - 1) {
2799 if (map_count_ != kMapSize) {
2800 map_count_ = kMapSize;
2801 for (intptr_t i = 0; i < kMapSize; i++)
2802 (*map_)[i] = true;
2803 }
2804 return;
2805 }
2806 for (intptr_t i = interval.from(); i <= interval.to(); i++) {
2807 intptr_t mod_character = (i & kMask);
2808 if (!map_->At(mod_character)) {
2809 map_count_++;
2810 (*map_)[mod_character] = true;
2811 }
2812 if (map_count_ == kMapSize) return;
2813 }
2814}
const T & At(intptr_t index) const
static constexpr intptr_t kMask
Definition regexp.h:1113
static constexpr intptr_t kWordRangeCount
Definition regexp.cc:2778
static constexpr intptr_t kSurrogateRangeCount
Definition regexp.cc:2782
static constexpr int32_t kSpaceRanges[]
Definition regexp.cc:2771
ContainedInLattice AddRange(ContainedInLattice containment, const int32_t *ranges, intptr_t ranges_length, Interval new_range)
Definition regexp.cc:36
static constexpr int32_t kWordRanges[]
Definition regexp.cc:2776
static constexpr int32_t kSurrogateRanges[]
Definition regexp.cc:2781
static constexpr intptr_t kSpaceRangeCount
Definition regexp.cc:2775
static constexpr intptr_t kDigitRangeCount
Definition regexp.cc:2780
static constexpr int32_t kDigitRanges[]
Definition regexp.cc:2779

Member Data Documentation

◆ kMapSize

constexpr intptr_t dart::BoyerMoorePositionInfo::kMapSize = 128
staticconstexpr

Definition at line 1112 of file regexp.h.

◆ kMask

constexpr intptr_t dart::BoyerMoorePositionInfo::kMask = kMapSize - 1
staticconstexpr

Definition at line 1113 of file regexp.h.


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