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

Side by Side Diff: sdk/lib/_internal/compiler/implementation/string_validator.dart

Issue 206193002: Remove cancel and make crash exit with code 253. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Updated cf. comments. Created 6 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
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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 // Check the validity of string literals. 5 // Check the validity of string literals.
6 6
7 library stringvalidator; 7 library stringvalidator;
8 8
9 import "dart:collection"; 9 import "dart:collection";
10 10
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 * literals (including an initial 'r' for raw strings). 75 * literals (including an initial 'r' for raw strings).
76 */ 76 */
77 String copyWithoutQuotes(String string, int initial, int terminal) { 77 String copyWithoutQuotes(String string, int initial, int terminal) {
78 assert(0 <= initial); 78 assert(0 <= initial);
79 assert(0 <= terminal); 79 assert(0 <= terminal);
80 assert(initial + terminal <= string.length); 80 assert(initial + terminal <= string.length);
81 return string.substring(initial, string.length - terminal); 81 return string.substring(initial, string.length - terminal);
82 } 82 }
83 83
84 void stringParseError(String message, Token token, int offset) { 84 void stringParseError(String message, Token token, int offset) {
85 listener.cancel("$message @ $offset", token : token); 85 listener.reportFatalError(
86 token, MessageKind.GENERIC, {'text': "$message @ $offset"});
86 } 87 }
87 88
88 /** 89 /**
89 * Validates the escape sequences and special characters of a string literal. 90 * Validates the escape sequences and special characters of a string literal.
90 * Returns a DartString if valid, and null if not. 91 * Returns a DartString if valid, and null if not.
91 */ 92 */
92 DartString validateString(Token token, 93 DartString validateString(Token token,
93 int startOffset, 94 int startOffset,
94 String string, 95 String string,
95 StringQuoting quoting) { 96 StringQuoting quoting) {
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
205 return null; 206 return null;
206 } 207 }
207 // String literal successfully validated. 208 // String literal successfully validated.
208 if (quoting.raw || !containsEscape) { 209 if (quoting.raw || !containsEscape) {
209 // A string without escapes could just as well have been raw. 210 // A string without escapes could just as well have been raw.
210 return new DartString.rawString(string, length); 211 return new DartString.rawString(string, length);
211 } 212 }
212 return new DartString.escapedString(string, length); 213 return new DartString.escapedString(string, length);
213 } 214 }
214 } 215 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698