OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
155 assertEquals("foo baz", a); | 155 assertEquals("foo baz", a); |
156 | 156 |
157 a = "foo bar baz".replace(/^|bar/g, "*"); | 157 a = "foo bar baz".replace(/^|bar/g, "*"); |
158 assertEquals("*foo * baz", a); | 158 assertEquals("*foo * baz", a); |
159 | 159 |
160 // We test FilterASCII using regexps that will backtrack forever. Since | 160 // We test FilterASCII using regexps that will backtrack forever. Since |
161 // a regexp with a non-ASCII character in it can never match an ASCII | 161 // a regexp with a non-ASCII character in it can never match an ASCII |
162 // string we can test that the relevant node is removed by verifying that | 162 // string we can test that the relevant node is removed by verifying that |
163 // there is no hang. | 163 // there is no hang. |
164 function NoHang(re) { | 164 function NoHang(re) { |
165 print(re); | |
166 "This is an ASCII string that could take forever".match(re); | 165 "This is an ASCII string that could take forever".match(re); |
167 } | 166 } |
168 | 167 |
169 | 168 |
170 NoHang(/(((.*)*)*x)å/); // Continuation after loop is filtered, so is loop. | 169 NoHang(/(((.*)*)*x)å/); // Continuation after loop is filtered, so is loop. |
171 NoHang(/(((.*)*)*å)foo/); // Body of loop filtered. | 170 NoHang(/(((.*)*)*å)foo/); // Body of loop filtered. |
172 NoHang(/å(((.*)*)*x)/); // Everything after a filtered character is filtered. | 171 NoHang(/å(((.*)*)*x)/); // Everything after a filtered character is filtered. |
173 NoHang(/(((.*)*)*x)å/); // Everything before a filtered character is filtered. | 172 NoHang(/(((.*)*)*x)å/); // Everything before a filtered character is filtered. |
174 NoHang(/[æøå](((.*)*)*x)/); // Everything after a filtered class is filtered. | 173 NoHang(/[æøå](((.*)*)*x)/); // Everything after a filtered class is filtered. |
175 NoHang(/(((.*)*)*x)[æøå]/); // Everything before a filtered class is filtered. | 174 NoHang(/(((.*)*)*x)[æøå]/); // Everything before a filtered class is filtered. |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
211 regex9.exec(input0); | 210 regex9.exec(input0); |
212 | 211 |
213 var regex10 = new RegExp(re, "i"); | 212 var regex10 = new RegExp(re, "i"); |
214 regex10.exec(input0); | 213 regex10.exec(input0); |
215 | 214 |
216 var regex11 = /^(?:[^\u0000-\u0080]|[0-9a-z?,.!&\s#()])+$/i; | 215 var regex11 = /^(?:[^\u0000-\u0080]|[0-9a-z?,.!&\s#()])+$/i; |
217 regex11.exec(input0); | 216 regex11.exec(input0); |
218 | 217 |
219 var regex12 = /u(\xf0{8}?\D*?|( ? !)$h??(|)*?(||)+?\6((?:\W\B|--\d-*-|)?$){0, }?
|^Y( ? !1)\d+)+a/; | 218 var regex12 = /u(\xf0{8}?\D*?|( ? !)$h??(|)*?(||)+?\6((?:\W\B|--\d-*-|)?$){0, }?
|^Y( ? !1)\d+)+a/; |
220 regex12.exec(""); | 219 regex12.exec(""); |
OLD | NEW |