| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. All rights reserved. | 1 // Copyright (c) 2014, the Dart project authors. All rights reserved. |
| 2 // Copyright 2009 the V8 project authors. All rights reserved. | 2 // Copyright 2009 the V8 project authors. All rights reserved. |
| 3 // Redistribution and use in source and binary forms, with or without | 3 // Redistribution and use in source and binary forms, with or without |
| 4 // modification, are permitted provided that the following conditions are | 4 // modification, are permitted provided that the following conditions are |
| 5 // met: | 5 // met: |
| 6 // | 6 // |
| 7 // * Redistributions of source code must retain the above copyright | 7 // * Redistributions of source code must retain the above copyright |
| 8 // notice, this list of conditions and the following disclaimer. | 8 // notice, this list of conditions and the following disclaimer. |
| 9 // * Redistributions in binary form must reproduce the above | 9 // * Redistributions in binary form must reproduce the above |
| 10 // copyright notice, this list of conditions and the following | 10 // copyright notice, this list of conditions and the following |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 102 testRE(re, "c", true); | 102 testRE(re, "c", true); |
| 103 testRE(re, "d", false); | 103 testRE(re, "d", false); |
| 104 execRE(re, "a", ["a", "a"]); | 104 execRE(re, "a", ["a", "a"]); |
| 105 execRE(re, "b", ["b", null]); | 105 execRE(re, "b", ["b", null]); |
| 106 execRE(re, "c", ["c", null]); | 106 execRE(re, "c", ["c", null]); |
| 107 | 107 |
| 108 execRE(new RegExp(r"^(?=(b))b"), "b", ["b", "b"]); | 108 execRE(new RegExp(r"^(?=(b))b"), "b", ["b", "b"]); |
| 109 execRE(new RegExp(r"^(?:(?=(b))|a)b"), "ab", ["ab", null]); | 109 execRE(new RegExp(r"^(?:(?=(b))|a)b"), "ab", ["ab", null]); |
| 110 execRE(new RegExp(r"^(?:(?=(b)(?:(?=(c))|d))|)bd"), "bd", ["bd", "b", null]); | 110 execRE(new RegExp(r"^(?:(?=(b)(?:(?=(c))|d))|)bd"), "bd", ["bd", "b", null]); |
| 111 | 111 |
| 112 | |
| 113 | |
| 114 // Test of Negative Look-Ahead. | 112 // Test of Negative Look-Ahead. |
| 115 | 113 |
| 116 re = new RegExp(r"(?!x)."); | 114 re = new RegExp(r"(?!x)."); |
| 117 testRE(re, "y", true); | 115 testRE(re, "y", true); |
| 118 testRE(re, "x", false); | 116 testRE(re, "x", false); |
| 119 execRE(re, "y", ["y"]); | 117 execRE(re, "y", ["y"]); |
| 120 | 118 |
| 121 re = new RegExp(r"(?!(\d))|\d"); | 119 re = new RegExp(r"(?!(\d))|\d"); |
| 122 testRE(re, "4", true); | 120 testRE(re, "4", true); |
| 123 execRE(re, "4", ["4", null]); | 121 execRE(re, "4", ["4", null]); |
| 124 execRE(re, "x", ["", null]); | 122 execRE(re, "x", ["", null]); |
| 125 | 123 |
| 126 | |
| 127 // Test mixed nested look-ahead with captures. | 124 // Test mixed nested look-ahead with captures. |
| 128 | 125 |
| 129 re = new RegExp(r"^(?=(x)(?=(y)))"); | 126 re = new RegExp(r"^(?=(x)(?=(y)))"); |
| 130 testRE(re, "xy", true); | 127 testRE(re, "xy", true); |
| 131 testRE(re, "xz", false); | 128 testRE(re, "xz", false); |
| 132 execRE(re, "xy", ["", "x", "y"]); | 129 execRE(re, "xy", ["", "x", "y"]); |
| 133 | 130 |
| 134 re = new RegExp(r"^(?!(x)(?!(y)))"); | 131 re = new RegExp(r"^(?!(x)(?!(y)))"); |
| 135 testRE(re, "xy", true); | 132 testRE(re, "xy", true); |
| 136 testRE(re, "xz", false); | 133 testRE(re, "xz", false); |
| (...skipping 19 matching lines...) Expand all Loading... |
| 156 | 153 |
| 157 re = new RegExp(r"^(?!(x)(?=(y)(?!(z))))"); | 154 re = new RegExp(r"^(?!(x)(?=(y)(?!(z))))"); |
| 158 testRE(re, "a", true); | 155 testRE(re, "a", true); |
| 159 testRE(re, "xa", true); | 156 testRE(re, "xa", true); |
| 160 testRE(re, "xyz", true); | 157 testRE(re, "xyz", true); |
| 161 testRE(re, "xya", false); | 158 testRE(re, "xya", false); |
| 162 execRE(re, "a", ["", null, null, null]); | 159 execRE(re, "a", ["", null, null, null]); |
| 163 execRE(re, "xa", ["", null, null, null]); | 160 execRE(re, "xa", ["", null, null, null]); |
| 164 execRE(re, "xyz", ["", null, null, null]); | 161 execRE(re, "xyz", ["", null, null, null]); |
| 165 } | 162 } |
| OLD | NEW |