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

Unified Diff: regexp2000/src/ast.h

Issue 8760: Experimental regexp: Use new RegExp parser to test syntax. (Closed)
Patch Set: Parses regexp using new parser. Rebased patch. 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 00004791153fd48ed84085d2514dd620f3295dac..ef372574d4f7fc883b3b7c2203af6254a82bbfc3 100644
--- a/regexp2000/src/ast.h
+++ b/regexp2000/src/ast.h
@@ -1209,6 +1209,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
};
@@ -1216,6 +1219,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_;
@@ -1226,6 +1230,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_;
@@ -1240,6 +1245,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_;
@@ -1292,6 +1298,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:
@@ -1304,6 +1311,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_;
@@ -1318,6 +1326,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_; }
@@ -1338,6 +1347,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_;
@@ -1350,6 +1360,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:
@@ -1362,6 +1373,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_;
@@ -1372,6 +1384,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