Chromium Code Reviews| 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 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 136 // TODO(ahe): Improve this. | 136 // TODO(ahe): Improve this. |
| 137 return skipToEof(errorTail); | 137 return skipToEof(errorTail); |
| 138 } | 138 } |
| 139 | 139 |
| 140 recoverHexDigit() { | 140 recoverHexDigit() { |
| 141 return synthesizeToken(errorTail.charOffset, "-1", TokenType.INT) | 141 return synthesizeToken(errorTail.charOffset, "-1", TokenType.INT) |
| 142 ..next = errorTail.next; | 142 ..next = errorTail.next; |
| 143 } | 143 } |
| 144 | 144 |
| 145 recoverStringInterpolation() { | 145 recoverStringInterpolation() { |
| 146 // TODO(ahe): Improve this. | 146 return errorTail.next; |
|
ahe
2017/06/02 06:29:51
Wow!
| |
| 147 return skipToEof(errorTail); | |
| 148 } | 147 } |
| 149 | 148 |
| 150 recoverComment() { | 149 recoverComment() { |
| 151 // TODO(ahe): Improve this. | 150 // TODO(ahe): Improve this. |
| 152 return skipToEof(errorTail); | 151 return skipToEof(errorTail); |
| 153 } | 152 } |
| 154 | 153 |
| 155 recoverUnmatched() { | 154 recoverUnmatched() { |
| 156 // TODO(ahe): Try to use top-level keywords (such as `class`, `typedef`, | 155 // TODO(ahe): Try to use top-level keywords (such as `class`, `typedef`, |
| 157 // and `enum`) and identation to recover. | 156 // and `enum`) and identation to recover. |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 240 | 239 |
| 241 String closeBraceFor(String openBrace) { | 240 String closeBraceFor(String openBrace) { |
| 242 return const { | 241 return const { |
| 243 '(': ')', | 242 '(': ')', |
| 244 '[': ']', | 243 '[': ']', |
| 245 '{': '}', | 244 '{': '}', |
| 246 '<': '>', | 245 '<': '>', |
| 247 r'${': '}', | 246 r'${': '}', |
| 248 }[openBrace]; | 247 }[openBrace]; |
| 249 } | 248 } |
| OLD | NEW |