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

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

Issue 2739583002: add previous token field (Closed)
Patch Set: merge 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/lib/src/fasta/scanner/token.dart ('k') | pkg/front_end/tool/fasta/compile.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) 2017, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2017, 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/fasta/analyzer/token_utils.dart'; 5 import 'package:front_end/src/fasta/analyzer/token_utils.dart';
6 import 'package:front_end/src/fasta/scanner/error_token.dart' as fasta; 6 import 'package:front_end/src/fasta/scanner/error_token.dart' as fasta;
7 import 'package:front_end/src/fasta/scanner/keyword.dart' as fasta; 7 import 'package:front_end/src/fasta/scanner/keyword.dart' as fasta;
8 import 'package:front_end/src/fasta/scanner/string_scanner.dart' as fasta; 8 import 'package:front_end/src/fasta/scanner/string_scanner.dart' as fasta;
9 import 'package:front_end/src/fasta/scanner/token.dart' as fasta; 9 import 'package:front_end/src/fasta/scanner/token.dart' as fasta;
10 import 'package:front_end/src/fasta/scanner/token_constants.dart' as fasta; 10 import 'package:front_end/src/fasta/scanner/token_constants.dart' as fasta;
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
187 super.test_mismatched_opener(); 187 super.test_mismatched_opener();
188 } 188 }
189 189
190 @override 190 @override
191 @failingTest 191 @failingTest
192 void test_scriptTag_withArgs() { 192 void test_scriptTag_withArgs() {
193 // TODO(paulberry,ahe): script tags are needed by analyzer. 193 // TODO(paulberry,ahe): script tags are needed by analyzer.
194 super.test_scriptTag_withArgs(); 194 super.test_scriptTag_withArgs();
195 } 195 }
196 196
197 void test_next_previous() {
198 const source = 'int a; /*1*/ /*2*/ /*3*/ B f(){if (a < 2) {}}';
199 fasta.Token token =
200 new fasta.StringScanner(source, includeComments: true).tokenize();
201 while (!token.isEof) {
202 expect(token.next.previousToken, token);
203 fasta.Token commentToken = token.precedingComments;
204 while (commentToken != null) {
205 if (commentToken.next != null) {
206 expect(commentToken.next.previousToken, commentToken);
207 }
208 commentToken = commentToken.next;
209 }
210 token = token.next;
211 }
212 }
213
197 @override 214 @override
198 @failingTest 215 @failingTest
199 void test_scriptTag_withoutSpace() { 216 void test_scriptTag_withoutSpace() {
200 // TODO(paulberry,ahe): script tags are needed by analyzer. 217 // TODO(paulberry,ahe): script tags are needed by analyzer.
201 super.test_scriptTag_withoutSpace(); 218 super.test_scriptTag_withoutSpace();
202 } 219 }
203 220
204 @override 221 @override
205 @failingTest 222 @failingTest
206 void test_scriptTag_withSpace() { 223 void test_scriptTag_withSpace() {
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after
479 final ErrorListener _listener; 496 final ErrorListener _listener;
480 497
481 ToAnalyzerTokenStreamConverter_WithListener(this._listener); 498 ToAnalyzerTokenStreamConverter_WithListener(this._listener);
482 499
483 @override 500 @override
484 void reportError( 501 void reportError(
485 ScannerErrorCode errorCode, int offset, List<Object> arguments) { 502 ScannerErrorCode errorCode, int offset, List<Object> arguments) {
486 _listener.errors.add(new TestError(offset, errorCode, arguments)); 503 _listener.errors.add(new TestError(offset, errorCode, arguments));
487 } 504 }
488 } 505 }
OLDNEW
« no previous file with comments | « pkg/front_end/lib/src/fasta/scanner/token.dart ('k') | pkg/front_end/tool/fasta/compile.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698