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

Unified Diff: frog/utils.dart

Issue 9121025: cleanup to Value - fix for StringEscapesTest (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 side-by-side diff with in-line comments
Download patch
Index: frog/utils.dart
diff --git a/frog/utils.dart b/frog/utils.dart
index 821c88313b7e657b6d905f78d6a884c5daee2c4d..d5cdbcaa8f07823e11e4e48b806c891e7c933c11 100644
--- a/frog/utils.dart
+++ b/frog/utils.dart
@@ -61,56 +61,6 @@ List orderValuesByKeys(Map map) {
return values;
}
-/** True if this is a triple quoted Dart string literal. */
-bool isMultilineString(String text) {
- return text.startsWith('"""') || text.startsWith("'''");
-}
-
-bool isRawMultilineString(String text) {
- return text.startsWith('@"""') || text.startsWith("@'''");
-}
-
-/**
- * Convert a single-quote string to be a double-quote string by replacing " with
- * \" and \' with '.
- */
-String toDoubleQuote(String s) {
- return s.replaceAll('"', '\\"').replaceAll("\\'", "'");
-}
-
-
-// TODO(jmesserly): it'd be nice to deal with this in the tokenizer, rather than
Jennifer Messerly 2012/01/09 20:16:26 yay, another todo--
-// taking another pass over the string.
-String parseStringLiteral(String lit) {
- if (lit.startsWith('@')) {
- if (isRawMultilineString(lit)) {
- return stripLeadingNewline(lit.substring(4, lit.length - 3));
- } else {
- return lit.substring(2, lit.length - 1);
- }
- } else if (isMultilineString(lit)) {
- lit = lit.substring(3, lit.length - 3).replaceAll('\\\$', '\$');
- return stripLeadingNewline(lit);
- } else {
- return lit.substring(1, lit.length - 1).replaceAll('\\\$', '\$');
- }
-}
-
-// The first newline in a multiline string is removed.
-String stripLeadingNewline(String text) {
- if (text.startsWith('\n')) {
- return text.substring(1);
- } else if (text.startsWith('\r')) {
- if (text.startsWith('\r\n')) {
- return text.substring(2);
- } else {
- return text.substring(1);
- }
- } else {
- return text;
- }
-}
-
/**
* A [FixedCollection] is a collection of [length] items all of which have the
* identical [value]

Powered by Google App Engine
This is Rietveld 408576698