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

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

Issue 2984713002: Fix scanning of unterminated strings (Closed)
Patch Set: address comments Created 3 years, 4 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, 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 library dart2js.scanner.string_scanner; 5 library dart2js.scanner.string_scanner;
6 6
7 import '../../scanner/token.dart' show SyntheticStringToken, TokenType; 7 import '../../scanner/token.dart' show SyntheticStringToken, TokenType;
8 8
9 import '../../scanner/token.dart' as analyzer show StringToken; 9 import '../../scanner/token.dart' as analyzer show StringToken;
10 10
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 return new StringToken.fromSubstring( 53 return new StringToken.fromSubstring(
54 type, string, start, scanOffset + extraOffset, tokenStart, 54 type, string, start, scanOffset + extraOffset, tokenStart,
55 canonicalize: true, precedingComments: comments); 55 canonicalize: true, precedingComments: comments);
56 } 56 }
57 57
58 @override 58 @override
59 analyzer.StringToken createSyntheticSubstringToken( 59 analyzer.StringToken createSyntheticSubstringToken(
60 TokenType type, int start, bool asciiOnly, String closingQuotes) { 60 TokenType type, int start, bool asciiOnly, String closingQuotes) {
61 String source = string.substring(start, scanOffset); 61 String source = string.substring(start, scanOffset);
62 return new SyntheticStringToken( 62 return new SyntheticStringToken(
63 type, source + closingQuotes, start, source.length); 63 type, source + closingQuotes, tokenStart, source.length);
64 } 64 }
65 65
66 @override 66 @override
67 CommentToken createCommentToken(TokenType type, int start, bool asciiOnly, 67 CommentToken createCommentToken(TokenType type, int start, bool asciiOnly,
68 [int extraOffset = 0]) { 68 [int extraOffset = 0]) {
69 return new CommentToken.fromSubstring( 69 return new CommentToken.fromSubstring(
70 type, string, start, scanOffset + extraOffset, tokenStart, 70 type, string, start, scanOffset + extraOffset, tokenStart,
71 canonicalize: true); 71 canonicalize: true);
72 } 72 }
73 73
(...skipping 17 matching lines...) Expand all
91 91
92 SubStringScanner(this.baseOffset, String string, 92 SubStringScanner(this.baseOffset, String string,
93 {bool includeComments: false}) 93 {bool includeComments: false})
94 : super(string, includeComments: includeComments); 94 : super(string, includeComments: includeComments);
95 95
96 @override 96 @override
97 void beginToken() { 97 void beginToken() {
98 tokenStart = baseOffset + stringOffset; 98 tokenStart = baseOffset + stringOffset;
99 } 99 }
100 } 100 }
OLDNEW
« no previous file with comments | « pkg/front_end/lib/src/fasta/scanner/abstract_scanner.dart ('k') | pkg/front_end/lib/src/fasta/scanner/utf8_bytes_scanner.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698