Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(654)

Unified Diff: regexp2000/src/ast.h

Issue 10750: * Update to RegExp parsing and AST. (Closed)
Patch Set: Addressed review comments Created 12 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | regexp2000/src/jsregexp.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: regexp2000/src/ast.h
diff --git a/regexp2000/src/ast.h b/regexp2000/src/ast.h
index de9c0ad46cee3af4a441e1ad9f6b7d4dcbf58e9f..2264eb1e1bbe5be730d0f46f6ec1f599ebb77bef 100644
--- a/regexp2000/src/ast.h
+++ b/regexp2000/src/ast.h
@@ -1341,10 +1341,13 @@ class RegExpQuantifier: public RegExpTree {
};
+enum CaptureAvailability {
+ CAPTURE_AVAILABLE, CAPTURE_UNREACHABLE, CAPTURE_PERMANENTLY_UNREACHABLE };
+
class RegExpCapture: public RegExpTree {
public:
explicit RegExpCapture(RegExpTree* body, int index)
- : body_(body), index_(index) { }
+ : body_(body), index_(index), available_(CAPTURE_AVAILABLE) { }
virtual void* Accept(RegExpVisitor* visitor, void* data);
virtual RegExpNode* ToNode(RegExpCompiler* compiler,
RegExpNode* on_success,
@@ -1357,11 +1360,16 @@ class RegExpCapture: public RegExpTree {
virtual RegExpCapture* AsCapture();
RegExpTree* body() { return body_; }
int index() { return index_; }
+ inline CaptureAvailability available() { return available_; }
+ inline void set_available(CaptureAvailability availability) {
+ available_ = availability;
+ }
static int StartRegister(int index) { return index * 2; }
static int EndRegister(int index) { return index * 2 + 1; }
private:
RegExpTree* body_;
int index_;
+ CaptureAvailability available_;
};
@@ -1385,15 +1393,17 @@ class RegExpLookahead: public RegExpTree {
class RegExpBackreference: public RegExpTree {
public:
- explicit RegExpBackreference(int index) : index_(index) { }
+ explicit RegExpBackreference(RegExpCapture* capture)
+ : capture_(capture) { }
virtual void* Accept(RegExpVisitor* visitor, void* data);
virtual RegExpNode* ToNode(RegExpCompiler* compiler,
RegExpNode* on_success,
RegExpNode* on_failure);
virtual RegExpBackreference* AsBackreference();
- int index() { return index_; }
+ int index() { return capture_->index(); }
+ RegExpCapture* capture() { return capture_; }
private:
- int index_;
+ RegExpCapture* capture_;
};
« no previous file with comments | « no previous file | regexp2000/src/jsregexp.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698