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 descriptor.utils; | 5 library descriptor.utils; |
6 | 6 |
7 import 'dart:io'; | 7 import 'dart:io'; |
8 | 8 |
9 import 'package:pathos/path.dart' as path; | 9 import 'package:pathos/path.dart' as path; |
10 | 10 |
(...skipping 30 matching lines...) Expand all Loading... |
41 return matchingEntries.first; | 41 return matchingEntries.first; |
42 } | 42 } |
43 } | 43 } |
44 | 44 |
45 /// Returns a human-readable description of [pattern]. | 45 /// Returns a human-readable description of [pattern]. |
46 String describePattern(Pattern pattern) { | 46 String describePattern(Pattern pattern) { |
47 if (pattern is String) return "'$pattern'"; | 47 if (pattern is String) return "'$pattern'"; |
48 if (pattern is! RegExp) return '$pattern'; | 48 if (pattern is! RegExp) return '$pattern'; |
49 | 49 |
50 var flags = new StringBuffer(); | 50 var flags = new StringBuffer(); |
51 if (!pattern.isCaseSensitive) flags.add('i'); | 51 if (!pattern.isCaseSensitive) flags.write('i'); |
52 if (pattern.isMultiLine) flags.add('m'); | 52 if (pattern.isMultiLine) flags.write('m'); |
53 return '/${pattern.pattern}/$flags'; | 53 return '/${pattern.pattern}/$flags'; |
54 } | 54 } |
OLD | NEW |