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

Side by Side Diff: sdk/lib/_internal/pub/lib/src/version.dart

Issue 113883002: Create associated packages for the dart:collection and dart:async libs. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Split sequence_zip into pkg:async and pkg:collection. Created 7 years 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
OLDNEW
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 /// Handles version numbers, following the [Semantic Versioning][semver] spec. 5 /// Handles version numbers, following the [Semantic Versioning][semver] spec.
6 /// 6 ///
7 /// [semver]: http://semver.org/ 7 /// [semver]: http://semver.org/
8 library pub.version; 8 library pub.version;
9 9
10 import 'dart:math'; 10 import 'dart:math';
11 11
12 import 'package:collection_helpers/equality.dart'; 12 import 'package:collection/equality.dart';
13 13
14 /// Regex that matches a version number at the beginning of a string. 14 /// Regex that matches a version number at the beginning of a string.
15 final _START_VERSION = new RegExp( 15 final _START_VERSION = new RegExp(
16 r'^' // Start at beginning. 16 r'^' // Start at beginning.
17 r'(\d+).(\d+).(\d+)' // Version number. 17 r'(\d+).(\d+).(\d+)' // Version number.
18 r'(-([0-9A-Za-z-]+(\.[0-9A-Za-z-]+)*))?' // Pre-release. 18 r'(-([0-9A-Za-z-]+(\.[0-9A-Za-z-]+)*))?' // Pre-release.
19 r'(\+([0-9A-Za-z-]+(\.[0-9A-Za-z-]+)*))?'); // Build. 19 r'(\+([0-9A-Za-z-]+(\.[0-9A-Za-z-]+)*))?'); // Build.
20 20
21 /// Like [_START_VERSION] but matches the entire string. 21 /// Like [_START_VERSION] but matches the entire string.
22 final _COMPLETE_VERSION = new RegExp("${_START_VERSION.pattern}\$"); 22 final _COMPLETE_VERSION = new RegExp("${_START_VERSION.pattern}\$");
(...skipping 501 matching lines...) Expand 10 before | Expand all | Expand 10 after
524 524
525 class _EmptyVersion implements VersionConstraint { 525 class _EmptyVersion implements VersionConstraint {
526 const _EmptyVersion(); 526 const _EmptyVersion();
527 527
528 bool get isEmpty => true; 528 bool get isEmpty => true;
529 bool get isAny => false; 529 bool get isAny => false;
530 bool allows(Version other) => false; 530 bool allows(Version other) => false;
531 VersionConstraint intersect(VersionConstraint other) => this; 531 VersionConstraint intersect(VersionConstraint other) => this;
532 String toString() => '<empty>'; 532 String toString() => '<empty>';
533 } 533 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698