| 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 876 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 887 Token expect(String string, Token token) { | 887 Token expect(String string, Token token) { |
| 888 if (!identical(string, token.stringValue)) { | 888 if (!identical(string, token.stringValue)) { |
| 889 return reportUnrecoverableError( | 889 return reportUnrecoverableError( |
| 890 token, ErrorKind.ExpectedButGot, {"expected": string}); | 890 token, ErrorKind.ExpectedButGot, {"expected": string}); |
| 891 } | 891 } |
| 892 return token.next; | 892 return token.next; |
| 893 } | 893 } |
| 894 | 894 |
| 895 Token parseTypeVariable(Token token) { | 895 Token parseTypeVariable(Token token) { |
| 896 listener.beginTypeVariable(token); | 896 listener.beginTypeVariable(token); |
| 897 token = parseMetadataStar(token); |
| 897 token = parseIdentifier(token, IdentifierContext.typeVariableDeclaration); | 898 token = parseIdentifier(token, IdentifierContext.typeVariableDeclaration); |
| 898 Token extendsOrSuper = null; | 899 Token extendsOrSuper = null; |
| 899 if (optional('extends', token) || optional('super', token)) { | 900 if (optional('extends', token) || optional('super', token)) { |
| 900 extendsOrSuper = token; | 901 extendsOrSuper = token; |
| 901 token = parseType(token.next); | 902 token = parseType(token.next); |
| 902 } else { | 903 } else { |
| 903 listener.handleNoType(token); | 904 listener.handleNoType(token); |
| 904 } | 905 } |
| 905 listener.endTypeVariable(token, extendsOrSuper); | 906 listener.endTypeVariable(token, extendsOrSuper); |
| 906 return token; | 907 return token; |
| (...skipping 2666 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3573 break; | 3574 break; |
| 3574 } | 3575 } |
| 3575 if (isRecoverable) { | 3576 if (isRecoverable) { |
| 3576 listener.handleRecoverableError(token, kind, arguments); | 3577 listener.handleRecoverableError(token, kind, arguments); |
| 3577 return null; | 3578 return null; |
| 3578 } else { | 3579 } else { |
| 3579 return listener.handleUnrecoverableError(token, kind, arguments); | 3580 return listener.handleUnrecoverableError(token, kind, arguments); |
| 3580 } | 3581 } |
| 3581 } | 3582 } |
| 3582 } | 3583 } |
| OLD | NEW |