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

Side by Side Diff: utils/pub/version.dart

Issue 12288040: Reapply "Make Comparable generic." (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Fix problems. Created 7 years, 10 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 | « utils/pub/package.dart ('k') | utils/template/source.dart » ('j') | 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) 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 version; 8 library version;
9 9
10 import 'dart:math'; 10 import 'dart:math';
11 11
12 import 'utils.dart'; 12 import 'utils.dart';
13 13
14 /// A parsed semantic version number. 14 /// A parsed semantic version number.
15 class Version implements Comparable, VersionConstraint { 15 class Version implements Comparable<Version>, VersionConstraint {
16 /// No released version: i.e. "0.0.0". 16 /// No released version: i.e. "0.0.0".
17 static Version get none => new Version(0, 0, 0); 17 static Version get none => new Version(0, 0, 0);
18 18
19 static final _PARSE_REGEX = new RegExp( 19 static final _PARSE_REGEX = new RegExp(
20 r'^' // Start at beginning. 20 r'^' // Start at beginning.
21 r'(\d+).(\d+).(\d+)' // Version number. 21 r'(\d+).(\d+).(\d+)' // Version number.
22 r'(-([0-9A-Za-z-]+(\.[0-9A-Za-z-]+)*))?' // Pre-release. 22 r'(-([0-9A-Za-z-]+(\.[0-9A-Za-z-]+)*))?' // Pre-release.
23 r'(\+([0-9A-Za-z-]+(\.[0-9A-Za-z-]+)*))?' // Build. 23 r'(\+([0-9A-Za-z-]+(\.[0-9A-Za-z-]+)*))?' // Build.
24 r'$'); // Consume entire string. 24 r'$'); // Consume entire string.
25 25
(...skipping 393 matching lines...) Expand 10 before | Expand all | Expand 10 after
419 419
420 class _EmptyVersion implements VersionConstraint { 420 class _EmptyVersion implements VersionConstraint {
421 const _EmptyVersion(); 421 const _EmptyVersion();
422 422
423 bool get isEmpty => true; 423 bool get isEmpty => true;
424 bool get isAny => false; 424 bool get isAny => false;
425 bool allows(Version other) => false; 425 bool allows(Version other) => false;
426 VersionConstraint intersect(VersionConstraint other) => this; 426 VersionConstraint intersect(VersionConstraint other) => this;
427 String toString() => '<empty>'; 427 String toString() => '<empty>';
428 } 428 }
OLDNEW
« no previous file with comments | « utils/pub/package.dart ('k') | utils/template/source.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698