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

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

Issue 2797353002: Revert "enhance analyzer to parse uppercase and built-in/pseudo keywords" (Closed)
Patch Set: Created 3 years, 8 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/scanner/token.dart ('k') | no next file » | 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/scanner/string_scanner.dart'; 5 import 'package:front_end/src/fasta/scanner/string_scanner.dart';
6 import 'package:front_end/src/fasta/scanner/keyword.dart' as fasta; 6 import 'package:front_end/src/fasta/scanner/keyword.dart' as fasta;
7 import 'package:front_end/src/fasta/scanner/token.dart' as fasta; 7 import 'package:front_end/src/fasta/scanner/token.dart' as fasta;
8 import 'package:front_end/src/scanner/token.dart'; 8 import 'package:front_end/src/scanner/token.dart';
9 import 'package:front_end/src/scanner/reader.dart' as analyzer; 9 import 'package:front_end/src/scanner/reader.dart' as analyzer;
10 import 'package:test/test.dart'; 10 import 'package:test/test.dart';
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
152 var token = scanner.tokenize(); 152 var token = scanner.tokenize();
153 expect(token.matchesAny([TokenType.KEYWORD]), true); 153 expect(token.matchesAny([TokenType.KEYWORD]), true);
154 expect(token.matchesAny([TokenType.AMPERSAND, TokenType.KEYWORD]), true); 154 expect(token.matchesAny([TokenType.AMPERSAND, TokenType.KEYWORD]), true);
155 expect(token.matchesAny([TokenType.AMPERSAND]), false); 155 expect(token.matchesAny([TokenType.AMPERSAND]), false);
156 } 156 }
157 157
158 /// Return all fasta and all analyzer keywords 158 /// Return all fasta and all analyzer keywords
159 List<Keyword> get _allKeywords => 159 List<Keyword> get _allKeywords =>
160 new List.from(Keyword.values)..addAll(fasta.Keyword.values); 160 new List.from(Keyword.values)..addAll(fasta.Keyword.values);
161 161
162 void test_all_keywords() {
163 var keywords = new Set<fasta.Keyword>.from(fasta.Keyword.values);
164 for (Keyword kw in Keyword.values) {
165 expect(keywords.remove(kw), isTrue, reason: kw.name);
166 }
167 expect(keywords, isEmpty);
168 }
169
170 void test_built_in_keywords() { 162 void test_built_in_keywords() {
171 var builtInKeywords = new Set<Keyword>.from([ 163 var builtInKeywords = new Set<Keyword>.from([
172 Keyword.ABSTRACT, 164 Keyword.ABSTRACT,
173 Keyword.AS, 165 Keyword.AS,
174 Keyword.COVARIANT, 166 Keyword.COVARIANT,
175 Keyword.DEFERRED, 167 Keyword.DEFERRED,
176 Keyword.DYNAMIC, 168 Keyword.DYNAMIC,
177 Keyword.EXPORT, 169 Keyword.EXPORT,
178 Keyword.EXTERNAL, 170 Keyword.EXTERNAL,
179 Keyword.FACTORY, 171 Keyword.FACTORY,
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
226 // General tokens 218 // General tokens
227 token = token.next; 219 token = token.next;
228 expect(token.lexeme, '&'); 220 expect(token.lexeme, '&');
229 expect(token.value(), '&'); 221 expect(token.value(), '&');
230 // String tokens 222 // String tokens
231 token = token.next; 223 token = token.next;
232 expect(token.lexeme, '"home"'); 224 expect(token.lexeme, '"home"');
233 expect(token.value(), '"home"'); 225 expect(token.value(), '"home"');
234 } 226 }
235 } 227 }
OLDNEW
« no previous file with comments | « pkg/front_end/lib/src/scanner/token.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698