Commit 6bd63765 authored by lrn@chromium.org's avatar lrn@chromium.org

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

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
parent 0381d3dd
......@@ -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':
......
......@@ -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-:]/;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment