OLD | NEW |
1 // Copyright 2016 the V8 project authors. All rights reserved. | 1 // Copyright 2016 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // Tests v8::internal::Scanner. Note that presently most unit tests for the | 5 // Tests v8::internal::Scanner. Note that presently most unit tests for the |
6 // Scanner are in cctest/test-parsing.cc, rather than here. | 6 // Scanner are in cctest/test-parsing.cc, rather than here. |
7 | 7 |
8 #include "src/handles-inl.h" | 8 #include "src/handles-inl.h" |
9 #include "src/parsing/scanner-character-streams.h" | 9 #include "src/parsing/scanner-character-streams.h" |
10 #include "src/parsing/scanner.h" | 10 #include "src/parsing/scanner.h" |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 auto scanner = make_scanner(src_simple); | 49 auto scanner = make_scanner(src_simple); |
50 Scanner::BookmarkScope bookmark(scanner.get()); | 50 Scanner::BookmarkScope bookmark(scanner.get()); |
51 | 51 |
52 for (size_t i = 0; i < std::min(bookmark_pos + 10, tokens.size()); i++) { | 52 for (size_t i = 0; i < std::min(bookmark_pos + 10, tokens.size()); i++) { |
53 if (i == bookmark_pos) { | 53 if (i == bookmark_pos) { |
54 bookmark.Set(); | 54 bookmark.Set(); |
55 } | 55 } |
56 DCHECK_EQ(tokens[i], scanner->Next()); | 56 DCHECK_EQ(tokens[i], scanner->Next()); |
57 } | 57 } |
58 | 58 |
59 bookmark.Reset(); | 59 bookmark.Apply(); |
60 for (size_t i = bookmark_pos; i < tokens.size(); i++) { | 60 for (size_t i = bookmark_pos; i < tokens.size(); i++) { |
61 DCHECK_EQ(tokens[i], scanner->Next()); | 61 DCHECK_EQ(tokens[i], scanner->Next()); |
62 } | 62 } |
63 } | 63 } |
64 } | 64 } |
OLD | NEW |