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

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

Issue 9301037: Made multiline string literals ignore an initial newline. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: 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
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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 55
56 String get stringValue() => toString(); 56 String get stringValue() => toString();
57 57
58 Iterator<int> iterator() => 58 Iterator<int> iterator() =>
59 new StringCodeIterator.substring(internalString, begin, end); 59 new StringCodeIterator.substring(internalString, begin, end);
60 60
61 SourceString copyWithoutQuotes(int initial, int terminal) { 61 SourceString copyWithoutQuotes(int initial, int terminal) {
62 assert(0 <= initial); 62 assert(0 <= initial);
63 assert(0 <= terminal); 63 assert(0 <= terminal);
64 assert(initial + terminal <= internalString.length); 64 assert(initial + terminal <= internalString.length);
65 assert((internalString.substring(begin, begin + initial) ==
66 ["", "'", "@'", "'''", "@'''"][initial]) ||
67 (internalString.substring(begin, begin + initial) ==
68 ['', '"', '@"', '"""', '@"""'][initial]));
69 assert((internalString.substring(end - terminal, end) ==
70 ["", "'", null, "'''"][terminal]) ||
71 (internalString.substring(end - terminal, end) ==
72 ['', '"', null, '"""'][terminal]));
73
74 return new SubstringWrapper(internalString, 65 return new SubstringWrapper(internalString,
75 begin + initial, end - terminal); 66 begin + initial, end - terminal);
76 } 67 }
77 68
78 bool isEmpty() => begin == end; 69 bool isEmpty() => begin == end;
79 } 70 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698