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

Side by Side Diff: lib/compiler/implementation/scanner/keyword.dart

Issue 10310040: Sort the output (for now just the classes and instance members). (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Rebase Created 8 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, 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 /** 5 /**
6 * A keyword in the Dart programming language. 6 * A keyword in the Dart programming language.
7 */ 7 */
8 class Keyword implements SourceString { 8 class Keyword implements SourceString {
9 static final Keyword BREAK = const Keyword("break"); 9 static final Keyword BREAK = const Keyword("break");
10 static final Keyword CASE = const Keyword("case"); 10 static final Keyword CASE = const Keyword("case");
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 117
118 static Map<String, Keyword> computeKeywordMap() { 118 static Map<String, Keyword> computeKeywordMap() {
119 Map<String, Keyword> result = new LinkedHashMap<String, Keyword>(); 119 Map<String, Keyword> result = new LinkedHashMap<String, Keyword>();
120 for (Keyword keyword in values) { 120 for (Keyword keyword in values) {
121 result[keyword.syntax] = keyword; 121 result[keyword.syntax] = keyword;
122 } 122 }
123 return result; 123 return result;
124 } 124 }
125 125
126 int hashCode() => syntax.hashCode(); 126 int hashCode() => syntax.hashCode();
127 int compareTo(SourceString other) => sourceStringCompare(this, other);
127 128
128 bool operator ==(other) { 129 bool operator ==(other) {
129 return other is SourceString && toString() == other.slowToString(); 130 return other is SourceString && toString() == other.slowToString();
130 } 131 }
131 132
132 Iterator<int> iterator() => new StringCodeIterator(syntax); 133 Iterator<int> iterator() => new StringCodeIterator(syntax);
133 134
134 void printOn(StringBuffer sb) { 135 void printOn(StringBuffer sb) {
135 sb.add(syntax); 136 sb.add(syntax);
136 } 137 }
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
251 final Keyword keyword; 252 final Keyword keyword;
252 253
253 LeafKeywordState(String syntax) : keyword = Keyword.keywords[syntax]; 254 LeafKeywordState(String syntax) : keyword = Keyword.keywords[syntax];
254 255
255 bool isLeaf() => true; 256 bool isLeaf() => true;
256 257
257 KeywordState next(int c) => null; 258 KeywordState next(int c) => null;
258 259
259 String toString() => keyword.syntax; 260 String toString() => keyword.syntax;
260 } 261 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698