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

Side by Side Diff: pkg/front_end/lib/src/scanner/scanner.dart

Issue 2842213003: new TokenType and Keyword API (Closed)
Patch Set: rebase Created 3 years, 7 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) 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:charcode/ascii.dart'; 5 import 'package:charcode/ascii.dart';
6 import 'package:front_end/src/scanner/errors.dart'; 6 import 'package:front_end/src/scanner/errors.dart';
7 import 'package:front_end/src/scanner/reader.dart'; 7 import 'package:front_end/src/scanner/reader.dart';
8 import 'package:front_end/src/scanner/string_utilities.dart'; 8 import 'package:front_end/src/scanner/string_utilities.dart';
9 import 'package:front_end/src/scanner/token.dart'; 9 import 'package:front_end/src/scanner/token.dart';
10 10
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 } 100 }
101 } 101 }
102 102
103 /** 103 /**
104 * Create and return the initial state in the state machine. 104 * Create and return the initial state in the state machine.
105 */ 105 */
106 static KeywordState _createKeywordStateTable() { 106 static KeywordState _createKeywordStateTable() {
107 List<Keyword> values = Keyword.values; 107 List<Keyword> values = Keyword.values;
108 List<String> strings = new List<String>(values.length); 108 List<String> strings = new List<String>(values.length);
109 for (int i = 0; i < values.length; i++) { 109 for (int i = 0; i < values.length; i++) {
110 strings[i] = values[i].syntax; 110 strings[i] = values[i].lexeme;
111 } 111 }
112 strings.sort(); 112 strings.sort();
113 return _computeKeywordStateTable(0, strings, 0, strings.length); 113 return _computeKeywordStateTable(0, strings, 0, strings.length);
114 } 114 }
115 } 115 }
116 116
117 /** 117 /**
118 * The class `Scanner` implements a scanner for Dart code. 118 * The class `Scanner` implements a scanner for Dart code.
119 * 119 *
120 * The lexical structure of Dart is ambiguous without knowledge of the context 120 * The lexical structure of Dart is ambiguous without knowledge of the context
(...skipping 1215 matching lines...) Expand 10 before | Expand all | Expand 10 after
1336 } 1336 }
1337 1337
1338 /** 1338 /**
1339 * Checks if [value] is a single-line or multi-line comment. 1339 * Checks if [value] is a single-line or multi-line comment.
1340 */ 1340 */
1341 static bool _isDocumentationComment(String value) { 1341 static bool _isDocumentationComment(String value) {
1342 return StringUtilities.startsWith3(value, 0, $slash, $slash, $slash) || 1342 return StringUtilities.startsWith3(value, 0, $slash, $slash, $slash) ||
1343 StringUtilities.startsWith3(value, 0, $slash, $asterisk, $asterisk); 1343 StringUtilities.startsWith3(value, 0, $slash, $asterisk, $asterisk);
1344 } 1344 }
1345 } 1345 }
OLDNEW
« no previous file with comments | « pkg/front_end/lib/src/fasta/scanner/token.dart ('k') | pkg/front_end/lib/src/scanner/token.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698