| 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 883 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 894 Token expect(String string, Token token) { | 894 Token expect(String string, Token token) { |
| 895 if (!identical(string, token.stringValue)) { | 895 if (!identical(string, token.stringValue)) { |
| 896 return reportUnrecoverableError( | 896 return reportUnrecoverableError( |
| 897 token, ErrorKind.ExpectedButGot, {"expected": string})?.next; | 897 token, ErrorKind.ExpectedButGot, {"expected": string})?.next; |
| 898 } | 898 } |
| 899 return token.next; | 899 return token.next; |
| 900 } | 900 } |
| 901 | 901 |
| 902 Token parseTypeVariable(Token token) { | 902 Token parseTypeVariable(Token token) { |
| 903 listener.beginTypeVariable(token); | 903 listener.beginTypeVariable(token); |
| 904 token = parseMetadataStar(token); |
| 904 token = parseIdentifier(token, IdentifierContext.typeVariableDeclaration); | 905 token = parseIdentifier(token, IdentifierContext.typeVariableDeclaration); |
| 905 Token extendsOrSuper = null; | 906 Token extendsOrSuper = null; |
| 906 if (optional('extends', token) || optional('super', token)) { | 907 if (optional('extends', token) || optional('super', token)) { |
| 907 extendsOrSuper = token; | 908 extendsOrSuper = token; |
| 908 token = parseType(token.next); | 909 token = parseType(token.next); |
| 909 } else { | 910 } else { |
| 910 listener.handleNoType(token); | 911 listener.handleNoType(token); |
| 911 } | 912 } |
| 912 listener.endTypeVariable(token, extendsOrSuper); | 913 listener.endTypeVariable(token, extendsOrSuper); |
| 913 return token; | 914 return token; |
| (...skipping 2690 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3604 break; | 3605 break; |
| 3605 } | 3606 } |
| 3606 if (isRecoverable) { | 3607 if (isRecoverable) { |
| 3607 listener.handleRecoverableError(token, kind, arguments); | 3608 listener.handleRecoverableError(token, kind, arguments); |
| 3608 return null; | 3609 return null; |
| 3609 } else { | 3610 } else { |
| 3610 return listener.handleUnrecoverableError(token, kind, arguments); | 3611 return listener.handleUnrecoverableError(token, kind, arguments); |
| 3611 } | 3612 } |
| 3612 } | 3613 } |
| 3613 } | 3614 } |
| OLD | NEW |