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

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

Issue 9689045: Library privacy. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 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 | Annotate | Revision Log
« no previous file with comments | « dart/frog/leg/scanner/string_scanner.dart ('k') | dart/frog/leg/ssa/builder.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 final int EOF_TOKEN = 0; 5 final int EOF_TOKEN = 0;
6 6
7 final int KEYWORD_TOKEN = $k; 7 final int KEYWORD_TOKEN = $k;
8 final int IDENTIFIER_TOKEN = $a; 8 final int IDENTIFIER_TOKEN = $a;
9 final int DOUBLE_TOKEN = $d; 9 final int DOUBLE_TOKEN = $d;
10 final int INT_TOKEN = $i; 10 final int INT_TOKEN = $i;
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 * [terminal] last characters. This is only intended to be used to remove 135 * [terminal] last characters. This is only intended to be used to remove
136 * quotes from string literals (including an initial '@' for raw strings). 136 * quotes from string literals (including an initial '@' for raw strings).
137 */ 137 */
138 SourceString copyWithoutQuotes(int initial, int terminal); 138 SourceString copyWithoutQuotes(int initial, int terminal);
139 139
140 String get stringValue(); 140 String get stringValue();
141 141
142 String slowToString(); 142 String slowToString();
143 143
144 bool isEmpty(); 144 bool isEmpty();
145
146 bool isPrivate();
145 } 147 }
146 148
147 class StringWrapper implements SourceString { 149 class StringWrapper implements SourceString {
148 final String stringValue; 150 final String stringValue;
149 151
150 const StringWrapper(String this.stringValue); 152 const StringWrapper(String this.stringValue);
151 153
152 int hashCode() => stringValue.hashCode(); 154 int hashCode() => stringValue.hashCode();
153 155
154 bool operator ==(other) { 156 bool operator ==(other) {
(...skipping 12 matching lines...) Expand all
167 169
168 SourceString copyWithoutQuotes(int initial, int terminal) { 170 SourceString copyWithoutQuotes(int initial, int terminal) {
169 assert(0 <= initial); 171 assert(0 <= initial);
170 assert(0 <= terminal); 172 assert(0 <= terminal);
171 assert(initial + terminal <= stringValue.length); 173 assert(initial + terminal <= stringValue.length);
172 return new StringWrapper( 174 return new StringWrapper(
173 stringValue.substring(initial, stringValue.length - terminal)); 175 stringValue.substring(initial, stringValue.length - terminal));
174 } 176 }
175 177
176 bool isEmpty() => stringValue.isEmpty(); 178 bool isEmpty() => stringValue.isEmpty();
179
180 bool isPrivate() => !isEmpty() && stringValue.charCodeAt(0) === $_;
177 } 181 }
178 182
179 class StringCodeIterator implements Iterator<int> { 183 class StringCodeIterator implements Iterator<int> {
180 final String string; 184 final String string;
181 int index; 185 int index;
182 final int end; 186 final int end;
183 187
184 StringCodeIterator(String string) : 188 StringCodeIterator(String string) :
185 this.string = string, index = 0, end = string.length; 189 this.string = string, index = 0, end = string.length;
186 190
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after
426 final PrecedenceInfo STRING_INTERPOLATION_INFO = 430 final PrecedenceInfo STRING_INTERPOLATION_INFO =
427 const PrecedenceInfo(const SourceString('\${'), 0, 431 const PrecedenceInfo(const SourceString('\${'), 0,
428 STRING_INTERPOLATION_TOKEN); 432 STRING_INTERPOLATION_TOKEN);
429 433
430 final PrecedenceInfo HEXADECIMAL_INFO = 434 final PrecedenceInfo HEXADECIMAL_INFO =
431 const PrecedenceInfo(const SourceString('hexadecimal'), 0, HEXADECIMAL_TOKEN); 435 const PrecedenceInfo(const SourceString('hexadecimal'), 0, HEXADECIMAL_TOKEN);
432 436
433 // For reporting lexical errors. 437 // For reporting lexical errors.
434 final PrecedenceInfo ERROR_INFO = 438 final PrecedenceInfo ERROR_INFO =
435 const PrecedenceInfo(const SourceString('?'), 0, UNKNOWN_TOKEN); 439 const PrecedenceInfo(const SourceString('?'), 0, UNKNOWN_TOKEN);
OLDNEW
« no previous file with comments | « dart/frog/leg/scanner/string_scanner.dart ('k') | dart/frog/leg/ssa/builder.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698