| 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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 i::UnicodeCache unicode_cache; | 58 i::UnicodeCache unicode_cache; |
| 59 i::byte buffer[32]; | 59 i::byte buffer[32]; |
| 60 for (int i = 0; (key_token = keywords[i]).keyword != NULL; i++) { | 60 for (int i = 0; (key_token = keywords[i]).keyword != NULL; i++) { |
| 61 const i::byte* keyword = | 61 const i::byte* keyword = |
| 62 reinterpret_cast<const i::byte*>(key_token.keyword); | 62 reinterpret_cast<const i::byte*>(key_token.keyword); |
| 63 int length = i::StrLength(key_token.keyword); | 63 int length = i::StrLength(key_token.keyword); |
| 64 CHECK(static_cast<int>(sizeof(buffer)) >= length); | 64 CHECK(static_cast<int>(sizeof(buffer)) >= length); |
| 65 { | 65 { |
| 66 i::Utf8ToUC16CharacterStream stream(keyword, length); | 66 i::Utf8ToUC16CharacterStream stream(keyword, length); |
| 67 i::Scanner scanner(&unicode_cache); | 67 i::Scanner scanner(&unicode_cache); |
| 68 // The scanner should parse 'let' as Token::LET for this test. | 68 // The scanner should parse Harmony keywords for this test. |
| 69 scanner.SetHarmonyScoping(true); | 69 scanner.SetHarmonyScoping(true); |
| 70 scanner.SetHarmonyModules(true); |
| 70 scanner.Initialize(&stream); | 71 scanner.Initialize(&stream); |
| 71 CHECK_EQ(key_token.token, scanner.Next()); | 72 CHECK_EQ(key_token.token, scanner.Next()); |
| 72 CHECK_EQ(i::Token::EOS, scanner.Next()); | 73 CHECK_EQ(i::Token::EOS, scanner.Next()); |
| 73 } | 74 } |
| 74 // Removing characters will make keyword matching fail. | 75 // Removing characters will make keyword matching fail. |
| 75 { | 76 { |
| 76 i::Utf8ToUC16CharacterStream stream(keyword, length - 1); | 77 i::Utf8ToUC16CharacterStream stream(keyword, length - 1); |
| 77 i::Scanner scanner(&unicode_cache); | 78 i::Scanner scanner(&unicode_cache); |
| 78 scanner.Initialize(&stream); | 79 scanner.Initialize(&stream); |
| 79 CHECK_EQ(i::Token::IDENTIFIER, scanner.Next()); | 80 CHECK_EQ(i::Token::IDENTIFIER, scanner.Next()); |
| (...skipping 995 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1075 termination_data[k], | 1076 termination_data[k], |
| 1076 context_data[i][1]); | 1077 context_data[i][1]); |
| 1077 CHECK(length == kProgramSize); | 1078 CHECK(length == kProgramSize); |
| 1078 i::Handle<i::String> source = | 1079 i::Handle<i::String> source = |
| 1079 FACTORY->NewStringFromAscii(i::CStrVector(program.start())); | 1080 FACTORY->NewStringFromAscii(i::CStrVector(program.start())); |
| 1080 TestParserSyncWithFlags(source); | 1081 TestParserSyncWithFlags(source); |
| 1081 } | 1082 } |
| 1082 } | 1083 } |
| 1083 } | 1084 } |
| 1084 } | 1085 } |
| OLD | NEW |