| 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 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 122 // in the input. | 122 // in the input. |
| 123 const char* tests[] = { | 123 const char* tests[] = { |
| 124 // Before first real token. | 124 // Before first real token. |
| 125 "--> is eol-comment\nvar y = 37;\n", | 125 "--> is eol-comment\nvar y = 37;\n", |
| 126 "\n --> is eol-comment\nvar y = 37;\n", | 126 "\n --> is eol-comment\nvar y = 37;\n", |
| 127 "/* precomment */ --> is eol-comment\nvar y = 37;\n", | 127 "/* precomment */ --> is eol-comment\nvar y = 37;\n", |
| 128 "\n/* precomment */ --> is eol-comment\nvar y = 37;\n", | 128 "\n/* precomment */ --> is eol-comment\nvar y = 37;\n", |
| 129 // After first real token. | 129 // After first real token. |
| 130 "var x = 42;\n--> is eol-comment\nvar y = 37;\n", | 130 "var x = 42;\n--> is eol-comment\nvar y = 37;\n", |
| 131 "var x = 42;\n/* precomment */ --> is eol-comment\nvar y = 37;\n", | 131 "var x = 42;\n/* precomment */ --> is eol-comment\nvar y = 37;\n", |
| 132 "x/* precomment\n */ --> is eol-comment\nvar y = 37;\n", |
| 133 "var x = 42; /* precomment\n */ --> is eol-comment\nvar y = 37;\n", |
| 132 NULL | 134 NULL |
| 133 }; | 135 }; |
| 134 | 136 |
| 135 const char* fail_tests[] = { | 137 const char* fail_tests[] = { |
| 136 "x --> is eol-comment\nvar y = 37;\n", | 138 "x --> is eol-comment\nvar y = 37;\n", |
| 137 "\"\\n\" --> is eol-comment\nvar y = 37;\n", | 139 "\"\\n\" --> is eol-comment\nvar y = 37;\n", |
| 138 "x/* precomment */ --> is eol-comment\nvar y = 37;\n", | 140 "x/* precomment */ --> is eol-comment\nvar y = 37;\n", |
| 139 "x/* precomment\n */ --> is eol-comment\nvar y = 37;\n", | |
| 140 "var x = 42; --> is eol-comment\nvar y = 37;\n", | 141 "var x = 42; --> is eol-comment\nvar y = 37;\n", |
| 141 "var x = 42; /* precomment\n */ --> is eol-comment\nvar y = 37;\n", | |
| 142 NULL | 142 NULL |
| 143 }; | 143 }; |
| 144 | 144 |
| 145 // Parser/Scanner needs a stack limit. | 145 // Parser/Scanner needs a stack limit. |
| 146 CcTest::i_isolate()->stack_guard()->SetStackLimit( | 146 CcTest::i_isolate()->stack_guard()->SetStackLimit( |
| 147 i::GetCurrentStackPosition() - 128 * 1024); | 147 i::GetCurrentStackPosition() - 128 * 1024); |
| 148 uintptr_t stack_limit = CcTest::i_isolate()->stack_guard()->real_climit(); | 148 uintptr_t stack_limit = CcTest::i_isolate()->stack_guard()->real_climit(); |
| 149 for (int i = 0; tests[i]; i++) { | 149 for (int i = 0; tests[i]; i++) { |
| 150 const i::byte* source = | 150 const i::byte* source = |
| 151 reinterpret_cast<const i::byte*>(tests[i]); | 151 reinterpret_cast<const i::byte*>(tests[i]); |
| (...skipping 7788 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7940 "(a,);", | 7940 "(a,);", |
| 7941 "(a,b,c,);", | 7941 "(a,b,c,);", |
| 7942 NULL | 7942 NULL |
| 7943 }; | 7943 }; |
| 7944 // clang-format on | 7944 // clang-format on |
| 7945 | 7945 |
| 7946 static const ParserFlag always_flags[] = {kAllowHarmonyTrailingCommas}; | 7946 static const ParserFlag always_flags[] = {kAllowHarmonyTrailingCommas}; |
| 7947 RunParserSyncTest(context_data, data, kError, NULL, 0, always_flags, | 7947 RunParserSyncTest(context_data, data, kError, NULL, 0, always_flags, |
| 7948 arraysize(always_flags)); | 7948 arraysize(always_flags)); |
| 7949 } | 7949 } |
| OLD | NEW |