OLD | NEW |
1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2017, 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 licenset hat can be found in the LICENSE file. | 3 // BSD-style licenset hat can be found in the LICENSE file. |
4 | 4 |
5 library fasta.scanner.recover; | 5 library fasta.scanner.recover; |
6 | 6 |
7 import '../../scanner/token.dart' show TokenType; | 7 import '../../scanner/token.dart' show TokenType; |
8 | 8 |
9 import '../fasta_codes.dart' | 9 import '../fasta_codes.dart' |
10 show | 10 show |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
126 return synthesizeToken(charOffset, value, TokenType.IDENTIFIER) | 126 return synthesizeToken(charOffset, value, TokenType.IDENTIFIER) |
127 ..next = next; | 127 ..next = next; |
128 } | 128 } |
129 | 129 |
130 recoverExponent() { | 130 recoverExponent() { |
131 return synthesizeToken(errorTail.charOffset, "NaN", TokenType.DOUBLE) | 131 return synthesizeToken(errorTail.charOffset, "NaN", TokenType.DOUBLE) |
132 ..next = errorTail.next; | 132 ..next = errorTail.next; |
133 } | 133 } |
134 | 134 |
135 recoverString() { | 135 recoverString() { |
136 // TODO(ahe): Improve this. | 136 return errorTail.next; |
137 return skipToEof(errorTail); | |
138 } | 137 } |
139 | 138 |
140 recoverHexDigit() { | 139 recoverHexDigit() { |
141 return synthesizeToken(errorTail.charOffset, "-1", TokenType.INT) | 140 return synthesizeToken(errorTail.charOffset, "-1", TokenType.INT) |
142 ..next = errorTail.next; | 141 ..next = errorTail.next; |
143 } | 142 } |
144 | 143 |
145 recoverStringInterpolation() { | 144 recoverStringInterpolation() { |
146 return errorTail.next; | 145 return errorTail.next; |
147 } | 146 } |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
239 | 238 |
240 String closeBraceFor(String openBrace) { | 239 String closeBraceFor(String openBrace) { |
241 return const { | 240 return const { |
242 '(': ')', | 241 '(': ')', |
243 '[': ']', | 242 '[': ']', |
244 '{': '}', | 243 '{': '}', |
245 '<': '>', | 244 '<': '>', |
246 r'${': '}', | 245 r'${': '}', |
247 }[openBrace]; | 246 }[openBrace]; |
248 } | 247 } |
OLD | NEW |