Author: [email protected]
Date: Thu Jan 22 02:37:09 2009
New Revision: 1122
Modified:
branches/bleeding_edge/src/parser.cc
branches/bleeding_edge/test/mjsunit/regexp.js
Log:
RegExp parser forgot to advance after reading \c in character class. I.e.,
\cM was interpreted as \ccM.
Modified: branches/bleeding_edge/src/parser.cc
==============================================================================
--- branches/bleeding_edge/src/parser.cc (original)
+++ branches/bleeding_edge/src/parser.cc Thu Jan 22 02:37:09 2009
@@ -4052,6 +4052,7 @@
Advance();
return '\v';
case 'c':
+ Advance();
return ParseControlLetterEscape();
case '0': case '1': case '2': case '3': case '4': case '5':
case '6': case '7':
Modified: branches/bleeding_edge/test/mjsunit/regexp.js
==============================================================================
--- branches/bleeding_edge/test/mjsunit/regexp.js (original)
+++ branches/bleeding_edge/test/mjsunit/regexp.js Thu Jan 22 02:37:09 2009
@@ -94,6 +94,22 @@
//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-:]/;
--~--~---------~--~----~------------~-------~--~----~
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
-~----------~----~----~----~------~----~------~--~---