| Index: src/parser.cc
|
| ===================================================================
|
| --- src/parser.cc (revision 1012)
|
| +++ src/parser.cc (working copy)
|
| @@ -120,7 +120,10 @@
|
| Statement* ParseContinueStatement(bool* ok);
|
| Statement* ParseBreakStatement(ZoneStringList* labels, bool* ok);
|
| Statement* ParseReturnStatement(bool* ok);
|
| - Block* WithHelper(Expression* obj, ZoneStringList* labels, bool* ok);
|
| + Block* WithHelper(Expression* obj,
|
| + ZoneStringList* labels,
|
| + bool is_catch_block,
|
| + bool* ok);
|
| Statement* ParseWithStatement(ZoneStringList* labels, bool* ok);
|
| CaseClause* ParseCaseClause(bool* default_seen_ptr, bool* ok);
|
| SwitchStatement* ParseSwitchStatement(ZoneStringList* labels, bool* ok);
|
| @@ -470,9 +473,8 @@
|
| } 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;
|
| @@ -1924,7 +1926,10 @@
|
| }
|
|
|
|
|
| -Block* Parser::WithHelper(Expression* obj, ZoneStringList* labels, bool* ok) {
|
| +Block* Parser::WithHelper(Expression* obj,
|
| + ZoneStringList* labels,
|
| + bool is_catch_block,
|
| + bool* ok) {
|
| // Parse the statement and collect escaping labels.
|
| ZoneList<JumpTarget*>* target_list = NEW(ZoneList<JumpTarget*>(0));
|
| TargetCollector collector(target_list);
|
| @@ -1941,7 +1946,7 @@
|
| Block* result = NEW(Block(NULL, 2, false));
|
|
|
| if (result != NULL) {
|
| - result->AddStatement(NEW(WithEnterStatement(obj)));
|
| + result->AddStatement(NEW(WithEnterStatement(obj, is_catch_block)));
|
|
|
| // Create body block.
|
| Block* body = NEW(Block(NULL, 1, false));
|
| @@ -1975,7 +1980,7 @@
|
| Expression* expr = ParseExpression(true, CHECK_OK);
|
| Expect(Token::RPAREN, CHECK_OK);
|
|
|
| - return WithHelper(expr, labels, CHECK_OK);
|
| + return WithHelper(expr, labels, false, CHECK_OK);
|
| }
|
|
|
|
|
| @@ -2137,7 +2142,7 @@
|
| catch_var = top_scope_->NewTemporary(Factory::catch_var_symbol());
|
| Expression* obj = MakeCatchContext(name, catch_var);
|
| { Target target(this, &catch_collector);
|
| - catch_block = WithHelper(obj, NULL, CHECK_OK);
|
| + catch_block = WithHelper(obj, NULL, true, CHECK_OK);
|
| }
|
| } else {
|
| Expect(Token::LBRACE, CHECK_OK);
|
| @@ -3796,12 +3801,12 @@
|
| // {
|
| case '*':
|
| min = 0;
|
| - max = RegExpQuantifier::kInfinity;
|
| + max = RegExpTree::kInfinity;
|
| Advance();
|
| break;
|
| case '+':
|
| min = 1;
|
| - max = RegExpQuantifier::kInfinity;
|
| + max = RegExpTree::kInfinity;
|
| Advance();
|
| break;
|
| case '?':
|
| @@ -3967,7 +3972,7 @@
|
| } else if (current() == ',') {
|
| Advance();
|
| if (current() == '}') {
|
| - max = RegExpQuantifier::kInfinity;
|
| + max = RegExpTree::kInfinity;
|
| Advance();
|
| } else {
|
| while (IsDecimalDigit(current())) {
|
| @@ -4186,6 +4191,8 @@
|
| Advance(2);
|
| return CharacterRange::Singleton(0); // Return dummy value.
|
| }
|
| + case kEndMarker:
|
| + ReportError(CStrVector("\\ at end of pattern") CHECK_FAILED);
|
| default:
|
| uc32 c = ParseClassCharacterEscape(CHECK_FAILED);
|
| return CharacterRange::Singleton(c);
|
|
|