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 part of scanner; | 5 part of scanner; |
6 | 6 |
7 /** | 7 /** |
8 * An event generating parser of Dart programs. This parser expects | 8 * An event generating parser of Dart programs. This parser expects |
9 * all tokens in a linked list (aka a token stream). | 9 * all tokens in a linked list (aka a token stream). |
10 * | 10 * |
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
203 /** | 203 /** |
204 * Parse | 204 * Parse |
205 * [: '@' qualified (‘.’ identifier)? (arguments)? :] | 205 * [: '@' qualified (‘.’ identifier)? (arguments)? :] |
206 */ | 206 */ |
207 Token parseMetadata(Token token) { | 207 Token parseMetadata(Token token) { |
208 listener.beginMetadata(token); | 208 listener.beginMetadata(token); |
209 Token atToken = token; | 209 Token atToken = token; |
210 assert(optional('@', token)); | 210 assert(optional('@', token)); |
211 token = parseIdentifier(token.next); | 211 token = parseIdentifier(token.next); |
212 token = parseQualifiedRestOpt(token); | 212 token = parseQualifiedRestOpt(token); |
213 token = parseQualifiedRestOpt(token); | 213 token = parseTypeArgumentsOpt(token); |
| 214 Token period = null; |
| 215 if (optional('.', token)) { |
| 216 period = token; |
| 217 token = parseIdentifier(token.next); |
| 218 } |
214 token = parseArgumentsOpt(token); | 219 token = parseArgumentsOpt(token); |
215 listener.endMetadata(atToken, token); | 220 listener.endMetadata(atToken, period, token); |
216 return token; | 221 return token; |
217 } | 222 } |
218 | 223 |
219 Token parseInterface(Token token) { | 224 Token parseInterface(Token token) { |
220 Token interfaceKeyword = token; | 225 Token interfaceKeyword = token; |
221 listener.beginInterface(token); | 226 listener.beginInterface(token); |
222 token = parseIdentifier(token.next); | 227 token = parseIdentifier(token.next); |
223 token = parseTypeVariablesOpt(token); | 228 token = parseTypeVariablesOpt(token); |
224 int supertypeCount = 0; | 229 int supertypeCount = 0; |
225 Token extendsKeyword = null; | 230 Token extendsKeyword = null; |
(...skipping 1923 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2149 } | 2154 } |
2150 listener.handleContinueStatement(hasTarget, continueKeyword, token); | 2155 listener.handleContinueStatement(hasTarget, continueKeyword, token); |
2151 return expectSemicolon(token); | 2156 return expectSemicolon(token); |
2152 } | 2157 } |
2153 | 2158 |
2154 Token parseEmptyStatement(Token token) { | 2159 Token parseEmptyStatement(Token token) { |
2155 listener.handleEmptyStatement(token); | 2160 listener.handleEmptyStatement(token); |
2156 return expectSemicolon(token); | 2161 return expectSemicolon(token); |
2157 } | 2162 } |
2158 } | 2163 } |
OLD | NEW |