| 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 | 7 import '../scanner.dart' show |
| 8 ErrorToken; | 8 ErrorToken; |
| 9 | 9 |
| 10 import '../scanner/recover.dart' show | 10 import '../scanner/recover.dart' show |
| (...skipping 713 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 724 | 724 |
| 725 if (isMixinApplication) { | 725 if (isMixinApplication) { |
| 726 listener.beginNamedMixinApplication(begin, name); | 726 listener.beginNamedMixinApplication(begin, name); |
| 727 } else { | 727 } else { |
| 728 listener.beginClassDeclaration(begin, name); | 728 listener.beginClassDeclaration(begin, name); |
| 729 } | 729 } |
| 730 | 730 |
| 731 token = parseTypeVariablesOpt(token); | 731 token = parseTypeVariablesOpt(token); |
| 732 | 732 |
| 733 if (optional('=', token)) { | 733 if (optional('=', token)) { |
| 734 token = expect('=', token); | 734 Token equals = token; |
| 735 return parseNamedMixinApplication(token, begin, name); | 735 token = token.next; |
| 736 return parseNamedMixinApplication(token, begin, name, equals); |
| 736 } else { | 737 } else { |
| 737 return parseClass(token, begin, name); | 738 return parseClass(token, begin, name); |
| 738 } | 739 } |
| 739 } | 740 } |
| 740 | 741 |
| 741 Token parseNamedMixinApplication(Token token, Token begin, Token name) { | 742 Token parseNamedMixinApplication(Token token, Token begin, Token name, |
| 743 Token equals) { |
| 742 token = parseMixinApplication(token); | 744 token = parseMixinApplication(token); |
| 743 Token implementsKeyword = null; | 745 Token implementsKeyword = null; |
| 744 if (optional('implements', token)) { | 746 if (optional('implements', token)) { |
| 745 implementsKeyword = token; | 747 implementsKeyword = token; |
| 746 token = parseTypeList(token.next); | 748 token = parseTypeList(token.next); |
| 747 } | 749 } |
| 748 listener.endNamedMixinApplication(begin, implementsKeyword, token); | 750 listener.endNamedMixinApplication(begin, equals, implementsKeyword, token); |
| 749 return expect(';', token); | 751 return expect(';', token); |
| 750 } | 752 } |
| 751 | 753 |
| 752 Token parseClass(Token token, Token begin, Token name) { | 754 Token parseClass(Token token, Token begin, Token name) { |
| 753 Token extendsKeyword; | 755 Token extendsKeyword; |
| 754 if (optional('extends', token)) { | 756 if (optional('extends', token)) { |
| 755 extendsKeyword = token; | 757 extendsKeyword = token; |
| 756 if (optional('with', peekAfterType(token.next))) { | 758 if (optional('with', peekAfterType(token.next))) { |
| 757 token = parseMixinApplication(token.next); | 759 token = parseMixinApplication(token.next); |
| 758 } else { | 760 } else { |
| (...skipping 2556 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3315 break; | 3317 break; |
| 3316 } | 3318 } |
| 3317 if (isRecoverable) { | 3319 if (isRecoverable) { |
| 3318 listener.handleRecoverableError(token, kind, arguments); | 3320 listener.handleRecoverableError(token, kind, arguments); |
| 3319 return null; | 3321 return null; |
| 3320 } else { | 3322 } else { |
| 3321 return listener.handleUnrecoverableError(token, kind, arguments); | 3323 return listener.handleUnrecoverableError(token, kind, arguments); |
| 3322 } | 3324 } |
| 3323 } | 3325 } |
| 3324 } | 3326 } |
| OLD | NEW |