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

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: merge 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,
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 3073 matching lines...) Expand 10 before | Expand all | Expand 10 after
3578 break; 3582 break;
3579 } 3583 }
3580 if (isRecoverable) { 3584 if (isRecoverable) {
3581 listener.handleRecoverableError(token, kind, arguments); 3585 listener.handleRecoverableError(token, kind, arguments);
3582 return null; 3586 return null;
3583 } else { 3587 } else {
3584 return listener.handleUnrecoverableError(token, kind, arguments)?.next; 3588 return listener.handleUnrecoverableError(token, kind, arguments)?.next;
3585 } 3589 }
3586 } 3590 }
3587 } 3591 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/tree/unparser.dart ('k') | pkg/front_end/lib/src/fasta/scanner/abstract_scanner.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698