Skip to content
Add support for prerelease tags

Semver allows [prerelease tags][0], denoted by appending a hyphen and a
series of dot-separated identifiers immediately following the patch
version.  Let's add support for them!  Or at least partial support.
This might take a couple steps.

src/version.rs
--------------

The allowed characters in the prerelease label are alphanumerics,
hyphens, and periods.  We'll call that `letters_numbers_dash_dot` and
tack on an optional prerelease version in our regex.  Since that line
was getting a bit long, we'll add *x mode*, which allows us to describe
the regex over multiple lines, with comments for each important bit.

We also have to add the `pre` field to the `Version` struct and capture
it from the regex.  For now, we're just reading the whole string into an
optional single-element vector.  Later on, we will have to break it
apart into individual dot-separated identifiers.

[0]: http://semver.org/#spec-item-9