| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 formatter_impl; | 5 library formatter_impl; |
| 6 | 6 |
| 7 import 'dart:math'; | 7 import 'dart:math'; |
| 8 | 8 |
| 9 import 'package:analyzer/analyzer.dart'; | 9 import 'package:analyzer/analyzer.dart'; |
| 10 import 'package:analyzer/src/generated/parser.dart'; | 10 import 'package:analyzer/src/generated/parser.dart'; |
| (...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 303 } | 303 } |
| 304 | 304 |
| 305 // Cached parser for testing token types. | 305 // Cached parser for testing token types. |
| 306 final tokenTester = new Parser(null,null); | 306 final tokenTester = new Parser(null,null); |
| 307 | 307 |
| 308 /// Test if this token is an EOF token. | 308 /// Test if this token is an EOF token. |
| 309 bool isEOF(Token token) => tokenIs(token, TokenType.EOF); | 309 bool isEOF(Token token) => tokenIs(token, TokenType.EOF); |
| 310 | 310 |
| 311 /// Test for token type. | 311 /// Test for token type. |
| 312 bool tokenIs(Token token, TokenType type) => | 312 bool tokenIs(Token token, TokenType type) => |
| 313 token != null && tokenTester.matches4(token, type); | 313 token != null && tokenTester.matchesAny(token, [type]); |
| 314 | 314 |
| 315 /// Test if this token is a GT token. | 315 /// Test if this token is a GT token. |
| 316 bool isGT(Token token) => tokenIs(token, TokenType.GT); | 316 bool isGT(Token token) => tokenIs(token, TokenType.GT); |
| 317 | 317 |
| 318 /// Test if this token is a GT_GT token. | 318 /// Test if this token is a GT_GT token. |
| 319 bool isGT_GT(Token token) => tokenIs(token, TokenType.GT_GT); | 319 bool isGT_GT(Token token) => tokenIs(token, TokenType.GT_GT); |
| 320 | 320 |
| 321 /// Test if this token is an INDEX token. | 321 /// Test if this token is an INDEX token. |
| 322 bool isINDEX(Token token) => tokenIs(token, TokenType.INDEX); | 322 bool isINDEX(Token token) => tokenIs(token, TokenType.INDEX); |
| 323 | 323 |
| (...skipping 1428 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1752 var lastLine = | 1752 var lastLine = |
| 1753 lineInfo.getLocation(lastOffset).lineNumber; | 1753 lineInfo.getLocation(lastOffset).lineNumber; |
| 1754 var currentLine = | 1754 var currentLine = |
| 1755 lineInfo.getLocation(currentOffset).lineNumber; | 1755 lineInfo.getLocation(currentOffset).lineNumber; |
| 1756 return currentLine - lastLine; | 1756 return currentLine - lastLine; |
| 1757 } | 1757 } |
| 1758 | 1758 |
| 1759 String toString() => writer.toString(); | 1759 String toString() => writer.toString(); |
| 1760 | 1760 |
| 1761 } | 1761 } |
| OLD | NEW |