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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
59 // We test FilterASCII using regexps that will backtrack forever. Since | 59 // We test FilterASCII using regexps that will backtrack forever. Since |
60 // a regexp with a non-ASCII character in it can never match an ASCII | 60 // a regexp with a non-ASCII character in it can never match an ASCII |
61 // string we can test that the relevant node is removed by verifying that | 61 // string we can test that the relevant node is removed by verifying that |
62 // there is no hang. | 62 // there is no hang. |
63 dynamic NoHang(re) { | 63 dynamic NoHang(re) { |
64 firstMatch("This is an ASCII string that could take forever", re); | 64 firstMatch("This is an ASCII string that could take forever", re); |
65 } | 65 } |
66 | 66 |
67 NoHang(new RegExp(r"(((.*)*)*x)Ā")); // Continuation after loop is filtered, so is loop. | 67 NoHang(new RegExp(r"(((.*)*)*x)Ā")); // Continuation after loop is filtered, so is loop. |
68 NoHang(new RegExp(r"(((.*)*)*Ā)foo")); // Body of loop filtered. | 68 NoHang(new RegExp(r"(((.*)*)*Ā)foo")); // Body of loop filtered. |
69 NoHang(new RegExp(r"Ā(((.*)*)*x)")); // Everything after a filtered characte r is filtered. | 69 NoHang(new RegExp(r"Ā(((.*)*)*x)")); // Everything after a filtered characte r is filtered. |
sra1
2017/03/21 03:39:29
revert
| |
70 NoHang(new RegExp(r"(((.*)*)*x)Ā")); // Everything before a filtered charact er is filtered. | 70 NoHang(new RegExp(r"(((.*)*)*x)Ā")); // Everything before a filtered charact er is filtered. |
71 NoHang(new RegExp(r"[ćăĀ](((.*)*)*x)")); // Everything after a filtered clas s is filtered. | 71 NoHang(new RegExp(r"[ćăĀ](((.*)*)*x)")); // Everything after a filtered clas s is filtered. |
72 NoHang(new RegExp(r"(((.*)*)*x)[ćăĀ]")); // Everything before a filtered cla ss is filtered. | 72 NoHang(new RegExp(r"(((.*)*)*x)[ćăĀ]")); // Everything before a filtered cla ss is filtered. |
73 NoHang(new RegExp(r"[^\x00-\xff](((.*)*)*x)")); // After negated class. | 73 NoHang(new RegExp(r"[^\x00-\xff](((.*)*)*x)")); // After negated class. |
74 NoHang(new RegExp(r"(((.*)*)*x)[^\x00-\xff]")); // Before negated class. | 74 NoHang(new RegExp(r"(((.*)*)*x)[^\x00-\xff]")); // Before negated class. |
75 NoHang(new RegExp(r"(?!(((.*)*)*x)Ā)foo")); // Negative lookahead is filtered . | 75 NoHang(new RegExp(r"(?!(((.*)*)*x)Ā)foo")); // Negative lookahead is filtered . |
76 NoHang(new RegExp(r"(?!(((.*)*)*x))Ā")); // Continuation branch of negative l ookahead. | 76 NoHang(new RegExp(r"(?!(((.*)*)*x))Ā")); // Continuation branch of negative l ookahead. |
77 NoHang(new RegExp(r"(?=(((.*)*)*x)Ā)foo")); // Positive lookahead is filtered . | 77 NoHang(new RegExp(r"(?=(((.*)*)*x)Ā)foo")); // Positive lookahead is filtered . |
78 NoHang(new RegExp(r"(?=(((.*)*)*x))Ā")); // Continuation branch of positive l ookahead. | 78 NoHang(new RegExp(r"(?=(((.*)*)*x))Ā")); // Continuation branch of positive l ookahead. |
79 NoHang(new RegExp(r"(?=Ā)(((.*)*)*x)")); // Positive lookahead also prunes co ntinuation. | 79 NoHang(new RegExp(r"(?=Ā)(((.*)*)*x)")); // Positive lookahead also prunes co ntinuation. |
80 NoHang(new RegExp(r"(æ|ø|Ā)(((.*)*)*x)")); // All branches of alternation are filtered. | 80 NoHang(new RegExp(r"(æ|ø|Ā)(((.*)*)*x)")); // All branches of alternation are filtered. |
81 NoHang(new RegExp(r"(a|b|(((.*)*)*x))Ā")); // 1 out of 3 branches pruned. | 81 NoHang(new RegExp(r"(a|b|(((.*)*)*x))Ā")); // 1 out of 3 branches pruned. |
82 NoHang(new RegExp(r"(a|(((.*)*)*x)ă|(((.*)*)*x)Ā)")); // 2 out of 3 branches pruned. | 82 NoHang(new RegExp(r"(a|(((.*)*)*x)ă|(((.*)*)*x)Ā)")); // 2 out of 3 branches pruned. |
83 | 83 |
84 var s = "Don't prune based on a repetition of length 0"; | 84 var s = "Don't prune based on a repetition of length 0"; |
(...skipping 24 matching lines...) Expand all Loading... | |
109 | 109 |
110 var regex10 = new RegExp(re, caseSensitive: false); | 110 var regex10 = new RegExp(re, caseSensitive: false); |
111 regex10.firstMatch(input0); | 111 regex10.firstMatch(input0); |
112 | 112 |
113 var regex11 = new RegExp(r"^(?:[^\u0000-\u0080]|[0-9a-z?,.!&\s#()])+$", caseSe nsitive: false); | 113 var regex11 = new RegExp(r"^(?:[^\u0000-\u0080]|[0-9a-z?,.!&\s#()])+$", caseSe nsitive: false); |
114 regex11.firstMatch(input0); | 114 regex11.firstMatch(input0); |
115 | 115 |
116 var regex12 = new RegExp(r"u(\xf0{8}?\D*?|( ? !)$h??(|)*?(||)+?\6((?:\W\B|--\d -*-|)?$){0, }?|^Y( ? !1)\d+)+a"); | 116 var regex12 = new RegExp(r"u(\xf0{8}?\D*?|( ? !)$h??(|)*?(||)+?\6((?:\W\B|--\d -*-|)?$){0, }?|^Y( ? !1)\d+)+a"); |
117 regex12.firstMatch(""); | 117 regex12.firstMatch(""); |
118 } | 118 } |
OLD | NEW |