Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1094)

Side by Side Diff: pkg/front_end/lib/src/fasta/parser/listener.dart

Issue 2980043003: more fasta event cleanup and testing (Closed)
Patch Set: Created 3 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 204 matching lines...) Expand 10 before | Expand all | Expand 10 after
215 /// - Metadata 215 /// - Metadata
216 /// - Modifiers 216 /// - Modifiers
217 /// - Type 217 /// - Type
218 /// - Variable declarations (count times) 218 /// - Variable declarations (count times)
219 /// 219 ///
220 /// Doesn't have a corresponding begin event, use [beginMember] instead. 220 /// Doesn't have a corresponding begin event, use [beginMember] instead.
221 void endFields(int count, Token beginToken, Token endToken) { 221 void endFields(int count, Token beginToken, Token endToken) {
222 logEvent("Fields"); 222 logEvent("Fields");
223 } 223 }
224 224
225 /// Marks the start of a for statement which is ended by either
226 /// [endForStatement] or [endForIn].
225 void beginForStatement(Token token) {} 227 void beginForStatement(Token token) {}
226 228
227 void endForStatement(Token forKeyword, Token leftSeparator, 229 void endForStatement(Token forKeyword, Token leftSeparator,
228 int updateExpressionCount, Token endToken) { 230 int updateExpressionCount, Token endToken) {
229 logEvent("ForStatement"); 231 logEvent("ForStatement");
230 } 232 }
231 233
232 void beginForStatementBody(Token token) {} 234 void beginForStatementBody(Token token) {}
233 235
234 void endForStatementBody(Token token) { 236 void endForStatementBody(Token token) {
235 logEvent("ForStatementBody"); 237 logEvent("ForStatementBody");
236 } 238 }
237 239
240 // One of the two possible corresponding end events for [beginForStatement].
238 void endForIn(Token awaitToken, Token forToken, Token leftParenthesis, 241 void endForIn(Token awaitToken, Token forToken, Token leftParenthesis,
239 Token inKeyword, Token rightParenthesis, Token endToken) { 242 Token inKeyword, Token rightParenthesis, Token endToken) {
240 logEvent("ForIn"); 243 logEvent("ForIn");
241 } 244 }
242 245
243 void beginForInExpression(Token token) {} 246 void beginForInExpression(Token token) {}
244 247
245 void endForInExpression(Token token) { 248 void endForInExpression(Token token) {
246 logEvent("ForInExpression"); 249 logEvent("ForInExpression");
247 } 250 }
(...skipping 439 matching lines...) Expand 10 before | Expand all | Expand 10 after
687 } 690 }
688 691
689 /// This event is added for convenience. Normally, one should use 692 /// This event is added for convenience. Normally, one should use
690 /// [endClassDeclaration], [endNamedMixinApplication], [endEnum], 693 /// [endClassDeclaration], [endNamedMixinApplication], [endEnum],
691 /// [endFunctionTypeAlias], [endLibraryName], [endImport], [endExport], 694 /// [endFunctionTypeAlias], [endLibraryName], [endImport], [endExport],
692 /// [endPart], [endPartOf], [endTopLevelFields], or [endTopLevelMethod]. 695 /// [endPart], [endPartOf], [endTopLevelFields], or [endTopLevelMethod].
693 void endTopLevelDeclaration(Token token) { 696 void endTopLevelDeclaration(Token token) {
694 logEvent("TopLevelDeclaration"); 697 logEvent("TopLevelDeclaration");
695 } 698 }
696 699
700 /// Marks the beginning of a top level field or method declaration.
701 /// Doesn't have a corresponding end event.
702 /// See [endTopLevelFields] and [endTopLevelMethod].
697 void beginTopLevelMember(Token token) {} 703 void beginTopLevelMember(Token token) {}
698 704
699 /// Handle the end of a top level variable declaration. Substructures: 705 /// Handle the end of a top level variable declaration. Substructures:
700 /// - Metadata 706 /// - Metadata
701 /// - Modifiers 707 /// - Modifiers
702 /// - Type 708 /// - Type
703 /// - Repeated [count] times: 709 /// - Repeated [count] times:
704 /// - Variable name (identifier) 710 /// - Variable name (identifier)
705 /// - Field initializer 711 /// - Field initializer
706 /// Doesn't have a corresponding begin event, use [beginTopLevelMember] 712 /// Doesn't have a corresponding begin event.
707 /// instead. 713 /// Use [beginTopLevelMember] instead.
708 void endTopLevelFields(int count, Token beginToken, Token endToken) { 714 void endTopLevelFields(int count, Token beginToken, Token endToken) {
709 logEvent("TopLevelFields"); 715 logEvent("TopLevelFields");
710 } 716 }
711 717
712 void beginTopLevelMethod(Token token, Token name) {} 718 void beginTopLevelMethod(Token token, Token name) {}
713 719
714 /// Handle the end of a top level method. Substructures: 720 /// Handle the end of a top level method. Substructures:
715 /// - metadata 721 /// - metadata
716 /// - modifiers 722 /// - modifiers
717 /// - return type 723 /// - return type
(...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after
989 void handleStringPart(Token token) { 995 void handleStringPart(Token token) {
990 logEvent("StringPart"); 996 logEvent("StringPart");
991 } 997 }
992 998
993 void handleSuperExpression(Token token, IdentifierContext context) { 999 void handleSuperExpression(Token token, IdentifierContext context) {
994 logEvent("SuperExpression"); 1000 logEvent("SuperExpression");
995 } 1001 }
996 1002
997 void beginSwitchCase(int labelCount, int expressionCount, Token firstToken) {} 1003 void beginSwitchCase(int labelCount, int expressionCount, Token firstToken) {}
998 1004
999 void handleSwitchCase( 1005 void endSwitchCase(int labelCount, int expressionCount, Token defaultKeyword,
1000 int labelCount, 1006 int statementCount, Token firstToken, Token endToken) {
1001 int expressionCount,
1002 Token defaultKeyword,
1003 int statementCount,
1004 Token firstToken,
1005 Token endToken) {
1006 logEvent("SwitchCase"); 1007 logEvent("SwitchCase");
1007 } 1008 }
1008 1009
1009 void handleThisExpression(Token token, IdentifierContext context) { 1010 void handleThisExpression(Token token, IdentifierContext context) {
1010 logEvent("ThisExpression"); 1011 logEvent("ThisExpression");
1011 } 1012 }
1012 1013
1013 void handleUnaryPostfixAssignmentExpression(Token token) { 1014 void handleUnaryPostfixAssignmentExpression(Token token) {
1014 logEvent("UnaryPostfixAssignmentExpression"); 1015 logEvent("UnaryPostfixAssignmentExpression");
1015 } 1016 }
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
1110 1111
1111 final Message message; 1112 final Message message;
1112 1113
1113 ParserError(this.beginOffset, this.endOffset, this.message); 1114 ParserError(this.beginOffset, this.endOffset, this.message);
1114 1115
1115 ParserError.fromTokens(Token begin, Token end, Message message) 1116 ParserError.fromTokens(Token begin, Token end, Message message)
1116 : this(begin.charOffset, end.charOffset + end.charCount, message); 1117 : this(begin.charOffset, end.charOffset + end.charCount, message);
1117 1118
1118 String toString() => "@${beginOffset}: ${message.message}\n${message.tip}"; 1119 String toString() => "@${beginOffset}: ${message.message}\n${message.tip}";
1119 } 1120 }
OLDNEW
« no previous file with comments | « pkg/front_end/lib/src/fasta/kernel/body_builder.dart ('k') | pkg/front_end/lib/src/fasta/parser/parser.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698