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.listener; | 5 library fasta.parser.listener; |
6 | 6 |
7 import '../fasta_codes.dart' show Message; | 7 import '../fasta_codes.dart' show Message; |
8 | 8 |
9 import '../../scanner/token.dart' show BeginToken, Token, TokenType; | 9 import '../../scanner/token.dart' show BeginToken, Token, TokenType; |
10 | 10 |
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
268 /// - Name | 268 /// - Name |
269 /// - Type variables | 269 /// - Type variables |
270 /// - Formals | 270 /// - Formals |
271 /// - Initializers | 271 /// - Initializers |
272 /// - Async modifier | 272 /// - Async modifier |
273 /// - Function body (block or arrow expression). | 273 /// - Function body (block or arrow expression). |
274 void endNamedFunctionExpression(Token endToken) { | 274 void endNamedFunctionExpression(Token endToken) { |
275 logEvent("NamedFunctionExpression"); | 275 logEvent("NamedFunctionExpression"); |
276 } | 276 } |
277 | 277 |
278 void beginFunctionDeclaration(Token token) {} | 278 /// Handle the beginning of a local function declaration. |
| 279 void beginLocalFunctionDeclaration(Token token) {} |
279 | 280 |
280 /// A function declaration. | 281 /// A function declaration. |
281 /// | 282 /// |
282 /// Substructures: | 283 /// Substructures: |
283 /// - Modifiers | 284 /// - Modifiers |
284 /// - Return type | 285 /// - Return type |
285 /// - Name | 286 /// - Name |
286 /// - Type variables | 287 /// - Type variables |
287 /// - Formals | 288 /// - Formals |
288 /// - Initializers | 289 /// - Initializers |
289 /// - Async modifier | 290 /// - Async modifier |
290 /// - Function body (block or arrow expression). | 291 /// - Function body (block or arrow expression). |
291 void endFunctionDeclaration(Token endToken) { | 292 void endLocalFunctionDeclaration(Token endToken) { |
292 logEvent("FunctionDeclaration"); | 293 logEvent("FunctionDeclaration"); |
293 } | 294 } |
294 | 295 |
295 /// This method is invoked when the parser sees that a function has a | 296 /// This method is invoked when the parser sees that a function has a |
296 /// block function body. This method is not invoked for empty or expression | 297 /// block function body. This method is not invoked for empty or expression |
297 /// function bodies, see the corresponding methods [handleEmptyFunctionBody] | 298 /// function bodies, see the corresponding methods [handleEmptyFunctionBody] |
298 /// and [handleExpressionFunctionBody]. | 299 /// and [handleExpressionFunctionBody]. |
299 void beginBlockFunctionBody(Token token) {} | 300 void beginBlockFunctionBody(Token token) {} |
300 | 301 |
301 /// This method is invoked by the parser after it finished parsing a block | 302 /// This method is invoked by the parser after it finished parsing a block |
(...skipping 23 matching lines...) Expand all Loading... |
325 } | 326 } |
326 | 327 |
327 void beginFunctionTypeAlias(Token token) {} | 328 void beginFunctionTypeAlias(Token token) {} |
328 | 329 |
329 /// Handle the end of a typedef declaration. | 330 /// Handle the end of a typedef declaration. |
330 /// | 331 /// |
331 /// If [equals] is null, then we have the following substructures: | 332 /// If [equals] is null, then we have the following substructures: |
332 /// - Metadata | 333 /// - Metadata |
333 /// - Return type | 334 /// - Return type |
334 /// - Name (identifier) | 335 /// - Name (identifier) |
335 /// - Template variables (type variables to the template) | 336 /// - Alias type variables |
336 /// - Formal parameters | 337 /// - Formal parameters |
337 /// | 338 /// |
338 /// If [equals] is not null, then the have the following substructures: | 339 /// If [equals] is not null, then the have the following substructures: |
339 /// - Metadata | 340 /// - Metadata |
340 /// - Name (identifier) | 341 /// - Name (identifier) |
341 /// - Template variables (type variables to the template) | 342 /// - Alias type variables |
342 /// - Type (FunctionTypeAnnotation) | 343 /// - Type (FunctionTypeAnnotation) |
343 void endFunctionTypeAlias( | 344 void endFunctionTypeAlias( |
344 Token typedefKeyword, Token equals, Token endToken) { | 345 Token typedefKeyword, Token equals, Token endToken) { |
345 logEvent("FunctionTypeAlias"); | 346 logEvent("FunctionTypeAlias"); |
346 } | 347 } |
347 | 348 |
348 void beginMixinApplication(Token token) {} | 349 void beginMixinApplication(Token token) {} |
349 | 350 |
350 /// Handle the end of a mixin application construct (e.g. "A with B, C"). | 351 /// Handle the end of a mixin application construct (e.g. "A with B, C"). |
351 /// Substructures: | 352 /// Substructures: |
(...skipping 759 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1111 | 1112 |
1112 final Message message; | 1113 final Message message; |
1113 | 1114 |
1114 ParserError(this.beginOffset, this.endOffset, this.message); | 1115 ParserError(this.beginOffset, this.endOffset, this.message); |
1115 | 1116 |
1116 ParserError.fromTokens(Token begin, Token end, Message message) | 1117 ParserError.fromTokens(Token begin, Token end, Message message) |
1117 : this(begin.charOffset, end.charOffset + end.charCount, message); | 1118 : this(begin.charOffset, end.charOffset + end.charCount, message); |
1118 | 1119 |
1119 String toString() => "@${beginOffset}: ${message.message}\n${message.tip}"; | 1120 String toString() => "@${beginOffset}: ${message.message}\n${message.tip}"; |
1120 } | 1121 } |
OLD | NEW |