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

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

Issue 9190038: Handle escapes in string literals. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 11 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 * Scanner that reads from a String and creates tokens that points to 6 * Scanner that reads from a String and creates tokens that points to
7 * substrings. 7 * substrings.
8 */ 8 */
9 class StringScanner extends ArrayBasedScanner<SourceString> { 9 class StringScanner extends ArrayBasedScanner<SourceString> {
10 final String string; 10 final String string;
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 bool operator ==(other) { 46 bool operator ==(other) {
47 return other is SourceString && toString() == other.toString(); 47 return other is SourceString && toString() == other.toString();
48 } 48 }
49 49
50 int get length() => end - begin; 50 int get length() => end - begin;
51 51
52 void printOn(StringBuffer sb) { 52 void printOn(StringBuffer sb) {
53 sb.add(this); 53 sb.add(this);
54 } 54 }
55 55
56 void printSubstringOn(StringBuffer sb, int from, int to) {
57 if (from >= to) return;
58 sb.add(internalString.substring(begin + from, begin + to));
59 }
60
61 int charCodeAt(int index) => internalString.charCodeAt(begin + index);
62
63 String operator[](int index) => internalString[begin + index];
64
56 String toString() => internalString.substring(begin, end); 65 String toString() => internalString.substring(begin, end);
57 66
58 String get stringValue() => toString(); 67 String get stringValue() => toString();
59 } 68 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698