RegExp parser forgot to advance after reading \c in character class. I.e., \cM was interpreted as \ccM.

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@1122 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
lrn@chromium.org 2009-01-22 10:37:09 +00:00
parent 0381d3dd18
commit 6bd6376588
2 changed files with 17 additions and 0 deletions

View File

@ -4052,6 +4052,7 @@ uc32 RegExpParser::ParseClassCharacterEscape() {
Advance();
return '\v';
case 'c':
Advance();
return ParseControlLetterEscape();
case '0': case '1': case '2': case '3': case '4': case '5':
case '6': case '7':

View File

@ -94,6 +94,22 @@ assertFalse(/\ca/.test( "\\ca" ));
//assertTrue(/\c[a/]/.test( "\x1ba/]" ));
// Test \c in character class
re = /^[\cM]$/;
assertTrue(re.test("\r"));
assertFalse(re.test("M"));
assertFalse(re.test("c"));
assertFalse(re.test("\\"));
assertFalse(re.test("\x03")); // I.e., read as \cc
re = /^[\c]]$/;
assertTrue(re.test("c]"));
assertFalse(re.test("\\]"));
assertFalse(re.test("\x1d")); // ']' & 0x1f
assertFalse(re.test("\\]"));
assertFalse(re.test("\x03]")); // I.e., read as \cc
// Test that we handle \s and \S correctly inside some bizarre
// character classes.
re = /[\s-:]/;