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

Side by Side Diff: pkg/compiler/lib/src/parser/partial_parser.dart

Issue 1311783012: Split parser/listener.dart, parser/class_element_listener.dart and tokens/token.dart into smaller l… (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 5 years, 3 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) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, 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 dart2js.parser.partial; 5 library dart2js.parser.partial;
6 6
7 import '../diagnostics/messages.dart' show 7 import '../diagnostics/messages.dart' show
8 MessageKind; 8 MessageKind;
9 import '../util/characters.dart' show 9 import '../util/characters.dart' as Characters show
10 $CLOSE_CURLY_BRACKET; 10 $CLOSE_CURLY_BRACKET;
11 import '../tokens/token.dart' show 11 import '../tokens/token.dart' show
12 BeginGroupToken, 12 BeginGroupToken,
13 EOF_TOKEN,
14 ErrorToken, 13 ErrorToken,
15 Token; 14 Token;
15 import '../tokens/token_constants.dart' as Tokens show
16 EOF_TOKEN;
16 17
17 import 'listener.dart' show 18 import 'listener.dart' show
18 Listener; 19 Listener;
19 import 'parser.dart' show 20 import 'parser.dart' show
20 Parser; 21 Parser;
21 22
22 class PartialParser extends Parser { 23 class PartialParser extends Parser {
23 PartialParser(Listener listener) : super(listener); 24 PartialParser(Listener listener) : super(listener);
24 25
25 Token parseClassBody(Token token) => skipClassBody(token); 26 Token parseClassBody(Token token) => skipClassBody(token);
(...skipping 11 matching lines...) Expand all
37 return begin.endGroup.next; 38 return begin.endGroup.next;
38 } else { 39 } else {
39 return token; 40 return token;
40 } 41 }
41 } 42 }
42 43
43 Token skipExpression(Token token) { 44 Token skipExpression(Token token) {
44 while (true) { 45 while (true) {
45 final kind = token.kind; 46 final kind = token.kind;
46 final value = token.stringValue; 47 final value = token.stringValue;
47 if ((identical(kind, EOF_TOKEN)) || 48 if ((identical(kind, Tokens.EOF_TOKEN)) ||
48 (identical(value, ';')) || 49 (identical(value, ';')) ||
49 (identical(value, ',')) || 50 (identical(value, ',')) ||
50 (identical(value, '}')) || 51 (identical(value, '}')) ||
51 (identical(value, ')')) || 52 (identical(value, ')')) ||
52 (identical(value, ']'))) { 53 (identical(value, ']'))) {
53 break; 54 break;
54 } 55 }
55 if (identical(value, '=') || 56 if (identical(value, '=') ||
56 identical(value, '?') || 57 identical(value, '?') ||
57 identical(value, ':')) { 58 identical(value, ':')) {
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 } 106 }
106 107
107 Token skipClassBody(Token token) { 108 Token skipClassBody(Token token) {
108 if (!optional('{', token)) { 109 if (!optional('{', token)) {
109 return listener.expectedClassBodyToSkip(token); 110 return listener.expectedClassBodyToSkip(token);
110 } 111 }
111 BeginGroupToken beginGroupToken = token; 112 BeginGroupToken beginGroupToken = token;
112 Token endGroup = beginGroupToken.endGroup; 113 Token endGroup = beginGroupToken.endGroup;
113 if (endGroup == null) { 114 if (endGroup == null) {
114 return listener.unmatched(beginGroupToken); 115 return listener.unmatched(beginGroupToken);
115 } else if (!identical(endGroup.kind, $CLOSE_CURLY_BRACKET)) { 116 } else if (!identical(endGroup.kind, Characters.$CLOSE_CURLY_BRACKET)) {
116 return listener.unmatched(beginGroupToken); 117 return listener.unmatched(beginGroupToken);
117 } 118 }
118 return endGroup; 119 return endGroup;
119 } 120 }
120 121
121 Token skipAsyncModifier(Token token) { 122 Token skipAsyncModifier(Token token) {
122 String value = token.stringValue; 123 String value = token.stringValue;
123 if (identical(value, 'async')) { 124 if (identical(value, 'async')) {
124 token = token.next; 125 token = token.next;
125 value = token.stringValue; 126 value = token.stringValue;
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
172 return token; 173 return token;
173 } 174 }
174 return listener.unexpected(token); 175 return listener.unexpected(token);
175 } 176 }
176 BeginGroupToken beginGroupToken = token; 177 BeginGroupToken beginGroupToken = token;
177 Token endToken = beginGroupToken.endGroup; 178 Token endToken = beginGroupToken.endGroup;
178 listener.endFormalParameters(0, token, endToken); 179 listener.endFormalParameters(0, token, endToken);
179 return endToken.next; 180 return endToken.next;
180 } 181 }
181 } 182 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698