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 486 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
497 static RegExpNode* Compile(const char* input, bool multiline, bool is_ascii) { | 497 static RegExpNode* Compile(const char* input, bool multiline, bool is_ascii) { |
498 V8::Initialize(NULL); | 498 V8::Initialize(NULL); |
499 Isolate* isolate = Isolate::Current(); | 499 Isolate* isolate = Isolate::Current(); |
500 FlatStringReader reader(isolate, CStrVector(input)); | 500 FlatStringReader reader(isolate, CStrVector(input)); |
501 RegExpCompileData compile_data; | 501 RegExpCompileData compile_data; |
502 if (!v8::internal::RegExpParser::ParseRegExp(&reader, multiline, | 502 if (!v8::internal::RegExpParser::ParseRegExp(&reader, multiline, |
503 &compile_data)) | 503 &compile_data)) |
504 return NULL; | 504 return NULL; |
505 Handle<String> pattern = isolate->factory()-> | 505 Handle<String> pattern = isolate->factory()-> |
506 NewStringFromUtf8(CStrVector(input)); | 506 NewStringFromUtf8(CStrVector(input)); |
507 RegExpEngine::Compile(&compile_data, false, multiline, pattern, is_ascii); | 507 Handle<String> sample_subject = |
| 508 isolate->factory()->NewStringFromUtf8(CStrVector("")); |
| 509 RegExpEngine::Compile( |
| 510 &compile_data, false, multiline, pattern, sample_subject, is_ascii); |
508 return compile_data.node; | 511 return compile_data.node; |
509 } | 512 } |
510 | 513 |
511 | 514 |
512 static void Execute(const char* input, | 515 static void Execute(const char* input, |
513 bool multiline, | 516 bool multiline, |
514 bool is_ascii, | 517 bool is_ascii, |
515 bool dot_output = false) { | 518 bool dot_output = false) { |
516 v8::HandleScope scope; | 519 v8::HandleScope scope; |
517 ZoneScope zone_scope(Isolate::Current(), DELETE_ON_EXIT); | 520 ZoneScope zone_scope(Isolate::Current(), DELETE_ON_EXIT); |
(...skipping 1308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1826 bool in_second = CharacterInSet(&l2, i); | 1829 bool in_second = CharacterInSet(&l2, i); |
1827 CHECK((in_first || in_second) == CharacterInSet(&all, i)); | 1830 CHECK((in_first || in_second) == CharacterInSet(&all, i)); |
1828 } | 1831 } |
1829 } | 1832 } |
1830 | 1833 |
1831 | 1834 |
1832 TEST(Graph) { | 1835 TEST(Graph) { |
1833 V8::Initialize(NULL); | 1836 V8::Initialize(NULL); |
1834 Execute("\\b\\w+\\b", false, true, true); | 1837 Execute("\\b\\w+\\b", false, true, true); |
1835 } | 1838 } |
OLD | NEW |