| Index: src/parser.cc
|
| diff --git a/src/parser.cc b/src/parser.cc
|
| index 713c6a809e3dc34cf245254f8fc38397313345ad..115e1819f703168708f3c4b4af61fa9718fdcf85 100644
|
| --- a/src/parser.cc
|
| +++ b/src/parser.cc
|
| @@ -3606,7 +3606,7 @@ RegExpParser::RegExpParser(FlatStringReader* in,
|
| next_pos_(0),
|
| in_(in),
|
| error_(error),
|
| - simple_(true),
|
| + simple_(false),
|
| contains_anchor_(false),
|
| captures_(NULL),
|
| is_scanned_for_captures_(false),
|
| @@ -3676,6 +3676,11 @@ RegExpTree* RegExpParser::ParsePattern() {
|
| if (has_more()) {
|
| ReportError(CStrVector("Unmatched ')'") CHECK_FAILED);
|
| }
|
| + // If the result of parsing is a literal string atom, and it has the
|
| + // same length as the input, then the atom is identical to the input.
|
| + if (result->IsAtom() && result->AsAtom()->length() == in()->length()) {
|
| + simple_ = true;
|
| + }
|
| return result;
|
| }
|
|
|
| @@ -3875,7 +3880,6 @@ RegExpTree* RegExpParser::ParseDisjunction() {
|
| Advance(2);
|
| break;
|
| }
|
| - simple_ = false;
|
| break;
|
| case '{': {
|
| int dummy;
|
| @@ -3932,7 +3936,6 @@ RegExpTree* RegExpParser::ParseDisjunction() {
|
| is_greedy = false;
|
| Advance();
|
| }
|
| - simple_ = false; // Adding quantifier might *remove* look-ahead.
|
| builder.AddQuantifierToAtom(min, max, is_greedy);
|
| }
|
| }
|
|
|