Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4)

Side by Side Diff: pkg/front_end/lib/src/fasta/parser/parser.dart

Issue 2744463003: update fasta scanner to always generate INDEX or INDEX_EQ tokens (Closed)
Patch Set: Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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.parser; 5 library fasta.parser.parser;
6 6
7 import '../scanner.dart' show ErrorToken; 7 import '../scanner.dart' show ErrorToken;
8 8
9 import '../scanner/recover.dart' show closeBraceFor, skipToEof; 9 import '../scanner/recover.dart' show closeBraceFor, skipToEof;
10 10
(...skipping 474 matching lines...) Expand 10 before | Expand all | Expand 10 after
485 ++parameterCount; 485 ++parameterCount;
486 String value = token.stringValue; 486 String value = token.stringValue;
487 if (identical(value, '[')) { 487 if (identical(value, '[')) {
488 token = parseOptionalFormalParameters(token, false, 488 token = parseOptionalFormalParameters(token, false,
489 inFunctionType: inFunctionType); 489 inFunctionType: inFunctionType);
490 break; 490 break;
491 } else if (identical(value, '{')) { 491 } else if (identical(value, '{')) {
492 token = parseOptionalFormalParameters(token, true, 492 token = parseOptionalFormalParameters(token, true,
493 inFunctionType: inFunctionType); 493 inFunctionType: inFunctionType);
494 break; 494 break;
495 } else if (identical(value, '[]')) {
496 reportRecoverableError(token,
ahe 2017/03/09 12:45:18 Nice. This should work well with endFormalParamete
497 ErrorKind.EmptyOptionalParameterList);
498 break;
495 } 499 }
496 token = parseFormalParameter(token, FormalParameterType.REQUIRED, 500 token = parseFormalParameter(token, FormalParameterType.REQUIRED,
497 inFunctionType: inFunctionType); 501 inFunctionType: inFunctionType);
498 } while (optional(',', token)); 502 } while (optional(',', token));
499 listener.endFormalParameters(parameterCount, begin, token); 503 listener.endFormalParameters(parameterCount, begin, token);
500 return expect(')', token); 504 return expect(')', token);
501 } 505 }
502 506
503 Token parseFormalParameter(Token token, FormalParameterType kind, 507 Token parseFormalParameter(Token token, FormalParameterType kind,
504 {bool inFunctionType: false}) { 508 {bool inFunctionType: false}) {
(...skipping 3068 matching lines...) Expand 10 before | Expand all | Expand 10 after
3573 break; 3577 break;
3574 } 3578 }
3575 if (isRecoverable) { 3579 if (isRecoverable) {
3576 listener.handleRecoverableError(token, kind, arguments); 3580 listener.handleRecoverableError(token, kind, arguments);
3577 return null; 3581 return null;
3578 } else { 3582 } else {
3579 return listener.handleUnrecoverableError(token, kind, arguments); 3583 return listener.handleUnrecoverableError(token, kind, arguments);
3580 } 3584 }
3581 } 3585 }
3582 } 3586 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698