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

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

Issue 2738313002: rename fasta.Token.value --> lexeme (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
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 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 expect(comment.info.kind, fasta.COMMENT_TOKEN); 108 expect(comment.info.kind, fasta.COMMENT_TOKEN);
109 expect(comment.charOffset, greaterThanOrEqualTo(previousEnd)); 109 expect(comment.charOffset, greaterThanOrEqualTo(previousEnd));
110 previousEnd = comment.charOffset + comment.charCount; 110 previousEnd = comment.charOffset + comment.charCount;
111 comment = comment.next; 111 comment = comment.next;
112 } 112 }
113 expect(token.info.kind, isNot(fasta.COMMENT_TOKEN)); 113 expect(token.info.kind, isNot(fasta.COMMENT_TOKEN));
114 expect(token.charOffset, greaterThanOrEqualTo(previousEnd)); 114 expect(token.charOffset, greaterThanOrEqualTo(previousEnd));
115 previousEnd = token.charOffset + token.charCount; 115 previousEnd = token.charOffset + token.charCount;
116 116
117 // Spot check for specific token/comment combinations 117 // Spot check for specific token/comment combinations
118 if (token.value == 'class') { 118 if (token.lexeme == 'class') {
119 ++spotCheckCount; 119 ++spotCheckCount;
120 expect(token.precedingComments?.value, '/// Doc comment before class'); 120 expect(token.precedingComments?.lexeme, '/// Doc comment before class');
121 expect(token.precedingComments?.next?.value, '/// second line'); 121 expect(token.precedingComments?.next?.lexeme, '/// second line');
122 expect(token.precedingComments?.next?.next?.value, '/// third'); 122 expect(token.precedingComments?.next?.next?.lexeme, '/// third');
123 expect(token.precedingComments?.next?.next?.next, isNull); 123 expect(token.precedingComments?.next?.next?.next, isNull);
124 } else if (token.value == 'Foo2') { 124 } else if (token.lexeme == 'Foo2') {
125 ++spotCheckCount; 125 ++spotCheckCount;
126 expect(token.precedingComments?.value, '/** Doc comment 2 */'); 126 expect(token.precedingComments?.lexeme, '/** Doc comment 2 */');
127 } else if (token.value == ')') { 127 } else if (token.lexeme == ')') {
128 if (token.precedingComments != null) { 128 if (token.precedingComments != null) {
129 ++spotCheckCount; 129 ++spotCheckCount;
130 expect(token.precedingComments?.value, 130 expect(token.precedingComments?.lexeme,
131 '/* comment before closing paren */'); 131 '/* comment before closing paren */');
132 expect(token.precedingComments?.next, isNull); 132 expect(token.precedingComments?.next, isNull);
133 } 133 }
134 } 134 }
135 135
136 token = token.next; 136 token = token.next;
137 } 137 }
138 expect(tokenCount, 26); 138 expect(tokenCount, 26);
139 expect(spotCheckCount, 3); 139 expect(spotCheckCount, 3);
140 expect(commentTokenCount, 9); 140 expect(commentTokenCount, 9);
141 expect(token.precedingComments?.value, '// EOF comment'); 141 expect(token.precedingComments?.lexeme, '// EOF comment');
142 } 142 }
143 143
144 @override 144 @override
145 @failingTest 145 @failingTest
146 void test_comment_generic_method_type_assign() { 146 void test_comment_generic_method_type_assign() {
147 // TODO(paulberry,ahe): Fasta doesn't support generic method comment syntax. 147 // TODO(paulberry,ahe): Fasta doesn't support generic method comment syntax.
148 super.test_comment_generic_method_type_assign(); 148 super.test_comment_generic_method_type_assign();
149 } 149 }
150 150
151 @override 151 @override
(...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after
475 final ErrorListener _listener; 475 final ErrorListener _listener;
476 476
477 ToAnalyzerTokenStreamConverter_WithListener(this._listener); 477 ToAnalyzerTokenStreamConverter_WithListener(this._listener);
478 478
479 @override 479 @override
480 void reportError( 480 void reportError(
481 ScannerErrorCode errorCode, int offset, List<Object> arguments) { 481 ScannerErrorCode errorCode, int offset, List<Object> arguments) {
482 _listener.errors.add(new TestError(offset, errorCode, arguments)); 482 _listener.errors.add(new TestError(offset, errorCode, arguments));
483 } 483 }
484 } 484 }
OLDNEW
« no previous file with comments | « pkg/front_end/lib/src/fasta/source/stack_listener.dart ('k') | pkg/front_end/tool/fasta_perf.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698