Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(64)

Side by Side Diff: pkg/front_end/test/scanner_test.dart

Issue 2767083002: fasta scanner recovery and error code translation improvements (Closed)
Patch Set: revert address comments and fix for token_stream_rewriter test Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « pkg/front_end/test/scanner_replacement_test.dart ('k') | pkg/front_end/tool/fasta_perf.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2016, 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 import 'package:front_end/src/base/errors.dart'; 5 import 'package:front_end/src/base/errors.dart';
6 import 'package:front_end/src/base/jenkins_smi_hash.dart'; 6 import 'package:front_end/src/base/jenkins_smi_hash.dart';
7 import 'package:front_end/src/scanner/errors.dart'; 7 import 'package:front_end/src/scanner/errors.dart';
8 import 'package:front_end/src/scanner/reader.dart'; 8 import 'package:front_end/src/scanner/reader.dart';
9 import 'package:front_end/src/scanner/scanner.dart'; 9 import 'package:front_end/src/scanner/scanner.dart';
10 import 'package:front_end/src/scanner/token.dart'; 10 import 'package:front_end/src/scanner/token.dart';
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
158 158
159 void test_ampersand_ampersand_eq() { 159 void test_ampersand_ampersand_eq() {
160 _assertToken(TokenType.AMPERSAND_AMPERSAND_EQ, "&&=", 160 _assertToken(TokenType.AMPERSAND_AMPERSAND_EQ, "&&=",
161 lazyAssignmentOperators: true); 161 lazyAssignmentOperators: true);
162 } 162 }
163 163
164 void test_ampersand_eq() { 164 void test_ampersand_eq() {
165 _assertToken(TokenType.AMPERSAND_EQ, "&="); 165 _assertToken(TokenType.AMPERSAND_EQ, "&=");
166 } 166 }
167 167
168 void test_angle_brackets_are_ordinary_tokens() { 168 void test_angle_brackets() {
169 // Analyzer's token streams don't consider "<" to be an opener. 169 var lessThan = _scan('<String>');
170 var lessThan = _scan('<>'); 170 var identifier = lessThan.next;
171 var greaterThan = lessThan.next; 171 var greaterThan = identifier.next;
172 expect(greaterThan.next.type, TokenType.EOF); 172 expect(greaterThan.next.type, TokenType.EOF);
173 expect(lessThan, isNot(new isInstanceOf<BeginToken>())); 173 // Analyzer's token streams don't consider "<" to be an opener
174 // but fasta does.
175 if (lessThan is BeginToken) {
176 expect(lessThan.endToken, greaterThan);
177 }
174 expect(greaterThan, isNot(new isInstanceOf<BeginToken>())); 178 expect(greaterThan, isNot(new isInstanceOf<BeginToken>()));
175 } 179 }
176 180
177 void test_async_star() { 181 void test_async_star() {
178 Token token = _scan("async*"); 182 Token token = _scan("async*");
179 expect(token.type, TokenType.IDENTIFIER); 183 expect(token.type, TokenType.IDENTIFIER);
180 expect(token.lexeme, 'async'); 184 expect(token.lexeme, 'async');
181 expect(token.next.type, TokenType.STAR); 185 expect(token.next.type, TokenType.STAR);
182 expect(token.next.next.type, TokenType.EOF); 186 expect(token.next.next.type, TokenType.EOF);
183 } 187 }
(...skipping 1333 matching lines...) Expand 10 before | Expand all | Expand 10 after
1517 _TestScanner(CharacterReader reader, [this.listener]) : super(reader); 1521 _TestScanner(CharacterReader reader, [this.listener]) : super(reader);
1518 1522
1519 @override 1523 @override
1520 void reportError( 1524 void reportError(
1521 ScannerErrorCode errorCode, int offset, List<Object> arguments) { 1525 ScannerErrorCode errorCode, int offset, List<Object> arguments) {
1522 if (listener != null) { 1526 if (listener != null) {
1523 listener.errors.add(new TestError(offset, errorCode, arguments)); 1527 listener.errors.add(new TestError(offset, errorCode, arguments));
1524 } 1528 }
1525 } 1529 }
1526 } 1530 }
OLDNEW
« no previous file with comments | « pkg/front_end/test/scanner_replacement_test.dart ('k') | pkg/front_end/tool/fasta_perf.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698