| 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 '../fasta_codes.dart' show Code, Message, Template; | 7 import '../fasta_codes.dart' show Code, Message, Template; |
| 8 | 8 |
| 9 import '../fasta_codes.dart' as fasta; | 9 import '../fasta_codes.dart' as fasta; |
| 10 | 10 |
| (...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 263 token = _parseTopLevelDeclaration(token); | 263 token = _parseTopLevelDeclaration(token); |
| 264 listener.endTopLevelDeclaration(token); | 264 listener.endTopLevelDeclaration(token); |
| 265 return token; | 265 return token; |
| 266 } | 266 } |
| 267 | 267 |
| 268 Token _parseTopLevelDeclaration(Token token) { | 268 Token _parseTopLevelDeclaration(Token token) { |
| 269 if (identical(token.type, TokenType.SCRIPT_TAG)) { | 269 if (identical(token.type, TokenType.SCRIPT_TAG)) { |
| 270 return parseScript(token); | 270 return parseScript(token); |
| 271 } | 271 } |
| 272 token = parseMetadataStar(token); | 272 token = parseMetadataStar(token); |
| 273 final String value = token.stringValue; | 273 String value = token.stringValue; |
| 274 if ((identical(value, 'abstract') && optional('class', token.next)) || | 274 if (identical(value, 'abstract')) { |
| 275 identical(value, 'class')) { | 275 if (optional('class', token.next)) { |
| 276 return parseClassOrNamedMixinApplication(token); |
| 277 } |
| 278 reportRecoverableErrorWithToken(token, fasta.templateExtraneousModifier); |
| 279 token = token.next; |
| 280 value = token.stringValue; |
| 281 } |
| 282 if (identical(value, 'class')) { |
| 276 return parseClassOrNamedMixinApplication(token); | 283 return parseClassOrNamedMixinApplication(token); |
| 277 } else if (identical(value, 'enum')) { | 284 } else if (identical(value, 'enum')) { |
| 278 return parseEnum(token); | 285 return parseEnum(token); |
| 279 } else if (identical(value, 'typedef') && | 286 } else if (identical(value, 'typedef') && |
| 280 (token.next.isIdentifier || optional("void", token.next))) { | 287 (token.next.isIdentifier || optional("void", token.next))) { |
| 281 return parseTypedef(token); | 288 return parseTypedef(token); |
| 282 } else if (identical(value, 'library')) { | 289 } else if (identical(value, 'library')) { |
| 283 return parseLibraryName(token); | 290 return parseLibraryName(token); |
| 284 } else if (identical(value, 'import')) { | 291 } else if (identical(value, 'import')) { |
| 285 return parseImport(token); | 292 return parseImport(token); |
| (...skipping 3855 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4141 } | 4148 } |
| 4142 | 4149 |
| 4143 Token reportUnexpectedToken(Token token) { | 4150 Token reportUnexpectedToken(Token token) { |
| 4144 return reportUnrecoverableErrorWithToken( | 4151 return reportUnrecoverableErrorWithToken( |
| 4145 token, fasta.templateUnexpectedToken); | 4152 token, fasta.templateUnexpectedToken); |
| 4146 } | 4153 } |
| 4147 } | 4154 } |
| 4148 | 4155 |
| 4149 // TODO(ahe): Remove when analyzer supports generalized function syntax. | 4156 // TODO(ahe): Remove when analyzer supports generalized function syntax. |
| 4150 typedef _MessageWithArgument<T> = Message Function(T); | 4157 typedef _MessageWithArgument<T> = Message Function(T); |
| OLD | NEW |