OLD | NEW |
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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 CHECK(v8::internal::ParseRegExp(&reader, false, &result)); | 67 CHECK(v8::internal::ParseRegExp(&reader, false, &result)); |
68 CHECK(result.tree != NULL); | 68 CHECK(result.tree != NULL); |
69 CHECK(result.error.is_null()); | 69 CHECK(result.error.is_null()); |
70 SmartPointer<const char> output = result.tree->ToString(); | 70 SmartPointer<const char> output = result.tree->ToString(); |
71 return output; | 71 return output; |
72 } | 72 } |
73 | 73 |
74 static bool CheckSimple(const char* input) { | 74 static bool CheckSimple(const char* input) { |
75 V8::Initialize(NULL); | 75 V8::Initialize(NULL); |
76 v8::HandleScope scope; | 76 v8::HandleScope scope; |
77 unibrow::Utf8InputBuffer<> buffer(input, strlen(input)); | 77 unibrow::Utf8InputBuffer<> buffer(input, StrLength(input)); |
78 ZoneScope zone_scope(DELETE_ON_EXIT); | 78 ZoneScope zone_scope(DELETE_ON_EXIT); |
79 FlatStringReader reader(CStrVector(input)); | 79 FlatStringReader reader(CStrVector(input)); |
80 RegExpCompileData result; | 80 RegExpCompileData result; |
81 CHECK(v8::internal::ParseRegExp(&reader, false, &result)); | 81 CHECK(v8::internal::ParseRegExp(&reader, false, &result)); |
82 CHECK(result.tree != NULL); | 82 CHECK(result.tree != NULL); |
83 CHECK(result.error.is_null()); | 83 CHECK(result.error.is_null()); |
84 return result.simple; | 84 return result.simple; |
85 } | 85 } |
86 | 86 |
87 struct MinMaxPair { | 87 struct MinMaxPair { |
88 int min_match; | 88 int min_match; |
89 int max_match; | 89 int max_match; |
90 }; | 90 }; |
91 | 91 |
92 static MinMaxPair CheckMinMaxMatch(const char* input) { | 92 static MinMaxPair CheckMinMaxMatch(const char* input) { |
93 V8::Initialize(NULL); | 93 V8::Initialize(NULL); |
94 v8::HandleScope scope; | 94 v8::HandleScope scope; |
95 unibrow::Utf8InputBuffer<> buffer(input, strlen(input)); | 95 unibrow::Utf8InputBuffer<> buffer(input, StrLength(input)); |
96 ZoneScope zone_scope(DELETE_ON_EXIT); | 96 ZoneScope zone_scope(DELETE_ON_EXIT); |
97 FlatStringReader reader(CStrVector(input)); | 97 FlatStringReader reader(CStrVector(input)); |
98 RegExpCompileData result; | 98 RegExpCompileData result; |
99 CHECK(v8::internal::ParseRegExp(&reader, false, &result)); | 99 CHECK(v8::internal::ParseRegExp(&reader, false, &result)); |
100 CHECK(result.tree != NULL); | 100 CHECK(result.tree != NULL); |
101 CHECK(result.error.is_null()); | 101 CHECK(result.error.is_null()); |
102 int min_match = result.tree->min_match(); | 102 int min_match = result.tree->min_match(); |
103 int max_match = result.tree->max_match(); | 103 int max_match = result.tree->max_match(); |
104 MinMaxPair pair = { min_match, max_match }; | 104 MinMaxPair pair = { min_match, max_match }; |
105 return pair; | 105 return pair; |
(...skipping 1441 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1547 CHECK(!InClass(i, excluded)); | 1547 CHECK(!InClass(i, excluded)); |
1548 } | 1548 } |
1549 } | 1549 } |
1550 } | 1550 } |
1551 | 1551 |
1552 | 1552 |
1553 TEST(Graph) { | 1553 TEST(Graph) { |
1554 V8::Initialize(NULL); | 1554 V8::Initialize(NULL); |
1555 Execute("(?:(?:x(.))?\1)+$", false, true, true); | 1555 Execute("(?:(?:x(.))?\1)+$", false, true, true); |
1556 } | 1556 } |
OLD | NEW |