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

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

Issue 2778213002: Use message.yaml in parser. (Closed)
Patch Set: Update subpackage relationships. Created 3 years, 8 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) 2016, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2016, 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.diet_parser; 5 library fasta.diet_parser;
6 6
7 import '../scanner/token.dart' show BeginGroupToken, Token; 7 import '../fasta_codes.dart' show codeExpectedOpenParens;
8 8
9 import '../parser/class_member_parser.dart' show ClassMemberParser; 9 import '../parser/class_member_parser.dart' show ClassMemberParser;
10 10
11 import '../parser/error_kind.dart' show ErrorKind;
12
13 import '../parser/listener.dart' show Listener; 11 import '../parser/listener.dart' show Listener;
14 12
15 import '../parser/parser.dart' show optional; 13 import '../parser/parser.dart' show optional;
16 14
15 import '../scanner/token.dart' show BeginGroupToken, Token;
16
17 // TODO(ahe): Move this to parser package. 17 // TODO(ahe): Move this to parser package.
18 class DietParser extends ClassMemberParser { 18 class DietParser extends ClassMemberParser {
19 DietParser(Listener listener) : super(listener); 19 DietParser(Listener listener) : super(listener);
20 20
21 Token parseFormalParameters(Token token, {bool inFunctionType: false}) { 21 Token parseFormalParameters(Token token, {bool inFunctionType: false}) {
22 return skipFormals(token); 22 return skipFormals(token);
23 } 23 }
24 24
25 Token skipFormals(Token token) { 25 Token skipFormals(Token token) {
26 listener.beginOptionalFormalParameters(token); 26 listener.beginOptionalFormalParameters(token);
27 if (!optional('(', token)) { 27 if (!optional('(', token)) {
28 if (optional(';', token)) { 28 if (optional(';', token)) {
29 reportRecoverableError(token, ErrorKind.ExpectedOpenParens, {}); 29 reportRecoverableErrorCode(token, codeExpectedOpenParens);
30 return token; 30 return token;
31 } 31 }
32 return reportUnrecoverableError(token, ErrorKind.UnexpectedToken)?.next; 32 return reportUnexpectedToken(token).next;
33 } 33 }
34 BeginGroupToken beginGroupToken = token; 34 BeginGroupToken beginGroupToken = token;
35 Token endToken = beginGroupToken.endGroup; 35 Token endToken = beginGroupToken.endGroup;
36 listener.endFormalParameters(0, token, endToken); 36 listener.endFormalParameters(0, token, endToken);
37 return endToken.next; 37 return endToken.next;
38 } 38 }
39 } 39 }
OLDNEW
« no previous file with comments | « pkg/front_end/lib/src/fasta/source/diet_listener.dart ('k') | pkg/front_end/lib/src/fasta/source/outline_builder.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698