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 library dart2js.parser; | 5 library dart2js.parser; |
6 | 6 |
7 import '../options.dart' show ParserOptions; | 7 import '../options.dart' show ParserOptions; |
8 import '../common.dart'; | 8 import '../common.dart'; |
9 import '../tokens/keyword.dart' show Keyword; | 9 import '../tokens/keyword.dart' show Keyword; |
10 import '../tokens/precedence.dart' show PrecedenceInfo; | 10 import '../tokens/precedence.dart' show PrecedenceInfo; |
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
176 Token semicolon = token; | 176 Token semicolon = token; |
177 token = expect(';', token); | 177 token = expect(';', token); |
178 listener.endImport(importKeyword, deferredKeyword, asKeyword, semicolon); | 178 listener.endImport(importKeyword, deferredKeyword, asKeyword, semicolon); |
179 return token; | 179 return token; |
180 } | 180 } |
181 | 181 |
182 /// if (test) uri | 182 /// if (test) uri |
183 Token parseConditionalUris(Token token) { | 183 Token parseConditionalUris(Token token) { |
184 listener.beginConditionalUris(token); | 184 listener.beginConditionalUris(token); |
185 int count = 0; | 185 int count = 0; |
186 if (parserOptions.enableConditionalDirectives) { | 186 while (optional('if', token)) { |
187 while (optional('if', token)) { | 187 count++; |
188 count++; | 188 token = parseConditionalUri(token); |
189 token = parseConditionalUri(token); | |
190 } | |
191 } | 189 } |
192 listener.endConditionalUris(count); | 190 listener.endConditionalUris(count); |
193 return token; | 191 return token; |
194 } | 192 } |
195 | 193 |
196 Token parseConditionalUri(Token token) { | 194 Token parseConditionalUri(Token token) { |
197 listener.beginConditionalUri(token); | 195 listener.beginConditionalUri(token); |
198 Token ifKeyword = token; | 196 Token ifKeyword = token; |
199 token = expect('if', token); | 197 token = expect('if', token); |
200 token = expect('(', token); | 198 token = expect('(', token); |
(...skipping 2783 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2984 } | 2982 } |
2985 listener.handleContinueStatement(hasTarget, continueKeyword, token); | 2983 listener.handleContinueStatement(hasTarget, continueKeyword, token); |
2986 return expectSemicolon(token); | 2984 return expectSemicolon(token); |
2987 } | 2985 } |
2988 | 2986 |
2989 Token parseEmptyStatement(Token token) { | 2987 Token parseEmptyStatement(Token token) { |
2990 listener.handleEmptyStatement(token); | 2988 listener.handleEmptyStatement(token); |
2991 return expectSemicolon(token); | 2989 return expectSemicolon(token); |
2992 } | 2990 } |
2993 } | 2991 } |
OLD | NEW |