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

Side by Side Diff: tools/testing/dart/status_expression.dart

Issue 12212016: Remove Expect from core library. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Add deprecation comment for ExpectException and revert one test. Created 7 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 | Annotate | Revision Log
« no previous file with comments | « tools/publish_all_pkgs.py ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 status_expression; 5 library status_expression;
6 6
7 /** 7 /**
8 * Parse and evaluate expressions in a .status file for Dart and V8. 8 * Parse and evaluate expressions in a .status file for Dart and V8.
9 * There are set expressions and Boolean expressions in a .status file. 9 * There are set expressions and Boolean expressions in a .status file.
10 * The grammar is: 10 * The grammar is:
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after
222 left = new SetUnion(left, right); 222 left = new SetUnion(left, right);
223 } 223 }
224 return left; 224 return left;
225 } 225 }
226 226
227 227
228 SetExpression parseSetAtomic() { 228 SetExpression parseSetAtomic() {
229 if (scanner.current == Token.LEFT_PAREN) { 229 if (scanner.current == Token.LEFT_PAREN) {
230 scanner.advance(); 230 scanner.advance();
231 SetExpression value = parseSetExpression(); 231 SetExpression value = parseSetExpression();
232 Expect.equals(scanner.current, Token.RIGHT_PAREN, 232 if (scanner.current != Token.RIGHT_PAREN) {
233 "Missing right parenthesis in expression"); 233 throw new RuntimeError("Missing right parenthesis in expression");
234 }
234 scanner.advance(); 235 scanner.advance();
235 return value; 236 return value;
236 } 237 }
237 Expect.isTrue(new RegExp(r"^\w+$").hasMatch(scanner.current), 238 if (!new RegExp(r"^\w+$").hasMatch(scanner.current)) {
238 "Expected identifier in expression, got ${scanner.current}"); 239 throw new RuntimeError(
240 "Expected identifier in expression, got ${scanner.current}");
241 }
239 SetExpression value = new SetConstant(scanner.current); 242 SetExpression value = new SetConstant(scanner.current);
240 scanner.advance(); 243 scanner.advance();
241 return value; 244 return value;
242 } 245 }
243 246
244 BooleanExpression parseBooleanExpression() => parseBooleanOr(); 247 BooleanExpression parseBooleanExpression() => parseBooleanOr();
245 248
246 BooleanExpression parseBooleanOr() { 249 BooleanExpression parseBooleanOr() {
247 BooleanExpression left = parseBooleanAnd(); 250 BooleanExpression left = parseBooleanAnd();
248 while (scanner.hasMore() && scanner.current == Token.OR) { 251 while (scanner.hasMore() && scanner.current == Token.OR) {
(...skipping 11 matching lines...) Expand all
260 BooleanExpression right = parseBooleanAtomic(); 263 BooleanExpression right = parseBooleanAtomic();
261 left = new BooleanOperation(Token.AND, left, right); 264 left = new BooleanOperation(Token.AND, left, right);
262 } 265 }
263 return left; 266 return left;
264 } 267 }
265 268
266 BooleanExpression parseBooleanAtomic() { 269 BooleanExpression parseBooleanAtomic() {
267 if (scanner.current == Token.LEFT_PAREN) { 270 if (scanner.current == Token.LEFT_PAREN) {
268 scanner.advance(); 271 scanner.advance();
269 BooleanExpression value = parseBooleanExpression(); 272 BooleanExpression value = parseBooleanExpression();
270 Expect.equals(scanner.current, Token.RIGHT_PAREN, 273 if (scanner.current != Token.RIGHT_PAREN) {
271 "Missing right parenthesis in expression"); 274 throw new RuntimeError("Missing right parenthesis in expression");
275 }
272 scanner.advance(); 276 scanner.advance();
273 return value; 277 return value;
274 } 278 }
275 279
276 // The only atomic booleans are of the form $variable == value or the 280 // The only atomic booleans are of the form $variable == value or the
277 // form $variable. 281 // form $variable.
278 Expect.equals(scanner.current, Token.DOLLAR_SYMBOL, 282 if (scanner.current != Token.DOLLAR_SYMBOL) {
279 "Expected \$ in expression, got ${scanner.current}"); 283 throw new RuntimeError(
284 "Expected \$ in expression, got ${scanner.current}");
285 }
280 scanner.advance(); 286 scanner.advance();
281 Expect.isTrue(new RegExp(r"^\w+$").hasMatch(scanner.current), 287 if (!new RegExp(r"^\w+$").hasMatch(scanner.current)) {
282 "Expected identifier in expression, got ${scanner.current}"); 288 throw new RuntimeError(
289 "Expected identifier in expression, got ${scanner.current}");
290 }
283 TermVariable left = new TermVariable(scanner.current); 291 TermVariable left = new TermVariable(scanner.current);
284 scanner.advance(); 292 scanner.advance();
285 if (scanner.current == Token.EQUALS) { 293 if (scanner.current == Token.EQUALS) {
286 scanner.advance(); 294 scanner.advance();
287 Expect.isTrue(new RegExp(r"^\w+$").hasMatch(scanner.current), 295 if (!new RegExp(r"^\w+$").hasMatch(scanner.current)) {
288 "Expected identifier in expression, got ${scanner.current}"); 296 throw new RuntimeError(
297 "Expected identifier in expression, got ${scanner.current}");
298 }
289 TermConstant right = new TermConstant(scanner.current); 299 TermConstant right = new TermConstant(scanner.current);
290 scanner.advance(); 300 scanner.advance();
291 return new Comparison(left, right); 301 return new Comparison(left, right);
292 } else { 302 } else {
293 return new BooleanVariable(left); 303 return new BooleanVariable(left);
294 } 304 }
295 } 305 }
296 } 306 }
297 307
OLDNEW
« no previous file with comments | « tools/publish_all_pkgs.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698