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

Unified Diff: pkg/front_end/lib/src/fasta/scanner/string_scanner.dart

Issue 2915093002: improve fasta unterminated string recovery (Closed)
Patch Set: fix dartdoc Created 3 years, 7 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: pkg/front_end/lib/src/fasta/scanner/string_scanner.dart
diff --git a/pkg/front_end/lib/src/fasta/scanner/string_scanner.dart b/pkg/front_end/lib/src/fasta/scanner/string_scanner.dart
index b7b66d52045225716bdeb50bc54db4eaa54e8c44..2c90b52e08dc999aabe3e684b3656cac90a80a4a 100644
--- a/pkg/front_end/lib/src/fasta/scanner/string_scanner.dart
+++ b/pkg/front_end/lib/src/fasta/scanner/string_scanner.dart
@@ -4,7 +4,9 @@
library dart2js.scanner.string_scanner;
-import '../../scanner/token.dart' show TokenType;
+import '../../scanner/token.dart' show SyntheticStringToken, TokenType;
+
+import '../../scanner/token.dart' as analyzer show StringToken;
import 'array_based_scanner.dart' show ArrayBasedScanner;
@@ -45,7 +47,8 @@ class StringScanner extends ArrayBasedScanner {
void handleUnicode(int startScanOffset) {}
@override
- StringToken createSubstringToken(TokenType type, int start, bool asciiOnly,
+ analyzer.StringToken createSubstringToken(
+ TokenType type, int start, bool asciiOnly,
[int extraOffset = 0]) {
return new StringToken.fromSubstring(
type, string, start, scanOffset + extraOffset, tokenStart,
@@ -53,6 +56,14 @@ class StringScanner extends ArrayBasedScanner {
}
@override
+ analyzer.StringToken createSyntheticSubstringToken(
+ TokenType type, int start, bool asciiOnly, String closingQuotes) {
+ String source = string.substring(start, scanOffset);
+ return new SyntheticStringToken(
+ type, source + closingQuotes, start, source.length);
+ }
+
+ @override
CommentToken createCommentToken(TokenType type, int start, bool asciiOnly,
[int extraOffset = 0]) {
return new CommentToken.fromSubstring(

Powered by Google App Engine
This is Rietveld 408576698