| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 fasta.parser.parser; | 5 library fasta.parser.parser; |
| 6 | 6 |
| 7 import '../scanner.dart' show ErrorToken; | 7 import '../scanner.dart' show ErrorToken; |
| 8 | 8 |
| 9 import '../scanner/recover.dart' show closeBraceFor, skipToEof; | 9 import '../scanner/recover.dart' show closeBraceFor, skipToEof; |
| 10 | 10 |
| (...skipping 3469 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3480 ++catchCount; | 3480 ++catchCount; |
| 3481 listener.handleCatchBlock(onKeyword, catchKeyword); | 3481 listener.handleCatchBlock(onKeyword, catchKeyword); |
| 3482 value = token.stringValue; // while condition | 3482 value = token.stringValue; // while condition |
| 3483 } | 3483 } |
| 3484 | 3484 |
| 3485 Token finallyKeyword = null; | 3485 Token finallyKeyword = null; |
| 3486 if (optional('finally', token)) { | 3486 if (optional('finally', token)) { |
| 3487 finallyKeyword = token; | 3487 finallyKeyword = token; |
| 3488 token = parseBlock(token.next); | 3488 token = parseBlock(token.next); |
| 3489 listener.handleFinallyBlock(finallyKeyword); | 3489 listener.handleFinallyBlock(finallyKeyword); |
| 3490 } else { |
| 3491 if (catchCount == 0) { |
| 3492 reportRecoverableError(tryKeyword, ErrorKind.OnlyTry); |
| 3493 } |
| 3490 } | 3494 } |
| 3491 listener.endTryStatement(catchCount, tryKeyword, finallyKeyword); | 3495 listener.endTryStatement(catchCount, tryKeyword, finallyKeyword); |
| 3492 return token; | 3496 return token; |
| 3493 } | 3497 } |
| 3494 | 3498 |
| 3495 Token parseSwitchStatement(Token token) { | 3499 Token parseSwitchStatement(Token token) { |
| 3496 assert(optional('switch', token)); | 3500 assert(optional('switch', token)); |
| 3497 Token switchKeyword = token; | 3501 Token switchKeyword = token; |
| 3498 listener.beginSwitchStatement(switchKeyword); | 3502 listener.beginSwitchStatement(switchKeyword); |
| 3499 token = parseParenthesizedExpression(token.next); | 3503 token = parseParenthesizedExpression(token.next); |
| (...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3701 break; | 3705 break; |
| 3702 } | 3706 } |
| 3703 if (isRecoverable) { | 3707 if (isRecoverable) { |
| 3704 listener.handleRecoverableError(token, kind, arguments); | 3708 listener.handleRecoverableError(token, kind, arguments); |
| 3705 return null; | 3709 return null; |
| 3706 } else { | 3710 } else { |
| 3707 return listener.handleUnrecoverableError(token, kind, arguments); | 3711 return listener.handleUnrecoverableError(token, kind, arguments); |
| 3708 } | 3712 } |
| 3709 } | 3713 } |
| 3710 } | 3714 } |
| OLD | NEW |