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

Unified Diff: src/parser.cc

Issue 14892: Merge changes from bleeding_edge into experimental toiger branch.... (Closed) Base URL: http://v8.googlecode.com/svn/branches/experimental/toiger/
Patch Set: 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/objects-inl.h ('k') | src/regexp-macro-assembler.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
« no previous file with comments | « src/objects-inl.h ('k') | src/regexp-macro-assembler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698