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

Side by Side Diff: dart/frog/leg/scanner/keyword.dart

Issue 9447100: Return null from stringValue and call slowToString() instead of toString(). (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: changes Created 8 years, 10 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
« no previous file with comments | « dart/frog/leg/scanner/byte_strings.dart ('k') | dart/frog/leg/scanner/listener.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) 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 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 127
128 bool operator ==(other) { 128 bool operator ==(other) {
129 return other is SourceString && toString() == other.toString(); 129 return other is SourceString && toString() == other.slowToString();
130 } 130 }
131 131
132 Iterator<int> iterator() => new StringCodeIterator(syntax); 132 Iterator<int> iterator() => new StringCodeIterator(syntax);
133 133
134 void printOn(StringBuffer sb) { 134 void printOn(StringBuffer sb) {
135 sb.add(syntax); 135 sb.add(syntax);
136 } 136 }
137 137
138 String toString() => syntax; 138 String toString() => syntax;
139 String slowToString() => syntax;
139 String get stringValue() => syntax; 140 String get stringValue() => syntax;
140 141
141 bool isEmtpy() => false; 142 bool isEmtpy() => false;
142 } 143 }
143 144
144 /** 145 /**
145 * Abstract state in a state machine for scanning keywords. 146 * Abstract state in a state machine for scanning keywords.
146 */ 147 */
147 class KeywordState { 148 class KeywordState {
148 abstract bool isLeaf(); 149 abstract bool isLeaf();
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
244 final Keyword keyword; 245 final Keyword keyword;
245 246
246 LeafKeywordState(String syntax) : keyword = Keyword.keywords[syntax]; 247 LeafKeywordState(String syntax) : keyword = Keyword.keywords[syntax];
247 248
248 bool isLeaf() => true; 249 bool isLeaf() => true;
249 250
250 KeywordState next(int c) => null; 251 KeywordState next(int c) => null;
251 252
252 String toString() => keyword.syntax; 253 String toString() => keyword.syntax;
253 } 254 }
OLDNEW
« no previous file with comments | « dart/frog/leg/scanner/byte_strings.dart ('k') | dart/frog/leg/scanner/listener.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698