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

Unified Diff: src/jsregexp.cc

Issue 14190: * Added min/max match length to irregexp ast (Closed)
Patch Set: Addressed review comments Created 12 years 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 | « src/jsregexp.h ('k') | src/parser.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/jsregexp.cc
diff --git a/src/jsregexp.cc b/src/jsregexp.cc
index c6f06a2e0ef9164284e99e5917bbbd4e16c2ebb0..fe5bf05d26af08ca21134f476d940f49ae2a89c1 100644
--- a/src/jsregexp.cc
+++ b/src/jsregexp.cc
@@ -1193,6 +1193,16 @@ TextElement TextElement::CharClass(
}
+int TextElement::length() {
+ if (type == ATOM) {
+ return data.u_atom->length();
+ } else {
+ ASSERT(type == CHAR_CLASS);
+ return 1;
+ }
+}
+
+
DispatchTable* ChoiceNode::GetTable(bool ignore_case) {
if (table_ == NULL) {
table_ = new DispatchTable();
@@ -2667,7 +2677,7 @@ RegExpNode* RegExpQuantifier::ToNode(int min,
// TODO(someone): clear captures on repetition and handle empty
// matches.
bool has_min = min > 0;
- bool has_max = max < RegExpQuantifier::kInfinity;
+ bool has_max = max < RegExpTree::kInfinity;
bool needs_counter = has_min || has_max;
int reg_ctr = needs_counter ? compiler->AllocateRegister() : -1;
ChoiceNode* center = new LoopChoiceNode(2);
@@ -3784,7 +3794,7 @@ Handle<FixedArray> RegExpEngine::Compile(RegExpCompileData* data,
// since we don't even handle ^ yet I'm saving that optimization for
// later.
RegExpNode* node = RegExpQuantifier::ToNode(0,
- RegExpQuantifier::kInfinity,
+ RegExpTree::kInfinity,
false,
new RegExpCharacterClass('*'),
&compiler,
« no previous file with comments | « src/jsregexp.h ('k') | src/parser.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698