OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 #include "platform/assert.h" | 5 #include "platform/assert.h" |
6 #include "vm/os.h" | 6 #include "vm/os.h" |
7 #include "vm/scanner.h" | 7 #include "vm/scanner.h" |
8 #include "vm/token.h" | 8 #include "vm/token.h" |
9 #include "vm/unit_test.h" | 9 #include "vm/unit_test.h" |
10 | 10 |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 if (token_stream[index].position.line != line_number) { | 81 if (token_stream[index].position.line != line_number) { |
82 OS::PrintErr("Token %d: expected line number %d but got %d\n", | 82 OS::PrintErr("Token %d: expected line number %d but got %d\n", |
83 index, line_number, token_stream[index].position.line); | 83 index, line_number, token_stream[index].position.line); |
84 } | 84 } |
85 } | 85 } |
86 | 86 |
87 | 87 |
88 void CheckNumTokens(const Scanner::GrowableTokenStream& token_stream, | 88 void CheckNumTokens(const Scanner::GrowableTokenStream& token_stream, |
89 int index) { | 89 int index) { |
90 if (token_stream.length() != index) { | 90 if (token_stream.length() != index) { |
91 OS::PrintErr("Expected %d tokens but got only %d.\n", | 91 OS::PrintErr("Expected %d tokens but got only %" Pd ".\n", |
92 index, token_stream.length()); | 92 index, token_stream.length()); |
93 } | 93 } |
94 } | 94 } |
95 | 95 |
96 | 96 |
97 const Scanner::GrowableTokenStream& Scan(const char* source) { | 97 const Scanner::GrowableTokenStream& Scan(const char* source) { |
98 Scanner scanner(String::Handle(String::New(source)), | 98 Scanner scanner(String::Handle(String::New(source)), |
99 String::Handle(String::New(""))); | 99 String::Handle(String::New(""))); |
100 | 100 |
101 OS::Print("\nScanning: <%s>\n", source); | 101 OS::Print("\nScanning: <%s>\n", source); |
(...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
454 RawString(); | 454 RawString(); |
455 MultilineString(); | 455 MultilineString(); |
456 EmptyString(); | 456 EmptyString(); |
457 EmptyMultilineString(); | 457 EmptyMultilineString(); |
458 NumberLiteral(); | 458 NumberLiteral(); |
459 InvalidText(); | 459 InvalidText(); |
460 NewlinesTest(); | 460 NewlinesTest(); |
461 } | 461 } |
462 | 462 |
463 } // namespace dart | 463 } // namespace dart |
OLD | NEW |