Flutter Engine
The Flutter Engine
Public Member Functions | List of all members
dart::RegExpDisjunction Class Reference

#include <regexp_ast.h>

Inheritance diagram for dart::RegExpDisjunction:
dart::RegExpTree dart::ZoneAllocated

Public Member Functions

 RegExpDisjunction (ZoneGrowableArray< RegExpTree * > *alternatives)
 
virtual void * Accept (RegExpVisitor *visitor, void *data)
 
virtual RegExpNodeToNode (RegExpCompiler *compiler, RegExpNode *on_success)
 
virtual RegExpDisjunctionAsDisjunction ()
 
virtual Interval CaptureRegisters () const
 
virtual bool IsDisjunction () const
 
virtual bool IsAnchoredAtStart () const
 
virtual bool IsAnchoredAtEnd () const
 
virtual intptr_t min_match () const
 
virtual intptr_t max_match () const
 
ZoneGrowableArray< RegExpTree * > * alternatives () const
 
- Public Member Functions inherited from dart::RegExpTree
virtual ~RegExpTree ()
 
virtual void * Accept (RegExpVisitor *visitor, void *data)=0
 
virtual RegExpNodeToNode (RegExpCompiler *compiler, RegExpNode *on_success)=0
 
virtual bool IsTextElement () const
 
virtual bool IsAnchoredAtStart () const
 
virtual bool IsAnchoredAtEnd () const
 
virtual intptr_t min_match () const =0
 
virtual intptr_t max_match () const =0
 
virtual Interval CaptureRegisters () const
 
virtual void AppendToText (RegExpText *text)
 
void Print ()
 
- 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)
 

Additional Inherited Members

- Static Public Attributes inherited from dart::RegExpTree
static constexpr intptr_t kInfinity = kMaxInt32
 

Detailed Description

Definition at line 61 of file regexp_ast.h.

Constructor & Destructor Documentation

◆ RegExpDisjunction()

dart::RegExpDisjunction::RegExpDisjunction ( ZoneGrowableArray< RegExpTree * > *  alternatives)
explicit

Definition at line 277 of file regexp_ast.cc.

279 : alternatives_(alternatives) {
280 ASSERT(alternatives->length() > 1);
281 RegExpTree* first_alternative = alternatives->At(0);
282 min_match_ = first_alternative->min_match();
283 max_match_ = first_alternative->max_match();
284 for (intptr_t i = 1; i < alternatives->length(); i++) {
285 RegExpTree* alternative = alternatives->At(i);
286 min_match_ = Utils::Minimum(min_match_, alternative->min_match());
287 max_match_ = Utils::Maximum(max_match_, alternative->max_match());
288 }
289}
ZoneGrowableArray< RegExpTree * > * alternatives() const
Definition: regexp_ast.h:73
static constexpr T Maximum(T x, T y)
Definition: utils.h:41
static T Minimum(T x, T y)
Definition: utils.h:36
#define ASSERT(E)

Member Function Documentation

◆ Accept()

virtual void * dart::RegExpDisjunction::Accept ( RegExpVisitor visitor,
void *  data 
)
virtual

Implements dart::RegExpTree.

◆ alternatives()

ZoneGrowableArray< RegExpTree * > * dart::RegExpDisjunction::alternatives ( ) const
inline

Definition at line 73 of file regexp_ast.h.

73{ return alternatives_; }

◆ AsDisjunction()

virtual RegExpDisjunction * dart::RegExpDisjunction::AsDisjunction ( )
virtual

◆ CaptureRegisters()

Interval dart::RegExpDisjunction::CaptureRegisters ( ) const
virtual

Reimplemented from dart::RegExpTree.

Definition at line 50 of file regexp_ast.cc.

50 {
52}
static Interval ListCaptureRegisters(ZoneGrowableArray< RegExpTree * > *children)
Definition: regexp_ast.cc:39

◆ IsAnchoredAtEnd()

bool dart::RegExpDisjunction::IsAnchoredAtEnd ( ) const
virtual

Reimplemented from dart::RegExpTree.

Definition at line 111 of file regexp_ast.cc.

111 {
112 ZoneGrowableArray<RegExpTree*>* alternatives = this->alternatives();
113 for (intptr_t i = 0; i < alternatives->length(); i++) {
114 if (!alternatives->At(i)->IsAnchoredAtEnd()) return false;
115 }
116 return true;
117}

◆ IsAnchoredAtStart()

bool dart::RegExpDisjunction::IsAnchoredAtStart ( ) const
virtual

Reimplemented from dart::RegExpTree.

Definition at line 103 of file regexp_ast.cc.

103 {
104 ZoneGrowableArray<RegExpTree*>* alternatives = this->alternatives();
105 for (intptr_t i = 0; i < alternatives->length(); i++) {
106 if (!alternatives->At(i)->IsAnchoredAtStart()) return false;
107 }
108 return true;
109}

◆ IsDisjunction()

virtual bool dart::RegExpDisjunction::IsDisjunction ( ) const
virtual

◆ max_match()

virtual intptr_t dart::RegExpDisjunction::max_match ( ) const
inlinevirtual

Implements dart::RegExpTree.

Definition at line 72 of file regexp_ast.h.

72{ return max_match_; }

◆ min_match()

virtual intptr_t dart::RegExpDisjunction::min_match ( ) const
inlinevirtual

Implements dart::RegExpTree.

Definition at line 71 of file regexp_ast.h.

71{ return min_match_; }

◆ ToNode()

RegExpNode * dart::RegExpDisjunction::ToNode ( RegExpCompiler compiler,
RegExpNode on_success 
)
virtual

Implements dart::RegExpTree.

Definition at line 4203 of file regexp.cc.

4204 {
4205 ZoneGrowableArray<RegExpTree*>* alternatives = this->alternatives();
4206 intptr_t length = alternatives->length();
4207 ChoiceNode* result = new (OZ) ChoiceNode(length, OZ);
4208 for (intptr_t i = 0; i < length; i++) {
4209 GuardedAlternative alternative(
4210 alternatives->At(i)->ToNode(compiler, on_success));
4211 result->AddAlternative(alternative);
4212 }
4213 return result;
4214}
GAsyncResult * result
size_t length
#define OZ
Definition: regexp.cc:3793

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