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