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

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

Issue 99303004: Remove unused API. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years 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
11 import "dart2jslib.dart"; 11 import "dart2jslib.dart";
12 import "tree/tree.dart"; 12 import "tree/tree.dart";
13 import "util/characters.dart"; 13 import "util/characters.dart";
14 import "scanner/scannerlib.dart" show Token; 14 import "scanner/scannerlib.dart" show Token;
15 15
16 class StringValidator { 16 class StringValidator {
17 final DiagnosticListener listener; 17 final DiagnosticListener listener;
18 18
19 StringValidator(this.listener); 19 StringValidator(this.listener);
20 20
21 DartString validateQuotedString(Token token) {
22 String source = token.value;
23 StringQuoting quoting = quotingFromString(source);
24 int leftQuote = quoting.leftQuoteLength;
25 int rightQuote = quoting.rightQuoteLength;
26 String content = copyWithoutQuotes(source, leftQuote, rightQuote);
27 return validateString(token,
28 token.charOffset + leftQuote,
29 content,
30 quoting);
31 }
32
33 DartString validateInterpolationPart(Token token, StringQuoting quoting, 21 DartString validateInterpolationPart(Token token, StringQuoting quoting,
34 {bool isFirst: false, 22 {bool isFirst: false,
35 bool isLast: false}) { 23 bool isLast: false}) {
36 String source = token.value; 24 String source = token.value;
37 int leftQuote = 0; 25 int leftQuote = 0;
38 int rightQuote = 0; 26 int rightQuote = 0;
39 if (isFirst) leftQuote = quoting.leftQuoteLength; 27 if (isFirst) leftQuote = quoting.leftQuoteLength;
40 if (isLast) rightQuote = quoting.rightQuoteLength; 28 if (isLast) rightQuote = quoting.rightQuoteLength;
41 String content = copyWithoutQuotes(source, leftQuote, rightQuote); 29 String content = copyWithoutQuotes(source, leftQuote, rightQuote);
42 return validateString(token, 30 return validateString(token,
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
217 return null; 205 return null;
218 } 206 }
219 // String literal successfully validated. 207 // String literal successfully validated.
220 if (quoting.raw || !containsEscape) { 208 if (quoting.raw || !containsEscape) {
221 // A string without escapes could just as well have been raw. 209 // A string without escapes could just as well have been raw.
222 return new DartString.rawString(string, length); 210 return new DartString.rawString(string, length);
223 } 211 }
224 return new DartString.escapedString(string, length); 212 return new DartString.escapedString(string, length);
225 } 213 }
226 } 214 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698