Reverted RegExp parser error message change that broke layout test.

Also cleaned up some leftover crud.

Review URL: http://codereview.chromium.org/155048


git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@2352 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
lrn@chromium.org 2009-07-03 11:09:34 +00:00
parent 48ceb2cfab
commit 4cccc960a3

View File

@ -3848,9 +3848,7 @@ RegExpTree* RegExpParser::ReportError(Vector<const char> message) {
// Disjunction // Disjunction
RegExpTree* RegExpParser::ParsePattern() { RegExpTree* RegExpParser::ParsePattern() {
RegExpTree* result = ParseDisjunction(CHECK_FAILED); RegExpTree* result = ParseDisjunction(CHECK_FAILED);
if (has_more()) { ASSERT(!has_more());
ReportError(CStrVector("Unmatched ')'") CHECK_FAILED);
}
// If the result of parsing is a literal string atom, and it has the // 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. // same length as the input, then the atom is identical to the input.
if (result->IsAtom() && result->AsAtom()->length() == in()->length()) { if (result->IsAtom() && result->AsAtom()->length() == in()->length()) {
@ -3888,7 +3886,7 @@ RegExpTree* RegExpParser::ParseDisjunction() {
return builder->ToRegExp(); return builder->ToRegExp();
case ')': { case ')': {
if (!stored_state->IsSubexpression()) { if (!stored_state->IsSubexpression()) {
ReportError(CStrVector("Unexpected ')'") CHECK_FAILED); ReportError(CStrVector("Unmatched ')'") CHECK_FAILED);
} }
ASSERT_NE(INITIAL, stored_state->group_type()); ASSERT_NE(INITIAL, stored_state->group_type());
@ -4028,7 +4026,7 @@ RegExpTree* RegExpParser::ParseDisjunction() {
CharacterRange::AddClassEscape(c, ranges); CharacterRange::AddClassEscape(c, ranges);
RegExpTree* atom = new RegExpCharacterClass(ranges, false); RegExpTree* atom = new RegExpCharacterClass(ranges, false);
builder->AddAtom(atom); builder->AddAtom(atom);
goto has_read_atom; // Avoid setting has_character_escapes_. break;
} }
case '1': case '2': case '3': case '4': case '5': case '6': case '1': case '2': case '3': case '4': case '5': case '6':
case '7': case '8': case '9': { case '7': case '8': case '9': {
@ -4040,11 +4038,11 @@ RegExpTree* RegExpParser::ParseDisjunction() {
} }
if (capture == NULL) { if (capture == NULL) {
builder->AddEmpty(); builder->AddEmpty();
goto has_read_atom; break;
} }
RegExpTree* atom = new RegExpBackReference(capture); RegExpTree* atom = new RegExpBackReference(capture);
builder->AddAtom(atom); builder->AddAtom(atom);
goto has_read_atom; // Avoid setting has_character_escapes_. break;
} }
uc32 first_digit = Next(); uc32 first_digit = Next();
if (first_digit == '8' || first_digit == '9') { if (first_digit == '8' || first_digit == '9') {
@ -4129,7 +4127,6 @@ RegExpTree* RegExpParser::ParseDisjunction() {
break; break;
} // end switch(current()) } // end switch(current())
has_read_atom:
int min; int min;
int max; int max;
switch (current()) { switch (current()) {