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

Side by Side Diff: frog/leg/scanner/token.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: Fix test that didn't expect initial newlines to disappear. 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 | « frog/leg/scanner/string_scanner.dart ('k') | frog/leg/string_validator.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 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
154 void printOn(StringBuffer sb) { 154 void printOn(StringBuffer sb) {
155 sb.add(stringValue); 155 sb.add(stringValue);
156 } 156 }
157 157
158 String toString() => stringValue; 158 String toString() => stringValue;
159 159
160 SourceString copyWithoutQuotes(int initial, int terminal) { 160 SourceString copyWithoutQuotes(int initial, int terminal) {
161 assert(0 <= initial); 161 assert(0 <= initial);
162 assert(0 <= terminal); 162 assert(0 <= terminal);
163 assert(initial + terminal <= stringValue.length); 163 assert(initial + terminal <= stringValue.length);
164 assert(stringValue.startsWith(["", "'", "@'", "'''", "@'''"][initial]) ||
165 stringValue.startsWith(['', '"', '@"', '"""', '@"""'][initial]));
166 assert(stringValue.endsWith(["", "'", null, "'''"][terminal]) ||
167 stringValue.endsWith(['', '"', null, '"""'][terminal]));
168 return new StringWrapper( 164 return new StringWrapper(
169 stringValue.substring(initial, stringValue.length - terminal)); 165 stringValue.substring(initial, stringValue.length - terminal));
170 } 166 }
171 167
172 bool isEmpty() => stringValue.isEmpty(); 168 bool isEmpty() => stringValue.isEmpty();
173 } 169 }
174 170
175 class StringCodeIterator implements Iterator<int> { 171 class StringCodeIterator implements Iterator<int> {
176 final String string; 172 final String string;
177 int index; 173 int index;
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after
397 final PrecedenceInfo STRING_INTERPOLATION_INFO = 393 final PrecedenceInfo STRING_INTERPOLATION_INFO =
398 const PrecedenceInfo(const SourceString('\${'), 0, 394 const PrecedenceInfo(const SourceString('\${'), 0,
399 STRING_INTERPOLATION_TOKEN); 395 STRING_INTERPOLATION_TOKEN);
400 396
401 final PrecedenceInfo HEXADECIMAL_INFO = 397 final PrecedenceInfo HEXADECIMAL_INFO =
402 const PrecedenceInfo(const SourceString('hexadecimal'), 0, HEXADECIMAL_TOKEN); 398 const PrecedenceInfo(const SourceString('hexadecimal'), 0, HEXADECIMAL_TOKEN);
403 399
404 // For reporting lexical errors. 400 // For reporting lexical errors.
405 final PrecedenceInfo ERROR_INFO = 401 final PrecedenceInfo ERROR_INFO =
406 const PrecedenceInfo(const SourceString('?'), 0, UNKNOWN_TOKEN); 402 const PrecedenceInfo(const SourceString('?'), 0, UNKNOWN_TOKEN);
OLDNEW
« no previous file with comments | « frog/leg/scanner/string_scanner.dart ('k') | frog/leg/string_validator.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698