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

Unified Diff: src/parser.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.cc ('k') | test/cctest/test-regexp.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/parser.cc
diff --git a/src/parser.cc b/src/parser.cc
index 6c91618587494b6ffe39e15fc6fa2b90657e4004..679911b979d4188d92cdbaa53b10f2791d239625 100644
--- a/src/parser.cc
+++ b/src/parser.cc
@@ -470,9 +470,8 @@ void RegExpBuilder::AddQuantifierToAtom(int min, int max, bool is_greedy) {
} else if (terms_.length() > 0) {
ASSERT(last_added_ == ADD_ATOM);
atom = terms_.RemoveLast();
- if (atom->IsLookahead() || atom->IsAssertion()) {
- // Guaranteed not to match a non-empty string.
- // Assertion as an atom can happen as, e.g., (?:\b)
+ if (atom->max_match() == 0) {
+ // Guaranteed to only match an empty string.
LAST(ADD_TERM);
if (min == 0) {
return;
@@ -3794,12 +3793,12 @@ RegExpTree* RegExpParser::ParseDisjunction() {
// {
case '*':
min = 0;
- max = RegExpQuantifier::kInfinity;
+ max = RegExpTree::kInfinity;
Advance();
break;
case '+':
min = 1;
- max = RegExpQuantifier::kInfinity;
+ max = RegExpTree::kInfinity;
Advance();
break;
case '?':
@@ -3965,7 +3964,7 @@ bool RegExpParser::ParseIntervalQuantifier(int* min_out, int* max_out) {
} else if (current() == ',') {
Advance();
if (current() == '}') {
- max = RegExpQuantifier::kInfinity;
+ max = RegExpTree::kInfinity;
Advance();
} else {
while (IsDecimalDigit(current())) {
« no previous file with comments | « src/jsregexp.cc ('k') | test/cctest/test-regexp.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698