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

Side by Side Diff: test/mjsunit/unicode-test.js

Issue 11228: * No failures on our own tests.... (Closed) Base URL: http://v8.googlecode.com/svn/branches/experimental/regexp2000/
Patch Set: Created 12 years, 1 month 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 unified diff | Download patch | Annotate | Revision Log
« src/regexp-macro-assembler-re2k.h ('K') | « test/mjsunit/regexp.js ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2008 the V8 project authors. All rights reserved. 1 // Copyright 2008 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 9111 matching lines...) Expand 10 before | Expand all | Expand 10 after
9122 c.charCodeAt(0) - 20 < last_c) { 9122 c.charCodeAt(0) - 20 < last_c) {
9123 re += "-" + c; 9123 re += "-" + c;
9124 last_c = -9999; 9124 last_c = -9999;
9125 } else { 9125 } else {
9126 re += c; 9126 re += c;
9127 last_c = c.charCodeAt(0); 9127 last_c = c.charCodeAt(0);
9128 } 9128 }
9129 } 9129 }
9130 } 9130 }
9131 re += "]+)"; 9131 re += "]+)";
9132 //dump_re(re);
Christian Plesner Hansen 2008/11/18 14:07:41 ?
9132 var char_class = new RegExp(re, "g"); 9133 var char_class = new RegExp(re, "g");
9133 var munged = text.replace(char_class, "foo"); 9134 var munged = text.replace(char_class, "foo");
9134 assertEquals(munged_sizes[i - 1], munged.length, "munged size " + i); 9135 assertEquals(munged_sizes[i - 1], munged.length, "munged size " + i);
9135 } 9136 }
9136 9137
9138
9139 function hex(x) {
9140 x &= 15;
9141 if (x < 10) {
9142 return String.fromCharCode(x + 48);
9143 } else {
9144 return String.fromCharCode(x + 97 - 10);
9145 }
9146 }
9147
9148
9149 function dump_re(re) {
9150 var out = "";
9151 for (var i = 0; i < re.length; i++) {
9152 var c = re.charCodeAt(i);
9153 if (c >= 32 && c <= 126) {
9154 out += re[i];
9155 } else if (c < 256) {
9156 out += "\\x" + hex(c >> 4) + hex(c);
9157 } else {
9158 out += "\\u" + hex(c >> 12) + hex(c >> 8) + hex(c >> 4) + hex(c);
9159 }
9160 }
9161 print ("re = " + out);
9162 }
9163
9137 var thai_l_thingy = "\u0e44"; 9164 var thai_l_thingy = "\u0e44";
9138 var thai_l_regexp = new RegExp(thai_l_thingy); 9165 var thai_l_regexp = new RegExp(thai_l_thingy);
9139 var thai_l_regexp2 = new RegExp("[" + thai_l_thingy + "]"); 9166 var thai_l_regexp2 = new RegExp("[" + thai_l_thingy + "]");
9140 assertTrue(thai_l_regexp.test(thai_l_thingy)); 9167 assertTrue(thai_l_regexp.test(thai_l_thingy));
9141 assertTrue(thai_l_regexp2.test(thai_l_thingy)); 9168 assertTrue(thai_l_regexp2.test(thai_l_thingy));
9142 9169
9143 9170
OLDNEW
« src/regexp-macro-assembler-re2k.h ('K') | « test/mjsunit/regexp.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698