Flutter Engine
The Flutter Engine
Classes | Public Types | Public Member Functions | List of all members
dart::RegExpLookaround Class Reference

#include <regexp_ast.h>

Inheritance diagram for dart::RegExpLookaround:
dart::RegExpTree dart::ZoneAllocated

Classes

class  Builder
 

Public Types

enum  Type { LOOKAHEAD , LOOKBEHIND }
 

Public Member Functions

 RegExpLookaround (RegExpTree *body, bool is_positive, intptr_t capture_count, intptr_t capture_from, Type type)
 
virtual void * Accept (RegExpVisitor *visitor, void *data)
 
virtual RegExpNodeToNode (RegExpCompiler *compiler, RegExpNode *on_success)
 
virtual RegExpLookaroundAsLookaround ()
 
virtual Interval CaptureRegisters () const
 
virtual bool IsLookaround () const
 
virtual bool IsAnchoredAtStart () const
 
virtual intptr_t min_match () const
 
virtual intptr_t max_match () const
 
RegExpTreebody () const
 
bool is_positive () const
 
intptr_t capture_count () const
 
intptr_t capture_from () const
 
Type type () 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 346 of file regexp_ast.h.

Member Enumeration Documentation

◆ Type

Enumerator
LOOKAHEAD 
LOOKBEHIND 

Definition at line 348 of file regexp_ast.h.

Constructor & Destructor Documentation

◆ RegExpLookaround()

dart::RegExpLookaround::RegExpLookaround ( RegExpTree body,
bool  is_positive,
intptr_t  capture_count,
intptr_t  capture_from,
Type  type 
)
inline

Definition at line 349 of file regexp_ast.h.

354 : body_(body),
355 is_positive_(is_positive),
356 capture_count_(capture_count),
357 capture_from_(capture_from),
358 type_(type) {}
RegExpTree * body() const
Definition: regexp_ast.h:368
bool is_positive() const
Definition: regexp_ast.h:369
intptr_t capture_count() const
Definition: regexp_ast.h:370
intptr_t capture_from() const
Definition: regexp_ast.h:371

Member Function Documentation

◆ Accept()

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

Implements dart::RegExpTree.

◆ AsLookaround()

virtual RegExpLookaround * dart::RegExpLookaround::AsLookaround ( )
virtual

◆ body()

RegExpTree * dart::RegExpLookaround::body ( ) const
inline

Definition at line 368 of file regexp_ast.h.

368{ return body_; }

◆ capture_count()

intptr_t dart::RegExpLookaround::capture_count ( ) const
inline

Definition at line 370 of file regexp_ast.h.

370{ return capture_count_; }

◆ capture_from()

intptr_t dart::RegExpLookaround::capture_from ( ) const
inline

Definition at line 371 of file regexp_ast.h.

371{ return capture_from_; }

◆ CaptureRegisters()

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

Reimplemented from dart::RegExpTree.

Definition at line 54 of file regexp_ast.cc.

54 {
55 return body()->CaptureRegisters();
56}
virtual Interval CaptureRegisters() const
Definition: regexp_ast.h:51

◆ is_positive()

bool dart::RegExpLookaround::is_positive ( ) const
inline

Definition at line 369 of file regexp_ast.h.

369{ return is_positive_; }

◆ IsAnchoredAtStart()

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

Reimplemented from dart::RegExpTree.

Definition at line 119 of file regexp_ast.cc.

119 {
120 return is_positive() && type() == LOOKAHEAD && body()->IsAnchoredAtStart();
121}
virtual bool IsAnchoredAtStart() const
Definition: regexp_ast.h:45

◆ IsLookaround()

virtual bool dart::RegExpLookaround::IsLookaround ( ) const
virtual

◆ max_match()

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

Implements dart::RegExpTree.

Definition at line 367 of file regexp_ast.h.

367{ return 0; }

◆ min_match()

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

Implements dart::RegExpTree.

Definition at line 366 of file regexp_ast.h.

366{ return 0; }

◆ ToNode()

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

Implements dart::RegExpTree.

Definition at line 4540 of file regexp.cc.

4541 {
4542 intptr_t stack_pointer_register = compiler->AllocateRegister();
4543 intptr_t position_register = compiler->AllocateRegister();
4544
4545 const intptr_t registers_per_capture = 2;
4546 const intptr_t register_of_first_capture = 2;
4547 intptr_t register_count = capture_count_ * registers_per_capture;
4548 intptr_t register_start =
4549 register_of_first_capture + capture_from_ * registers_per_capture;
4550
4551 RegExpNode* result;
4552 bool was_reading_backward = compiler->read_backward();
4553 compiler->set_read_backward(type() == LOOKBEHIND);
4554 Builder builder(is_positive(), on_success, stack_pointer_register,
4555 position_register, register_count, register_start);
4556 RegExpNode* match = body_->ToNode(compiler, builder.on_match_success());
4557 result = builder.ForMatch(match);
4558 compiler->set_read_backward(was_reading_backward);
4559 return result;
4560}
virtual RegExpNode * ToNode(RegExpCompiler *compiler, RegExpNode *on_success)=0
GAsyncResult * result
def match(bench, filt)
Definition: benchmark.py:23
DlVertices::Builder Builder

◆ type()

Type dart::RegExpLookaround::type ( ) const
inline

Definition at line 372 of file regexp_ast.h.

372{ return type_; }

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