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 '../scanner/token.dart' show BeginGroupToken, Token; | 7 import '../scanner/token.dart' show BeginGroupToken, Token; |
8 | 8 |
9 import '../util/link.dart' show Link; | 9 import '../util/link.dart' show Link; |
10 | 10 |
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
226 void handleFunctionBodySkipped(Token token) {} | 226 void handleFunctionBodySkipped(Token token) {} |
227 | 227 |
228 void beginFunctionName(Token token) {} | 228 void beginFunctionName(Token token) {} |
229 | 229 |
230 void endFunctionName(Token token) { | 230 void endFunctionName(Token token) { |
231 logEvent("FunctionName"); | 231 logEvent("FunctionName"); |
232 } | 232 } |
233 | 233 |
234 void beginFunctionTypeAlias(Token token) {} | 234 void beginFunctionTypeAlias(Token token) {} |
235 | 235 |
236 /// Handle the end of a typedef declaration. | 236 /// Handle the end of a typedef declaration. Substructures: |
237 /// | |
238 /// If [equals] is null, then we have the following substructures: | |
239 /// - Metadata | 237 /// - Metadata |
240 /// - Return type | 238 /// - Return type |
241 /// - Name (identifier) | 239 /// - Name (identifier) |
242 /// - Template variables (type variables to the template) | 240 /// - Type variables |
243 /// - Formal parameters | 241 /// - Formal parameters |
244 /// | 242 void endFunctionTypeAlias(Token typedefKeyword, Token endToken) { |
245 /// If [equals] is not null, then the have the following substructures: | |
246 /// - Metadata | |
247 /// - Name (identifier) | |
248 /// - Template variables (type variables to the template) | |
249 /// - Type (FunctionTypeAnnotation) | |
250 void endFunctionTypeAlias( | |
251 Token typedefKeyword, Token equals, Token endToken) { | |
252 logEvent("FunctionTypeAlias"); | 243 logEvent("FunctionTypeAlias"); |
253 } | 244 } |
254 | 245 |
255 void beginMixinApplication(Token token) {} | 246 void beginMixinApplication(Token token) {} |
256 | 247 |
257 /// Handle the end of a mixin application construct (e.g. "A with B, C"). | 248 /// Handle the end of a mixin application construct (e.g. "A with B, C"). |
258 /// Substructures: | 249 /// Substructures: |
259 /// - supertype | 250 /// - supertype |
260 /// - mixin types (TypeList) | 251 /// - mixin types (TypeList) |
261 void endMixinApplication() { | 252 void endMixinApplication() { |
262 logEvent("MixinApplication"); | 253 logEvent("MixinApplication"); |
263 } | 254 } |
264 | 255 |
265 void beginNamedMixinApplication(Token beginToken, Token name) {} | 256 void beginNamedMixinApplication(Token beginToken, Token name) {} |
266 | 257 |
267 /// Handle the end of a named mixin declaration. Substructures: | 258 /// Handle the end of a named mixin declaration. Substructures: |
268 /// - metadata | 259 /// - metadata |
269 /// - modifiers | 260 /// - modifiers |
270 /// - class name | 261 /// - class name |
271 /// - type variables | 262 /// - type variables |
272 /// - mixin application | 263 /// - mixin application |
273 /// - implemented types (TypeList) | 264 /// - implemented types (TypeList) |
274 /// | 265 /// |
275 /// TODO(paulberry,ahe): it seems inconsistent that for a named mixin | 266 /// TODO(paulberry,ahe): it seems incosistent that for a named mixin |
276 /// application, the implemented types are a TypeList, whereas for a class | 267 /// application, the implemented types are a TypeList, whereas for a class |
277 /// declaration, each implemented type is listed separately on the stack, and | 268 /// declaration, each implemented type is listed separately on the stack, and |
278 /// the number of implemented types is passed as a parameter. | 269 /// the number of implemented types is passed as a parameter. |
279 void endNamedMixinApplication( | 270 void endNamedMixinApplication( |
280 Token begin, Token classKeyword, Token equals, Token implementsKeyword, | 271 Token begin, Token classKeyword, Token equals, Token implementsKeyword, |
281 Token endToken) { | 272 Token endToken) { |
282 logEvent("NamedMixinApplication"); | 273 logEvent("NamedMixinApplication"); |
283 } | 274 } |
284 | 275 |
285 void beginHide(Token hideKeyword) {} | 276 void beginHide(Token hideKeyword) {} |
(...skipping 350 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
636 } | 627 } |
637 | 628 |
638 void handleFinallyBlock(Token finallyKeyword) { | 629 void handleFinallyBlock(Token finallyKeyword) { |
639 logEvent("FinallyBlock"); | 630 logEvent("FinallyBlock"); |
640 } | 631 } |
641 | 632 |
642 void endTryStatement(int catchCount, Token tryKeyword, Token finallyKeyword) { | 633 void endTryStatement(int catchCount, Token tryKeyword, Token finallyKeyword) { |
643 logEvent("TryStatement"); | 634 logEvent("TryStatement"); |
644 } | 635 } |
645 | 636 |
646 void handleType(Token beginToken, Token endToken) { | 637 void endType(Token beginToken, Token endToken) { |
647 logEvent("Type"); | 638 logEvent("Type"); |
648 } | 639 } |
649 | 640 |
650 void handleNoName(Token token) { | |
651 logEvent("NoName"); | |
652 } | |
653 | |
654 void handleFunctionType(Token functionToken, Token endToken) { | |
655 logEvent("FunctionType"); | |
656 } | |
657 | |
658 void beginTypeArguments(Token token) {} | 641 void beginTypeArguments(Token token) {} |
659 | 642 |
660 void endTypeArguments(int count, Token beginToken, Token endToken) { | 643 void endTypeArguments(int count, Token beginToken, Token endToken) { |
661 logEvent("TypeArguments"); | 644 logEvent("TypeArguments"); |
662 } | 645 } |
663 | 646 |
664 void handleNoTypeArguments(Token token) { | 647 void handleNoTypeArguments(Token token) { |
665 logEvent("NoTypeArguments"); | 648 logEvent("NoTypeArguments"); |
666 } | 649 } |
667 | 650 |
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
931 | 914 |
932 final Map arguments; | 915 final Map arguments; |
933 | 916 |
934 ParserError(this.beginOffset, this.endOffset, this.kind, this.arguments); | 917 ParserError(this.beginOffset, this.endOffset, this.kind, this.arguments); |
935 | 918 |
936 ParserError.fromTokens(Token begin, Token end, ErrorKind kind, Map arguments) | 919 ParserError.fromTokens(Token begin, Token end, ErrorKind kind, Map arguments) |
937 : this(begin.charOffset, end.charOffset + end.charCount, kind, arguments); | 920 : this(begin.charOffset, end.charOffset + end.charCount, kind, arguments); |
938 | 921 |
939 String toString() => "@${beginOffset}: $kind $arguments"; | 922 String toString() => "@${beginOffset}: $kind $arguments"; |
940 } | 923 } |
OLD | NEW |