| Index: pkg/analyzer/lib/src/generated/parser.dart
|
| diff --git a/pkg/analyzer/lib/src/generated/parser.dart b/pkg/analyzer/lib/src/generated/parser.dart
|
| index de44f48971e65f2b8fc457763da74fdd3be2dee2..824dc1908dc41ef3e2fc162350f15323836771b5 100644
|
| --- a/pkg/analyzer/lib/src/generated/parser.dart
|
| +++ b/pkg/analyzer/lib/src/generated/parser.dart
|
| @@ -3435,41 +3435,15 @@ class Parser {
|
| * `true` if this is the last token in a string literal.
|
| */
|
| String _computeStringValue(String lexeme, bool isFirst, bool isLast) {
|
| - bool isRaw = false;
|
| - int start = 0;
|
| - if (isFirst) {
|
| - if (StringUtilities.startsWith4(lexeme, 0, 0x72, 0x22, 0x22, 0x22) ||
|
| - StringUtilities.startsWith4(lexeme, 0, 0x72, 0x27, 0x27, 0x27)) {
|
| - isRaw = true;
|
| - start = _trimInitialWhitespace(lexeme, start + 4);
|
| - } else if (StringUtilities.startsWith2(lexeme, 0, 0x72, 0x22) ||
|
| - StringUtilities.startsWith2(lexeme, 0, 0x72, 0x27)) {
|
| - isRaw = true;
|
| - start += 2;
|
| - } else if (StringUtilities.startsWith3(lexeme, 0, 0x22, 0x22, 0x22) ||
|
| - StringUtilities.startsWith3(lexeme, 0, 0x27, 0x27, 0x27)) {
|
| - start = _trimInitialWhitespace(lexeme, start + 3);
|
| - } else if (StringUtilities.startsWithChar(lexeme, 0x22) ||
|
| - StringUtilities.startsWithChar(lexeme, 0x27)) {
|
| - start += 1;
|
| - }
|
| - }
|
| - int end = lexeme.length;
|
| - if (isLast) {
|
| - if (StringUtilities.endsWith3(lexeme, 0x22, 0x22, 0x22) ||
|
| - StringUtilities.endsWith3(lexeme, 0x27, 0x27, 0x27)) {
|
| - end -= 3;
|
| - } else if (StringUtilities.endsWithChar(lexeme, 0x22) ||
|
| - StringUtilities.endsWithChar(lexeme, 0x27)) {
|
| - end -= 1;
|
| - }
|
| - }
|
| + StringLexemeHelper helper = new StringLexemeHelper(lexeme, isFirst, isLast);
|
| + int start = helper.start;
|
| + int end = helper.end;
|
| if (end - start + 1 < 0) {
|
| AnalysisEngine.instance.logger.logError(
|
| "Internal error: computeStringValue($lexeme, $isFirst, $isLast)");
|
| return "";
|
| }
|
| - if (isRaw) {
|
| + if (helper.isRaw) {
|
| return lexeme.substring(start, end);
|
| }
|
| StringBuffer buffer = new StringBuffer();
|
| @@ -3481,46 +3455,6 @@ class Parser {
|
| }
|
|
|
| /**
|
| - * Given the [lexeme] for a multi-line string whose content begins at the
|
| - * given [start] index, return the index of the first character that is
|
| - * included in the value of the string. According to the specification:
|
| - *
|
| - * If the first line of a multiline string consists solely of the whitespace
|
| - * characters defined by the production WHITESPACE 20.1), possibly prefixed
|
| - * by \, then that line is ignored, including the new line at its end.
|
| - */
|
| - int _trimInitialWhitespace(String lexeme, int start) {
|
| - int length = lexeme.length;
|
| - int index = start;
|
| - while (index < length) {
|
| - int currentChar = lexeme.codeUnitAt(index);
|
| - if (currentChar == 0x0D) {
|
| - if (index + 1 < length && lexeme.codeUnitAt(index + 1) == 0x0A) {
|
| - return index + 2;
|
| - }
|
| - return index + 1;
|
| - } else if (currentChar == 0x0A) {
|
| - return index + 1;
|
| - } else if (currentChar == 0x5C) {
|
| - if (index + 1 >= length) {
|
| - return start;
|
| - }
|
| - currentChar = lexeme.codeUnitAt(index + 1);
|
| - if (currentChar != 0x0D &&
|
| - currentChar != 0x0A &&
|
| - currentChar != 0x09 &&
|
| - currentChar != 0x20) {
|
| - return start;
|
| - }
|
| - } else if (currentChar != 0x09 && currentChar != 0x20) {
|
| - return start;
|
| - }
|
| - index++;
|
| - }
|
| - return start;
|
| - }
|
| -
|
| - /**
|
| * Convert the given [method] declaration into the nearest valid top-level
|
| * function declaration (that is, the function declaration that most closely
|
| * captures the components of the given method declaration).
|
|
|