OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 867 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
878 void TestScanRegExp(const char* re_source, const char* expected) { | 878 void TestScanRegExp(const char* re_source, const char* expected) { |
879 i::Utf8ToUtf16CharacterStream stream( | 879 i::Utf8ToUtf16CharacterStream stream( |
880 reinterpret_cast<const i::byte*>(re_source), | 880 reinterpret_cast<const i::byte*>(re_source), |
881 static_cast<unsigned>(strlen(re_source))); | 881 static_cast<unsigned>(strlen(re_source))); |
882 i::HandleScope scope(CcTest::i_isolate()); | 882 i::HandleScope scope(CcTest::i_isolate()); |
883 i::Scanner scanner(CcTest::i_isolate()->unicode_cache()); | 883 i::Scanner scanner(CcTest::i_isolate()->unicode_cache()); |
884 scanner.Initialize(&stream); | 884 scanner.Initialize(&stream); |
885 | 885 |
886 i::Token::Value start = scanner.peek(); | 886 i::Token::Value start = scanner.peek(); |
887 CHECK(start == i::Token::DIV || start == i::Token::ASSIGN_DIV); | 887 CHECK(start == i::Token::DIV || start == i::Token::ASSIGN_DIV); |
888 CHECK(scanner.ScanRegExpPattern(start == i::Token::ASSIGN_DIV)); | 888 CHECK(scanner.ScanRegExpPattern()); |
889 scanner.Next(); // Current token is now the regexp literal. | 889 scanner.Next(); // Current token is now the regexp literal. |
890 i::Zone zone(CcTest::i_isolate()->allocator()); | 890 i::Zone zone(CcTest::i_isolate()->allocator()); |
891 i::AstValueFactory ast_value_factory(&zone, | 891 i::AstValueFactory ast_value_factory(&zone, |
892 CcTest::i_isolate()->heap()->HashSeed()); | 892 CcTest::i_isolate()->heap()->HashSeed()); |
893 ast_value_factory.Internalize(CcTest::i_isolate()); | 893 ast_value_factory.Internalize(CcTest::i_isolate()); |
894 i::Handle<i::String> val = | 894 i::Handle<i::String> val = |
895 scanner.CurrentSymbol(&ast_value_factory)->string(); | 895 scanner.CurrentSymbol(&ast_value_factory)->string(); |
896 i::DisallowHeapAllocation no_alloc; | 896 i::DisallowHeapAllocation no_alloc; |
897 i::String::FlatContent content = val->GetFlatContent(); | 897 i::String::FlatContent content = val->GetFlatContent(); |
898 CHECK(content.IsOneByte()); | 898 CHECK(content.IsOneByte()); |
(...skipping 7242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8141 "(a,);", | 8141 "(a,);", |
8142 "(a,b,c,);", | 8142 "(a,b,c,);", |
8143 NULL | 8143 NULL |
8144 }; | 8144 }; |
8145 // clang-format on | 8145 // clang-format on |
8146 | 8146 |
8147 static const ParserFlag always_flags[] = {kAllowHarmonyTrailingCommas}; | 8147 static const ParserFlag always_flags[] = {kAllowHarmonyTrailingCommas}; |
8148 RunParserSyncTest(context_data, data, kError, NULL, 0, always_flags, | 8148 RunParserSyncTest(context_data, data, kError, NULL, 0, always_flags, |
8149 arraysize(always_flags)); | 8149 arraysize(always_flags)); |
8150 } | 8150 } |
OLD | NEW |