| Index: pkg/front_end/lib/src/fasta/scanner/abstract_scanner.dart
|
| diff --git a/pkg/front_end/lib/src/fasta/scanner/abstract_scanner.dart b/pkg/front_end/lib/src/fasta/scanner/abstract_scanner.dart
|
| index d4a97e0f255a561ece55c8425760c39f873f68e4..2d072322b1b53eff4873c69bbc5c44a99bdf1a36 100644
|
| --- a/pkg/front_end/lib/src/fasta/scanner/abstract_scanner.dart
|
| +++ b/pkg/front_end/lib/src/fasta/scanner/abstract_scanner.dart
|
| @@ -8,7 +8,8 @@ import 'dart:collection' show ListMixin;
|
|
|
| import 'dart:typed_data' show Uint16List, Uint32List;
|
|
|
| -import '../../scanner/token.dart' show BeginToken, Token, TokenType;
|
| +import '../../scanner/token.dart'
|
| + show BeginToken, SyntheticStringToken, Token, TokenType;
|
|
|
| import '../scanner.dart'
|
| show ErrorToken, Keyword, Scanner, buildUnexpectedCharacterToken;
|
| @@ -1024,7 +1025,7 @@ abstract class AbstractScanner implements Scanner {
|
| identical(next, $CR) ||
|
| identical(next, $EOF))) {
|
| if (!asciiOnly) handleUnicode(start);
|
| - return unterminatedString(quoteChar);
|
| + return unterminatedString(quoteChar, start, asciiOnly);
|
| }
|
| if (next > 127) asciiOnly = false;
|
| next = advance();
|
| @@ -1089,14 +1090,14 @@ abstract class AbstractScanner implements Scanner {
|
| return next;
|
| } else if (identical(next, $LF) || identical(next, $CR)) {
|
| if (!asciiOnly) handleUnicode(start);
|
| - return unterminatedRawString(quoteChar);
|
| + return unterminatedRawString(quoteChar, start, asciiOnly);
|
| } else if (next > 127) {
|
| asciiOnly = false;
|
| }
|
| next = advance();
|
| }
|
| if (!asciiOnly) handleUnicode(start);
|
| - return unterminatedRawString(quoteChar);
|
| + return unterminatedRawString(quoteChar, start, asciiOnly);
|
| }
|
|
|
| int tokenizeMultiLineRawString(int quoteChar, int start) {
|
| @@ -1134,7 +1135,7 @@ abstract class AbstractScanner implements Scanner {
|
| }
|
| }
|
| if (!asciiOnlyLine) handleUnicode(unicodeStart);
|
| - return unterminatedRawMultiLineString(quoteChar);
|
| + return unterminatedRawMultiLineString(quoteChar, start, asciiOnlyLine);
|
| }
|
|
|
| int tokenizeMultiLineString(int quoteChar, int start, bool raw) {
|
| @@ -1185,7 +1186,7 @@ abstract class AbstractScanner implements Scanner {
|
| next = advance();
|
| }
|
| if (!asciiOnlyLine) handleUnicode(unicodeStart);
|
| - return unterminatedMultiLineString(quoteChar);
|
| + return unterminatedMultiLineString(quoteChar, start, asciiOnlyString);
|
| }
|
|
|
| int unexpected(int character) {
|
| @@ -1198,22 +1199,40 @@ abstract class AbstractScanner implements Scanner {
|
| return advanceAfterError(shouldAdvance);
|
| }
|
|
|
| - int unterminatedString(int quoteChar) {
|
| - return unterminated(new String.fromCharCodes([quoteChar]));
|
| + void terminateUnterminatedString(
|
| + int start, bool asciiOnlyString, String suffix) {
|
| + if (start < scanOffset) {
|
| + appendSubstringToken(TokenType.STRING, start, asciiOnlyString);
|
| + }
|
| + beginToken();
|
| + appendToken(
|
| + new SyntheticStringToken(TokenType.STRING, suffix, tokenStart, 0));
|
| + }
|
| +
|
| + int unterminatedString(int quoteChar, int start, bool asciiOnlyString) {
|
| + String suffix = new String.fromCharCodes([quoteChar]);
|
| + terminateUnterminatedString(start, asciiOnlyString, suffix);
|
| + return unterminated(suffix);
|
| }
|
|
|
| - int unterminatedRawString(int quoteChar) {
|
| - return unterminated('r${new String.fromCharCodes([quoteChar])}');
|
| + int unterminatedRawString(int quoteChar, int start, bool asciiOnlyString) {
|
| + String suffix = new String.fromCharCodes([quoteChar]);
|
| + terminateUnterminatedString(start, asciiOnlyString, suffix);
|
| + return unterminated('r$suffix');
|
| }
|
|
|
| - int unterminatedMultiLineString(int quoteChar) {
|
| - return unterminated(
|
| - new String.fromCharCodes([quoteChar, quoteChar, quoteChar]));
|
| + int unterminatedMultiLineString(
|
| + int quoteChar, int start, bool asciiOnlyString) {
|
| + String suffix = new String.fromCharCodes([quoteChar, quoteChar, quoteChar]);
|
| + terminateUnterminatedString(start, asciiOnlyString, suffix);
|
| + return unterminated(suffix);
|
| }
|
|
|
| - int unterminatedRawMultiLineString(int quoteChar) {
|
| - return unterminated(
|
| - 'r${new String.fromCharCodes([quoteChar, quoteChar, quoteChar])}');
|
| + int unterminatedRawMultiLineString(
|
| + int quoteChar, int start, bool asciiOnlyString) {
|
| + String suffix = new String.fromCharCodes([quoteChar, quoteChar, quoteChar]);
|
| + terminateUnterminatedString(start, asciiOnlyString, suffix);
|
| + return unterminated('r$suffix');
|
| }
|
|
|
| int advanceAfterError(bool shouldAdvance) {
|
|
|