Index: src/ast.h |
diff --git a/src/ast.h b/src/ast.h |
index 150506b4240bf2e43e96da5e86dc7d639141a32e..5cb716085835948716aec9092aefc867b6ab76ad 100644 |
--- a/src/ast.h |
+++ b/src/ast.h |
@@ -1214,6 +1214,16 @@ class ThisFunction: public Expression { |
// Regular expressions |
+class RegExpVisitor BASE_EMBEDDED { |
+ public: |
+ virtual ~RegExpVisitor() { } |
+#define MAKE_CASE(Name) \ |
+ virtual void* Visit##Name(RegExp##Name*, void* data) = 0; |
+ FOR_EACH_REG_EXP_TREE_TYPE(MAKE_CASE) |
+#undef MAKE_CASE |
+}; |
+ |
+ |
class RegExpTree: public ZoneObject { |
public: |
static const int kInfinity = kMaxInt; |
@@ -1224,6 +1234,9 @@ class RegExpTree: public ZoneObject { |
virtual bool IsTextElement() { return false; } |
virtual int min_match() = 0; |
virtual int max_match() = 0; |
+ // Returns the interval of registers used for captures within this |
+ // expression. |
+ virtual Interval CaptureRegisters() { return Interval::Empty(); } |
virtual void AppendToText(RegExpText* text); |
SmartPointer<const char> ToString(); |
#define MAKE_ASTYPE(Name) \ |
@@ -1241,6 +1254,7 @@ class RegExpDisjunction: public RegExpTree { |
virtual RegExpNode* ToNode(RegExpCompiler* compiler, |
RegExpNode* on_success); |
virtual RegExpDisjunction* AsDisjunction(); |
+ virtual Interval CaptureRegisters(); |
virtual bool IsDisjunction(); |
virtual int min_match() { return min_match_; } |
virtual int max_match() { return max_match_; } |
@@ -1259,6 +1273,7 @@ class RegExpAlternative: public RegExpTree { |
virtual RegExpNode* ToNode(RegExpCompiler* compiler, |
RegExpNode* on_success); |
virtual RegExpAlternative* AsAlternative(); |
+ virtual Interval CaptureRegisters(); |
virtual bool IsAlternative(); |
virtual int min_match() { return min_match_; } |
virtual int max_match() { return max_match_; } |
@@ -1423,6 +1438,7 @@ class RegExpQuantifier: public RegExpTree { |
RegExpCompiler* compiler, |
RegExpNode* on_success); |
virtual RegExpQuantifier* AsQuantifier(); |
+ virtual Interval CaptureRegisters(); |
virtual bool IsQuantifier(); |
virtual int min_match() { return min_match_; } |
virtual int max_match() { return max_match_; } |
@@ -1458,6 +1474,7 @@ class RegExpCapture: public RegExpTree { |
RegExpCompiler* compiler, |
RegExpNode* on_success); |
virtual RegExpCapture* AsCapture(); |
+ virtual Interval CaptureRegisters(); |
virtual bool IsCapture(); |
virtual int min_match() { return body_->min_match(); } |
virtual int max_match() { return body_->max_match(); } |
@@ -1485,6 +1502,7 @@ class RegExpLookahead: public RegExpTree { |
virtual RegExpNode* ToNode(RegExpCompiler* compiler, |
RegExpNode* on_success); |
virtual RegExpLookahead* AsLookahead(); |
+ virtual Interval CaptureRegisters(); |
virtual bool IsLookahead(); |
virtual int min_match() { return 0; } |
virtual int max_match() { return 0; } |
@@ -1530,16 +1548,6 @@ class RegExpEmpty: public RegExpTree { |
}; |
-class RegExpVisitor BASE_EMBEDDED { |
- public: |
- virtual ~RegExpVisitor() { } |
-#define MAKE_CASE(Name) \ |
- virtual void* Visit##Name(RegExp##Name*, void* data) = 0; |
- FOR_EACH_REG_EXP_TREE_TYPE(MAKE_CASE) |
-#undef MAKE_CASE |
-}; |
- |
- |
// ---------------------------------------------------------------------------- |
// Basic visitor |
// - leaf node visitors are abstract. |