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

Unified Diff: regexp2000/src/ast.h

Issue 8765: * Use new RegExp parser. (Closed)
Patch Set: Use new RegExp parser. Created 12 years, 2 months 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/ast.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 bd18291f16e358816416b158f7b06580b62edceb..191664dd34dc0b6dd1cc9d40d6724b35d2dc22c2 100644
--- a/regexp2000/src/ast.h
+++ b/regexp2000/src/ast.h
@@ -1215,6 +1215,9 @@ class RegExpTree: public ZoneObject {
virtual ~RegExpTree() { }
virtual void* Accept(RegExpVisitor* visitor, void* data) = 0;
SmartPointer<char> ToString();
+#define MAKE_ASTYPE(Name) virtual RegExp##Name* As##Name();
+ FOR_EACH_REG_EXP_NODE_TYPE(MAKE_ASTYPE)
+#undef MAKE_ASTYPE
};
@@ -1222,6 +1225,7 @@ class RegExpDisjunction: public RegExpTree {
public:
explicit RegExpDisjunction(ZoneList<RegExpTree*>* nodes) : nodes_(nodes) { }
virtual void* Accept(RegExpVisitor* visitor, void* data);
+ virtual RegExpDisjunction* AsDisjunction();
ZoneList<RegExpTree*>* nodes() { return nodes_; }
private:
ZoneList<RegExpTree*>* nodes_;
@@ -1232,6 +1236,7 @@ class RegExpAlternative: public RegExpTree {
public:
explicit RegExpAlternative(ZoneList<RegExpTree*>* nodes) : nodes_(nodes) { }
virtual void* Accept(RegExpVisitor* visitor, void* data);
+ virtual RegExpAlternative* AsAlternative();
ZoneList<RegExpTree*>* nodes() { return nodes_; }
private:
ZoneList<RegExpTree*>* nodes_;
@@ -1246,6 +1251,7 @@ class RegExpAssertion: public RegExpTree {
};
explicit RegExpAssertion(Type type) : type_(type) { }
virtual void* Accept(RegExpVisitor* visitor, void* data);
+ virtual RegExpAssertion* AsAssertion();
Type type() { return type_; }
private:
Type type_;
@@ -1298,6 +1304,7 @@ class RegExpCharacterClass: public RegExpTree {
: ranges_(ranges),
is_negated_(is_negated) { }
virtual void* Accept(RegExpVisitor* visitor, void* data);
+ virtual RegExpCharacterClass* AsCharacterClass();
ZoneList<CharacterRange>* ranges() { return ranges_; }
bool is_negated() { return is_negated_; }
private:
@@ -1310,6 +1317,7 @@ class RegExpAtom: public RegExpTree {
public:
explicit RegExpAtom(Vector<const uc16> data) : data_(data) { }
virtual void* Accept(RegExpVisitor* visitor, void* data);
+ virtual RegExpAtom* AsAtom();
Vector<const uc16> data() { return data_; }
private:
Vector<const uc16> data_;
@@ -1324,6 +1332,7 @@ class RegExpQuantifier: public RegExpTree {
is_greedy_(is_greedy),
body_(body) { }
virtual void* Accept(RegExpVisitor* visitor, void* data);
+ virtual RegExpQuantifier* AsQuantifier();
int min() { return min_; }
int max() { return max_; }
bool is_greedy() { return is_greedy_; }
@@ -1344,6 +1353,7 @@ class RegExpCapture: public RegExpTree {
explicit RegExpCapture(RegExpTree* body)
: body_(body) { }
virtual void* Accept(RegExpVisitor* visitor, void* data);
+ virtual RegExpCapture* AsCapture();
RegExpTree* body() { return body_; }
private:
RegExpTree* body_;
@@ -1356,6 +1366,7 @@ class RegExpLookahead: public RegExpTree {
: body_(body),
is_positive_(is_positive) { }
virtual void* Accept(RegExpVisitor* visitor, void* data);
+ virtual RegExpLookahead* AsLookahead();
RegExpTree* body() { return body_; }
bool is_positive() { return is_positive_; }
private:
@@ -1368,6 +1379,7 @@ class RegExpBackreference: public RegExpTree {
public:
explicit RegExpBackreference(int index) : index_(index) { }
virtual void* Accept(RegExpVisitor* visitor, void* data);
+ virtual RegExpBackreference* AsBackreference();
int index() { return index_; }
private:
int index_;
@@ -1378,6 +1390,7 @@ class RegExpEmpty: public RegExpTree {
public:
RegExpEmpty() { }
virtual void* Accept(RegExpVisitor* visitor, void* data);
+ virtual RegExpEmpty* AsEmpty();
static RegExpEmpty* GetInstance() { return &kInstance; }
private:
static RegExpEmpty kInstance;
« no previous file with comments | « no previous file | regexp2000/src/ast.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698