5#ifndef RUNTIME_VM_REGEXP_AST_H_
6#define RUNTIME_VM_REGEXP_AST_H_
15class RegExpAlternative;
18class RegExpBackReference;
20class RegExpCharacterClass;
22class RegExpDisjunction;
24class RegExpLookaround;
25class RegExpQuantifier;
31#define MAKE_CASE(Name) \
32 virtual void* Visit##Name(RegExp##Name*, void* data) = 0;
54#define MAKE_ASTYPE(Name) \
55 virtual RegExp##Name* As##Name(); \
56 virtual bool Is##Name() const;
71 virtual intptr_t
min_match()
const {
return min_match_; }
72 virtual intptr_t
max_match()
const {
return max_match_; }
91 virtual intptr_t
min_match()
const {
return min_match_; }
92 virtual intptr_t
max_match()
const {
return max_match_; }
112 : assertion_type_(
type), flags_(
flags) {}
133 : ranges_(
ranges), standard_set_type_(0) {}
136 ranges_(that.ranges_),
137 standard_set_type_(that.standard_set_type_) {}
141 standard_set_type_ = special_set_type;
150 uint16_t standard_set_type_;
172 character_class_flags_(character_class_flags) {
176 character_class_flags_ ^=
NEGATED;
180 : set_(
type), flags_(
flags), character_class_flags_(0) {}
274 quantifier_type_(
type) {
289 bool not_at_start =
false);
293 virtual intptr_t
min_match()
const {
return min_match_; }
294 virtual intptr_t
max_match()
const {
return max_match_; }
295 intptr_t
min()
const {
return min_; }
296 intptr_t
max()
const {
return max_; }
314 : body_(nullptr), index_(
index), name_(nullptr) {}
334 intptr_t
index()
const {
return index_; }
381 intptr_t stack_pointer_register,
382 intptr_t position_register,
383 intptr_t capture_register_count = 0,
384 intptr_t capture_register_start = 0);
392 intptr_t stack_pointer_register_;
393 intptr_t position_register_;
399 intptr_t capture_count_;
400 intptr_t capture_from_;
407 : capture_(nullptr), name_(nullptr), flags_(
flags) {}
static CharacterRange Everything()
CharacterSet(ZoneGrowableArray< CharacterRange > *ranges)
void set_standard_set_type(uint16_t special_set_type)
ZoneGrowableArray< CharacterRange > * ranges()
CharacterSet(const CharacterSet &that)
uint16_t standard_set_type() const
CharacterSet(uint16_t standard_set_type)
virtual Interval CaptureRegisters() const
virtual intptr_t max_match() const
ZoneGrowableArray< RegExpTree * > * nodes() const
virtual bool IsAnchoredAtStart() const
virtual bool IsAlternative() const
virtual bool IsAnchoredAtEnd() const
virtual RegExpAlternative * AsAlternative()
virtual RegExpNode * ToNode(RegExpCompiler *compiler, RegExpNode *on_success)
RegExpAlternative(ZoneGrowableArray< RegExpTree * > *nodes)
virtual void * Accept(RegExpVisitor *visitor, void *data)
virtual intptr_t min_match() const
virtual void * Accept(RegExpVisitor *visitor, void *data)
virtual RegExpAssertion * AsAssertion()
RegExpAssertion(AssertionType type, RegExpFlags flags)
virtual intptr_t max_match() const
virtual RegExpNode * ToNode(RegExpCompiler *compiler, RegExpNode *on_success)
virtual bool IsAssertion() const
virtual bool IsAnchoredAtEnd() const
virtual intptr_t min_match() const
virtual bool IsAnchoredAtStart() const
AssertionType assertion_type() const
virtual bool IsAtom() const
virtual intptr_t max_match() const
RegExpFlags flags() const
RegExpAtom(ZoneGrowableArray< uint16_t > *data, RegExpFlags flags)
virtual RegExpNode * ToNode(RegExpCompiler *compiler, RegExpNode *on_success)
virtual bool IsTextElement() const
virtual void AppendToText(RegExpText *text)
virtual RegExpAtom * AsAtom()
ZoneGrowableArray< uint16_t > * data() const
virtual intptr_t min_match() const
virtual void * Accept(RegExpVisitor *visitor, void *data)
void set_capture(RegExpCapture *capture)
virtual void * Accept(RegExpVisitor *visitor, void *data)
void set_name(const ZoneGrowableArray< uint16_t > *name)
virtual bool IsBackReference() const
virtual intptr_t min_match() const
virtual RegExpNode * ToNode(RegExpCompiler *compiler, RegExpNode *on_success)
virtual intptr_t max_match() const
RegExpBackReference(RegExpFlags flags)
virtual RegExpBackReference * AsBackReference()
RegExpCapture * capture() const
const ZoneGrowableArray< uint16_t > * name()
RegExpBackReference(RegExpCapture *capture, RegExpFlags flags)
RegExpCapture(intptr_t index)
virtual intptr_t min_match() const
virtual Interval CaptureRegisters() const
virtual RegExpNode * ToNode(RegExpCompiler *compiler, RegExpNode *on_success)
RegExpTree * body() const
virtual RegExpCapture * AsCapture()
virtual bool IsAnchoredAtEnd() const
void set_name(const ZoneGrowableArray< uint16_t > *name)
void set_body(RegExpTree *body)
static intptr_t EndRegister(intptr_t index)
virtual intptr_t max_match() const
static intptr_t StartRegister(intptr_t index)
const ZoneGrowableArray< uint16_t > * name()
virtual bool IsAnchoredAtStart() const
virtual bool IsCapture() const
virtual void * Accept(RegExpVisitor *visitor, void *data)
uint16_t standard_type() const
CharacterSet character_set() const
RegExpCharacterClass(ZoneGrowableArray< CharacterRange > *ranges, RegExpFlags flags, CharacterClassFlags character_class_flags=DefaultFlags())
virtual void AppendToText(RegExpText *text)
RegExpFlags flags() const
RegExpCharacterClass(uint16_t type, RegExpFlags flags)
virtual RegExpCharacterClass * AsCharacterClass()
virtual intptr_t min_match() const
virtual RegExpNode * ToNode(RegExpCompiler *compiler, RegExpNode *on_success)
virtual bool IsTextElement() const
@ CONTAINS_SPLIT_SURROGATE
bool contains_split_surrogate() const
ZoneGrowableArray< CharacterRange > * ranges()
intptr_t CharacterClassFlags
virtual intptr_t max_match() const
static CharacterClassFlags DefaultFlags()
virtual bool IsCharacterClass() const
virtual void * Accept(RegExpVisitor *visitor, void *data)
virtual intptr_t min_match() const
RegExpDisjunction(ZoneGrowableArray< RegExpTree * > *alternatives)
virtual bool IsAnchoredAtStart() const
virtual intptr_t max_match() const
ZoneGrowableArray< RegExpTree * > * alternatives() const
virtual void * Accept(RegExpVisitor *visitor, void *data)
virtual bool IsDisjunction() const
virtual bool IsAnchoredAtEnd() const
virtual Interval CaptureRegisters() const
virtual RegExpNode * ToNode(RegExpCompiler *compiler, RegExpNode *on_success)
virtual RegExpDisjunction * AsDisjunction()
virtual bool IsEmpty() const
static RegExpEmpty * GetInstance()
virtual RegExpEmpty * AsEmpty()
virtual RegExpNode * ToNode(RegExpCompiler *compiler, RegExpNode *on_success)
virtual void * Accept(RegExpVisitor *visitor, void *data)
virtual intptr_t max_match() const
virtual intptr_t min_match() const
RegExpNode * on_match_success()
Builder(bool is_positive, RegExpNode *on_success, intptr_t stack_pointer_register, intptr_t position_register, intptr_t capture_register_count=0, intptr_t capture_register_start=0)
RegExpNode * ForMatch(RegExpNode *match)
virtual intptr_t max_match() const
virtual bool IsAnchoredAtStart() const
RegExpLookaround(RegExpTree *body, bool is_positive, intptr_t capture_count, intptr_t capture_from, Type type)
RegExpTree * body() const
virtual RegExpNode * ToNode(RegExpCompiler *compiler, RegExpNode *on_success)
virtual RegExpLookaround * AsLookaround()
virtual bool IsLookaround() const
intptr_t capture_count() const
virtual void * Accept(RegExpVisitor *visitor, void *data)
virtual Interval CaptureRegisters() const
intptr_t capture_from() const
virtual intptr_t min_match() const
virtual RegExpQuantifier * AsQuantifier()
RegExpTree * body() const
bool is_non_greedy() const
virtual RegExpNode * ToNode(RegExpCompiler *compiler, RegExpNode *on_success)
virtual Interval CaptureRegisters() const
bool is_possessive() const
virtual bool IsQuantifier() const
virtual intptr_t min_match() const
RegExpQuantifier(intptr_t min, intptr_t max, QuantifierType type, RegExpTree *body)
virtual void * Accept(RegExpVisitor *visitor, void *data)
virtual intptr_t max_match() const
virtual RegExpText * AsText()
virtual void AppendToText(RegExpText *text)
virtual void * Accept(RegExpVisitor *visitor, void *data)
GrowableArray< TextElement > * elements()
void AddElement(TextElement elm)
virtual bool IsText() const
virtual intptr_t min_match() const
virtual bool IsTextElement() const
virtual RegExpNode * ToNode(RegExpCompiler *compiler, RegExpNode *on_success)
virtual intptr_t max_match() const
virtual intptr_t min_match() const =0
virtual bool IsAnchoredAtEnd() const
virtual Interval CaptureRegisters() const
virtual void * Accept(RegExpVisitor *visitor, void *data)=0
virtual intptr_t max_match() const =0
virtual RegExpNode * ToNode(RegExpCompiler *compiler, RegExpNode *on_success)=0
static constexpr intptr_t kInfinity
virtual bool IsTextElement() const
virtual void AppendToText(RegExpText *text)
virtual bool IsAnchoredAtStart() const
FlutterSemanticsFlag flags
constexpr int32_t kMaxInt32
static int8_t data[kExtLength]
#define FOR_EACH_REG_EXP_TREE_TYPE(VISIT)
#define MAKE_ASTYPE(Name)