| 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 343 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 354 token = parseFormalParameters(token); | 354 token = parseFormalParameters(token); |
| 355 listener.handleFunctionTypedFormalParameter(token); | 355 listener.handleFunctionTypedFormalParameter(token); |
| 356 } | 356 } |
| 357 String value = token.stringValue; | 357 String value = token.stringValue; |
| 358 if ((identical('=', value)) || (identical(':', value))) { | 358 if ((identical('=', value)) || (identical(':', value))) { |
| 359 // TODO(ahe): Validate that these are only used for optional parameters. | 359 // TODO(ahe): Validate that these are only used for optional parameters. |
| 360 Token equal = token; | 360 Token equal = token; |
| 361 token = parseExpression(token.next); | 361 token = parseExpression(token.next); |
| 362 listener.handleValuedFormalParameter(equal, token); | 362 listener.handleValuedFormalParameter(equal, token); |
| 363 } | 363 } |
| 364 listener.endFormalParameter(token, thisKeyword); | 364 listener.endFormalParameter(thisKeyword); |
| 365 return token; | 365 return token; |
| 366 } | 366 } |
| 367 | 367 |
| 368 Token parseOptionalFormalParameters(Token token, bool isNamed) { | 368 Token parseOptionalFormalParameters(Token token, bool isNamed) { |
| 369 Token begin = token; | 369 Token begin = token; |
| 370 listener.beginOptionalFormalParameters(begin); | 370 listener.beginOptionalFormalParameters(begin); |
| 371 assert((isNamed && optional('{', token)) || optional('[', token)); | 371 assert((isNamed && optional('{', token)) || optional('[', token)); |
| 372 int parameterCount = 0; | 372 int parameterCount = 0; |
| 373 do { | 373 do { |
| 374 token = token.next; | 374 token = token.next; |
| (...skipping 1820 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2195 } | 2195 } |
| 2196 listener.handleContinueStatement(hasTarget, continueKeyword, token); | 2196 listener.handleContinueStatement(hasTarget, continueKeyword, token); |
| 2197 return expectSemicolon(token); | 2197 return expectSemicolon(token); |
| 2198 } | 2198 } |
| 2199 | 2199 |
| 2200 Token parseEmptyStatement(Token token) { | 2200 Token parseEmptyStatement(Token token) { |
| 2201 listener.handleEmptyStatement(token); | 2201 listener.handleEmptyStatement(token); |
| 2202 return expectSemicolon(token); | 2202 return expectSemicolon(token); |
| 2203 } | 2203 } |
| 2204 } | 2204 } |
| OLD | NEW |