| OLD | NEW |
| 1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-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 319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 330 static void Execute(const char* input, | 330 static void Execute(const char* input, |
| 331 const char* str, | 331 const char* str, |
| 332 bool dot_output = false) { | 332 bool dot_output = false) { |
| 333 v8::HandleScope scope; | 333 v8::HandleScope scope; |
| 334 unibrow::Utf8InputBuffer<> buffer(input, strlen(input)); | 334 unibrow::Utf8InputBuffer<> buffer(input, strlen(input)); |
| 335 ZoneScope zone_scope(DELETE_ON_EXIT); | 335 ZoneScope zone_scope(DELETE_ON_EXIT); |
| 336 RegExpParseResult result; | 336 RegExpParseResult result; |
| 337 if (!v8::internal::ParseRegExp(&buffer, &result)) | 337 if (!v8::internal::ParseRegExp(&buffer, &result)) |
| 338 return; | 338 return; |
| 339 RegExpNode* node = RegExpEngine::Compile(&result); | 339 RegExpNode* node = RegExpEngine::Compile(&result); |
| 340 USE(node); |
| 341 #ifdef DEBUG |
| 340 if (dot_output) { | 342 if (dot_output) { |
| 341 RegExpEngine::DotPrint(input, node); | 343 RegExpEngine::DotPrint(input, node); |
| 342 exit(0); | 344 exit(0); |
| 343 } | 345 } |
| 346 #endif // DEBUG |
| 344 } | 347 } |
| 345 | 348 |
| 346 | 349 |
| 347 TEST(Execution) { | 350 TEST(Execution) { |
| 348 V8::Initialize(NULL); | 351 V8::Initialize(NULL); |
| 349 Execute(".*?(?:a[bc]d|e[fg]h)", "xxxabbegh"); | 352 Execute(".*?(?:a[bc]d|e[fg]h)", "xxxabbegh"); |
| 350 Execute(".*?(?:a[bc]d|e[fg]h)", "xxxabbefh"); | 353 Execute(".*?(?:a[bc]d|e[fg]h)", "xxxabbefh"); |
| 351 Execute(".*?(?:a[bc]d|e[fg]h)", "xxxabbefd"); | 354 Execute(".*?(?:a[bc]d|e[fg]h)", "xxxabbefd"); |
| 352 } | 355 } |
| 353 | 356 |
| (...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 602 | 605 |
| 603 Handle<String> f5 = | 606 Handle<String> f5 = |
| 604 Factory::NewStringFromAscii(CStrVector("walking\nbarefoot")); | 607 Factory::NewStringFromAscii(CStrVector("walking\nbarefoot")); |
| 605 CHECK(!Re2kInterpreter::Match(*array, *f5, captures, 0)); | 608 CHECK(!Re2kInterpreter::Match(*array, *f5, captures, 0)); |
| 606 } | 609 } |
| 607 | 610 |
| 608 | 611 |
| 609 TEST(Graph) { | 612 TEST(Graph) { |
| 610 Execute("(a|b|c|\\w|\\s)", "", true); | 613 Execute("(a|b|c|\\w|\\s)", "", true); |
| 611 } | 614 } |
| OLD | NEW |