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 FastaMessage; | 7 import '../fasta_codes.dart' show FastaMessage; |
8 | 8 |
9 import '../../scanner/token.dart' show BeginToken, Token, TokenType; | 9 import '../../scanner/token.dart' show BeginToken, Token, TokenType; |
10 | 10 |
(...skipping 804 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
815 void handleConditionalExpression(Token question, Token colon) { | 815 void handleConditionalExpression(Token question, Token colon) { |
816 logEvent("ConditionalExpression"); | 816 logEvent("ConditionalExpression"); |
817 } | 817 } |
818 | 818 |
819 void beginConstExpression(Token constKeyword) {} | 819 void beginConstExpression(Token constKeyword) {} |
820 | 820 |
821 void endConstExpression(Token token) { | 821 void endConstExpression(Token token) { |
822 logEvent("ConstExpression"); | 822 logEvent("ConstExpression"); |
823 } | 823 } |
824 | 824 |
| 825 /// Handle the start of a function typed formal parameter. Substructures: |
| 826 /// - type variables |
825 void beginFunctionTypedFormalParameter(Token token) {} | 827 void beginFunctionTypedFormalParameter(Token token) {} |
826 | 828 |
827 /// Handle the end of a function typed formal parameter. Substructures: | 829 /// Handle the end of a function typed formal parameter. Substructures: |
828 /// - metadata | 830 /// - type variables |
829 /// - modifiers | |
830 /// - return type | 831 /// - return type |
831 /// - parameter name (simple identifier) | |
832 /// - type parameters | |
833 /// - formal parameters | 832 /// - formal parameters |
834 void endFunctionTypedFormalParameter( | 833 void endFunctionTypedFormalParameter() { |
835 Token thisKeyword, FormalParameterType kind) { | |
836 logEvent("FunctionTypedFormalParameter"); | 834 logEvent("FunctionTypedFormalParameter"); |
837 } | 835 } |
838 | 836 |
839 /// Handle an identifier token. | 837 /// Handle an identifier token. |
840 /// | 838 /// |
841 /// [context] indicates what kind of construct the identifier appears in. | 839 /// [context] indicates what kind of construct the identifier appears in. |
842 void handleIdentifier(Token token, IdentifierContext context) { | 840 void handleIdentifier(Token token, IdentifierContext context) { |
843 logEvent("Identifier"); | 841 logEvent("Identifier"); |
844 } | 842 } |
845 | 843 |
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1047 void handleScript(Token token) { | 1045 void handleScript(Token token) { |
1048 logEvent("Script"); | 1046 logEvent("Script"); |
1049 } | 1047 } |
1050 | 1048 |
1051 /// Matches a generic comment type substitution and injects it into the token | 1049 /// Matches a generic comment type substitution and injects it into the token |
1052 /// stream before the given [token]. | 1050 /// stream before the given [token]. |
1053 Token injectGenericCommentTypeAssign(Token token) { | 1051 Token injectGenericCommentTypeAssign(Token token) { |
1054 return token; | 1052 return token; |
1055 } | 1053 } |
1056 | 1054 |
1057 /// Matches a generic comment type parameters or type arguments and injects | 1055 /// Matches a generic comment type variables or type arguments and injects |
1058 /// them into the token stream before the given [token]. | 1056 /// them into the token stream before the given [token]. |
1059 Token injectGenericCommentTypeList(Token token) { | 1057 Token injectGenericCommentTypeList(Token token) { |
1060 return token; | 1058 return token; |
1061 } | 1059 } |
1062 | 1060 |
1063 /// If the [tokenWithComment] has a type substitution comment /*=T*/, then | 1061 /// If the [tokenWithComment] has a type substitution comment /*=T*/, then |
1064 /// the comment should be scanned into new tokens, and these tokens inserted | 1062 /// the comment should be scanned into new tokens, and these tokens inserted |
1065 /// instead of tokens from the [tokenToStartReplacing] to the | 1063 /// instead of tokens from the [tokenToStartReplacing] to the |
1066 /// [tokenWithComment]. Returns the first newly inserted token, or the | 1064 /// [tokenWithComment]. Returns the first newly inserted token, or the |
1067 /// original [tokenWithComment]. | 1065 /// original [tokenWithComment]. |
(...skipping 25 matching lines...) Expand all Loading... |
1093 | 1091 |
1094 final FastaMessage message; | 1092 final FastaMessage message; |
1095 | 1093 |
1096 ParserError(this.beginOffset, this.endOffset, this.message); | 1094 ParserError(this.beginOffset, this.endOffset, this.message); |
1097 | 1095 |
1098 ParserError.fromTokens(Token begin, Token end, FastaMessage message) | 1096 ParserError.fromTokens(Token begin, Token end, FastaMessage message) |
1099 : this(begin.charOffset, end.charOffset + end.charCount, message); | 1097 : this(begin.charOffset, end.charOffset + end.charCount, message); |
1100 | 1098 |
1101 String toString() => "@${beginOffset}: ${message.message}\n${message.tip}"; | 1099 String toString() => "@${beginOffset}: ${message.message}\n${message.tip}"; |
1102 } | 1100 } |
OLD | NEW |