| 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); | |
| 905 token = parseIdentifier(token, IdentifierContext.typeVariableDeclaration); | 904 token = parseIdentifier(token, IdentifierContext.typeVariableDeclaration); |
| 906 Token extendsOrSuper = null; | 905 Token extendsOrSuper = null; |
| 907 if (optional('extends', token) || optional('super', token)) { | 906 if (optional('extends', token) || optional('super', token)) { |
| 908 extendsOrSuper = token; | 907 extendsOrSuper = token; |
| 909 token = parseType(token.next); | 908 token = parseType(token.next); |
| 910 } else { | 909 } else { |
| 911 listener.handleNoType(token); | 910 listener.handleNoType(token); |
| 912 } | 911 } |
| 913 listener.endTypeVariable(token, extendsOrSuper); | 912 listener.endTypeVariable(token, extendsOrSuper); |
| 914 return token; | 913 return token; |
| (...skipping 2683 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3598 break; | 3597 break; |
| 3599 } | 3598 } |
| 3600 if (isRecoverable) { | 3599 if (isRecoverable) { |
| 3601 listener.handleRecoverableError(token, kind, arguments); | 3600 listener.handleRecoverableError(token, kind, arguments); |
| 3602 return null; | 3601 return null; |
| 3603 } else { | 3602 } else { |
| 3604 return listener.handleUnrecoverableError(token, kind, arguments); | 3603 return listener.handleUnrecoverableError(token, kind, arguments); |
| 3605 } | 3604 } |
| 3606 } | 3605 } |
| 3607 } | 3606 } |
| OLD | NEW |