| 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 307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 318 token = parseFormalParameters(token); | 318 token = parseFormalParameters(token); |
| 319 listener.handleFunctionTypedFormalParameter(token); | 319 listener.handleFunctionTypedFormalParameter(token); |
| 320 } | 320 } |
| 321 String value = token.stringValue; | 321 String value = token.stringValue; |
| 322 if ((identical('=', value)) || (identical(':', value))) { | 322 if ((identical('=', value)) || (identical(':', value))) { |
| 323 // TODO(ahe): Validate that these are only used for optional parameters. | 323 // TODO(ahe): Validate that these are only used for optional parameters. |
| 324 Token equal = token; | 324 Token equal = token; |
| 325 token = parseExpression(token.next); | 325 token = parseExpression(token.next); |
| 326 listener.handleValuedFormalParameter(equal, token); | 326 listener.handleValuedFormalParameter(equal, token); |
| 327 } | 327 } |
| 328 listener.endFormalParameter(token, thisKeyword); | 328 listener.endFormalParameter(thisKeyword); |
| 329 return token; | 329 return token; |
| 330 } | 330 } |
| 331 | 331 |
| 332 Token parseOptionalFormalParameters(Token token, bool isNamed) { | 332 Token parseOptionalFormalParameters(Token token, bool isNamed) { |
| 333 Token begin = token; | 333 Token begin = token; |
| 334 listener.beginOptionalFormalParameters(begin); | 334 listener.beginOptionalFormalParameters(begin); |
| 335 assert((isNamed && optional('{', token)) || optional('[', token)); | 335 assert((isNamed && optional('{', token)) || optional('[', token)); |
| 336 int parameterCount = 0; | 336 int parameterCount = 0; |
| 337 do { | 337 do { |
| 338 token = token.next; | 338 token = token.next; |
| (...skipping 1816 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2155 } | 2155 } |
| 2156 listener.handleContinueStatement(hasTarget, continueKeyword, token); | 2156 listener.handleContinueStatement(hasTarget, continueKeyword, token); |
| 2157 return expectSemicolon(token); | 2157 return expectSemicolon(token); |
| 2158 } | 2158 } |
| 2159 | 2159 |
| 2160 Token parseEmptyStatement(Token token) { | 2160 Token parseEmptyStatement(Token token) { |
| 2161 listener.handleEmptyStatement(token); | 2161 listener.handleEmptyStatement(token); |
| 2162 return expectSemicolon(token); | 2162 return expectSemicolon(token); |
| 2163 } | 2163 } |
| 2164 } | 2164 } |
| OLD | NEW |