SemVer.Basic - Types for Version Numbers #
Semantic Versioning defines a grammar for versions and precedence rules for two version.
Basic.lean provides the types for the the left-hand side of a grammar rules in
Backus–Naur Form Grammar for Valid SemVer Versions.
String.Slice has no Repr but uses ToString instead.
However, the default implementation does not provide the surrounding quotes (") and that's
an own instance is provided that overrides the default.
Before defining an instance for Repr String.Slice:
#synth (Repr String.Slice) -- failed to synthesize Repr Slice
#synth (ToString String.Slice) -- instToString
#eval "abc" -- "abc"
#eval "abc".toSlice -- abc without surrounding quotes
After defining the own instance:
#synth (Repr String.Slice) -- instRepr_semVer
#eval "abc".toSlice -- "abc" with surrounding quotes
Equations
- String.Slice.instRepr_semVer = { reprPrec := fun (s : String.Slice) (x : Nat) => Std.Format.text s.toString.quote }
Returns the n preceding characters of s in underlying string as String.Slice.
If there are less then n characters before s, all characters preceding s are returned.
def s : String.Slice := "red green blue".slice ⟨⟨4⟩, by decide⟩ ⟨⟨9⟩, by decide⟩ (by decide)
#eval s -- "green"
#eval s.getPrefixn 2 -- "d "
#eval s.getPrefixn 10 -- "red "
Equations
- s.getPrefixn n = s.str.slice (s.startInclusive.prevn n) s.startInclusive ⋯
Instances For
Returns the full prefix of s (i.e. all characters before s) in the underlying string
as String.Slice.
Instances For
Returns the n succeeding characters of s in underlying string as String.Slice.
If there are less then n characters after s, all characters following s are returned.
def s : String.Slice := "red green blue".slice ⟨⟨4⟩, by decide⟩ ⟨⟨9⟩, by decide⟩ (by decide)
#eval s -- "green"
#eval s.getSuffixn 2 -- " b"
#eval s.getSuffixn 10 -- " blue"
Equations
- s.getSuffixn n = s.str.slice s.endExclusive (s.endExclusive.nextn n) ⋯
Instances For
Returns the full suffix of s (i.e. all characters after s) within the underlying string
as String.Slice.
Instances For
If parsing fails, a ParserError is returned. In that, message gives an explanation of the error
and input optionally provides the section of the input string that could not be parsed and thus
caused the error.
- message : String
- input : Option String.Slice
Instances For
Equations
- instReprParserError = { reprPrec := instReprParserError.repr }
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- instBEqParserError = { beq := instBEqParserError.beq }
Equations
Instances For
Returns a formatted string that contains the error message some context if some slice is provided.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- ParserError.instToString = { toString := ParserError.toString }
Defines a default with "unknown error" as message and no input.
Parsers return a ParserResult. If parsing was successful, some value of type α is included,
which has by retrieved from the input. If the input was incorrect, ParserResult is wrapper of a ParserError.
- success {α : Type} : α → ParserResult α
- failure {α : Type} : ParserError → ParserResult α
Instances For
Equations
- instReprParserResult = { reprPrec := instReprParserResult.repr }
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- instBEqParserResult.beq (ParserResult.success a) (ParserResult.success b) = (a == b)
- instBEqParserResult.beq (ParserResult.failure a) (ParserResult.failure b) = (a == b)
- instBEqParserResult.beq x✝¹ x✝ = false
Instances For
Equations
Defines a default for ParserResult α based on the default of ParserError.
Equations
- instInhabitedParserResult = { default := ParserResult.failure default }
Equations
Instances For
Equations
- ParserResult.instToString = { toString := ParserResult.toString }
Converts a parser result of type ParserResult α into a value if type
Option α that is none in case of failure and some result if parsing was successful.
Equations
- (ParserResult.success a).to? = some a
- (ParserResult.failure a).to? = none
Instances For
Unwraps the value from a .successful parser result and
panics if a ParserResult with a .failure is provided.
Equations
- (ParserResult.success a).to! = a
- (ParserResult.failure a).to! = panic (toString "no parser result due to " ++ toString a)
Instances For
Converts the value from a successful parser result
into an term of IO α and throws an error, if a
ParserResult with .failure is provided.
Equations
- (ParserResult.success a).toIO! = pure a
- (ParserResult.failure a).toIO! = throw (IO.userError a.toString)
Instances For
A Parser provides function parse that takes a String.Slice as input and returns
a ParserResult.
- parse (s : String.Slice) : ParserResult α
Instances
A SplitMapParser implements parse by splitting the provided String.Slice based
on separator sep and mapping Parser α to each sub-slice.
Instances
Equations
Provides a representation for a non-empty list so that #eval can be used.
Instances For
Equations
- NonEmptyList.instRepr α = { reprPrec := NonEmptyList.repr }
Equations
- NonEmptyList.instLT α = { lt := NonEmptyList.lt }
Decidable less-than for NonEmptyList.
Equations
- a.decLt b = a.val.decidableLT b.val
Instances For
Renders a non-empty list as string with its elements separated by ".".
For instance,
#eval toDotSeparatedString (⟨[0, 1, 2, 3, 4], rfl⟩ : NonEmptyList Nat)
results in "0.1.2.3.4".
Equations
- a.toDotSeparatedString = ".".intercalate (List.map (fun (a : α) => toString a) a.val)
Instances For
Parses the given string slice and, if possible, returns a result containing
a non-empty list of terms of type α.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- One or more equations did not get rendered due to their size.
- NonEmptyList.parse.mapParser [] = ParserResult.success []
Instances For
Equations
- NonEmptyList.instSplitMapParser = { parse := NonEmptyList.parse α }
Equations
- instReprNonEmptyString = { reprPrec := instReprNonEmptyString._aux_1 }
Equations
- instToStringNonEmptyString = { toString := instToStringNonEmptyString._aux_1 }
Equations
Less-than-relation for non-empty strings.
Instances For
Equations
Equations
- a.decidableLT b = a.decLt b
Parses a given string slice and returns a result containing a non-empty string if possible
and a result that wraps a ParserError otherwise.
Equations
- NonEmptyString.parse s = if h : (!s.toString.isEmpty) = true then ParserResult.success ⟨s.toString, h⟩ else ParserResult.failure { message := "string must not be empty", input := some s }
Instances For
Equations
- NonEmptyString.instParser = { parse := NonEmptyString.parse }
Converts a character representing a digit for base ten (10)
to the natural number corresponding to this digit - for other
characters none is returned.
This implementation is seemingly better suited for proofs compared to e.g.
def toDigit? (c: Char) : Option Nat :=
if c.isDigit then
some (c.toNat - '0'.toNat)
else
none
Equations
Instances For
Is an alternative implementation to the standard function Char.isDigit
that is based on Char.toDigit?.
This implementation appears to be better suited for proofs than Char.isDigit.
Instances For
Converts a digit to a natural number and panics for characters that are not digits (for base ten).
Equations
Instances For
Returns true if the NonEmptyString that is provided as input only contains
digits (for base ten). It is based on Char.isDigit', so that it easier to
work with it in proofs.
Hence it is used here instead of shorter implementations like
def NonEmptyString.hasOnlyDigits (nes: NonEmptyString) : Bool := nes.val.isNat
Equations
- nes.hasOnlyDigits = nes.val.toList.all Char.isDigit'
Instances For
Defines a subtype of NonEmptyString with the restriction that all
characters must be digits (for base ten).
This is used for the definitions
<digits> ::= <digit>
| <digit> <digits>
<digit> ::= "0"
| <positive digit>
<positive digit> ::= "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9"
(see https://semver.org/#backusnaur-form-grammar-for-valid-semver-versions).
Equations
- Digits = { nes : NonEmptyString // nes.hasOnlyDigits = true }
Instances For
Equations
- instReprDigits = { reprPrec := instReprDigits._aux_1 }
Equations
- instToStringDigits = { toString := instToStringDigits._aux_1 }
Equations
- instBEqDigits = { beq := instBEqDigits._aux_1 }
Less-than-relation for digits, which is based on Nat (and not String)
as defined in https://semver.org/ under 4.1:
Identifiers consisting of only digits are compared numerically.
This means that the canonical injection fun (a : Digits) => a.val
is not a strictly increasing function as the following example shows:
def a : NonEmptyString := ⟨"23", rfl⟩
def b : NonEmptyString := ⟨"123", rfl⟩
#eval b < a -- true
def a' : Digits := ⟨a, rfl⟩
def b' : Digits := ⟨b, rfl⟩
#eval a' < b' -- true
Instances For
Equations
- Digits.instLT = { lt := Digits.lt }
Equations
- a.decidableLT b = a.decLt b
Converts a string slice into Digits if possible - wrapped into a
ParserResult.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- Digits.instParser = { parse := Digits.parse }
Detects if a given term of type Digits has a leading zero.
https://semver.org/ forbids leading zeros for both, numbers in the version core and numeric identifiers.
Equations
Instances For
Numeric identifiers are sequences of digits without leading zeros.
Examples: Strings "1234" and "0" are valid numeric identifiers
while "01" is not.
This is used for the definition
<numeric identifier> ::= "0"
| <positive digit>
| <positive digit> <digits>
(see https://semver.org/#backusnaur-form-grammar-for-valid-semver-versions).
Instances For
Equations
- instBEqNumIdent = { beq := instBEqNumIdent._aux_1 }
Equations
- instReprNumIdent = { reprPrec := instReprNumIdent._aux_1 }
Equations
- instToStringNumIdent = { toString := instToStringNumIdent._aux_1 }
Equations
- NumIdent.instLT = { lt := NumIdent.lt }
Equations
- a.decidableLT b = a.decLt b
Parses string slices into NumIdent wrapped into a ParserResult
if possible.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- NumIdent.instParser = { parse := NumIdent.parse }
Checks if a character is allowed for identifiers, i.e. it is either an letter (upper or lowercase), a digit (for base 10) or '-'.
This is used for the definition
<identifier character> ::= <digit>
| <non-digit>
<non-digit> ::= <letter>
| "-"
<digits> ::= <digit>
| <digit> <digits>
<digit> ::= "0"
| <positive digit>
<positive digit> ::= "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9"
<letter> ::= "A" | "B" | "C" | "D" | "E" | "F" | "G" | "H" | "I" | "J"
| "K" | "L" | "M" | "N" | "O" | "P" | "Q" | "R" | "S" | "T"
| "U" | "V" | "W" | "X" | "Y" | "Z" | "a" | "b" | "c" | "d"
| "e" | "f" | "g" | "h" | "i" | "j" | "k" | "l" | "m" | "n"
| "o" | "p" | "q" | "r" | "s" | "t" | "u" | "v" | "w" | "x"
| "y" | "z"
(see https://semver.org/#backusnaur-form-grammar-for-valid-semver-versions).
Equations
- chr.isAllowedForIdentifier = (chr.isAlphanum || chr == '-')
Instances For
Checks if a NonEmptyString only contains characters that are allowed for identifiers.
The shorter implementation
def NonEmptyString.isAllowedAsIdentifier (s: NonEmptyString) : Bool :=
s.val.all Char.isAllowedForIdentifier
does not work for statements like
example : NonEmptyString.isAllowedAsIdentifier ⟨"12ab", by decide⟩ == true := by decide
with by decide as proof but requires seemingly a more sophisticated proof.
Equations
Instances For
Equations
Instances For
Equations
- instToStringIdent = { toString := instToStringIdent._aux_1 }
Equations
- instBEqIdent = { beq := instBEqIdent._aux_1 }
Equations
- instReprIdent = { reprPrec := instReprIdent._aux_1 }
Equations
- Ident.instLT = { lt := Ident.lt }
Equations
- a.decidableLT b = a.decLt b
Parses the given string slice and if it is not empty and contains only allowed
characters, returns an Ident wrapped in a ParserResult.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- Ident.instParser = { parse := Ident.parse }
Returns true iff the character is allowed for identifiers but is not a digit,
i.e. is in [A-Za-z\-].
This is used for
<alphanumeric identifier> ::= <non-digit>
| <non-digit> <identifier characters>
| <identifier characters> <non-digit>
| <identifier characters> <non-digit> <identifier characters>
(see https://semver.org/#backusnaur-form-grammar-for-valid-semver-versions).
Instances For
Returns true iff at least one character in the given identifier is not a digit.
Again, there are shorter implementation such as
def Ident.hasNonDigit (i: Ident) : Bool :=
i.val.val.any Char.isAllowedAndNonDigit
but they less convenient in proofs.
Equations
Instances For
Equations
Instances For
AlphanumIdent is the type for alphanumeric identifiers.
Equations
- AlphanumIdent = { i : Ident // i.hasNonDigit = true }
Instances For
Equations
Equations
- instToStringAlphanumIdent = { toString := instToStringAlphanumIdent._aux_1 }
Equations
- instReprAlphanumIdent = { reprPrec := instReprAlphanumIdent._aux_1 }
Defines the less-than-relation for AlphanumIdent.
Instances For
Equations
- AlphanumIdent.instLT = { lt := AlphanumIdent.lt }
Decidable less-than for AlphanumIdent.
Instances For
Equations
- a.decidableLT b = a.decLt b
Parses the given string slice and if it is a valid alphanumeric identifier,
returns it wrapped in a ParserResult.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Defines build-identifiers in accordance with
<build identifier> ::= <alphanumeric identifier>
| <digits>
(see https://semver.org/#backusnaur-form-grammar-for-valid-semver-versions).
- alphanumIdent (val : AlphanumIdent) : BuildIdent
- digits (val : Digits) : BuildIdent
Instances For
Equations
- instDecidableEqBuildIdent.decEq (BuildIdent.alphanumIdent a) (BuildIdent.alphanumIdent b) = if h : a = b then h ▸ isTrue ⋯ else isFalse ⋯
- instDecidableEqBuildIdent.decEq (BuildIdent.alphanumIdent val) (BuildIdent.digits val_1) = isFalse ⋯
- instDecidableEqBuildIdent.decEq (BuildIdent.digits val) (BuildIdent.alphanumIdent val_1) = isFalse ⋯
- instDecidableEqBuildIdent.decEq (BuildIdent.digits a) (BuildIdent.digits b) = if h : a = b then h ▸ isTrue ⋯ else isFalse ⋯
Instances For
Equations
- instBEqBuildIdent = { beq := instBEqBuildIdent.beq }
Equations
- instBEqBuildIdent.beq (BuildIdent.alphanumIdent a) (BuildIdent.alphanumIdent b) = (a == b)
- instBEqBuildIdent.beq (BuildIdent.digits a) (BuildIdent.digits b) = (a == b)
- instBEqBuildIdent.beq x✝¹ x✝ = false
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- instReprBuildIdent = { reprPrec := instReprBuildIdent.repr }
Returns the string representation of a build identifier.
Equations
Instances For
Equations
- BuildIdent.instToString = { toString := BuildIdent.toString }
Parses the given string slice and if it is a valid build identifier,
returns it wrapped in a ParserResult.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- BuildIdent.instParser = { parse := BuildIdent.parse }
Defines dot-separated build identifiers as non-empty lists of BuildIdents in accordance with
<dot-separated build identifiers> ::= <build identifier>
| <build identifier> "." <dot-separated build identifiers>
(see https://semver.org/#backusnaur-form-grammar-for-valid-semver-versions).
Equations
Instances For
Equations
- instReprDotSepBuildIdents = { reprPrec := instReprDotSepBuildIdents._aux_1 }
Equations
Defines a default value for DotSepBuildIdents so that to!
can be used on ParserResult DotSepBuildIdents.
Equations
- One or more equations did not get rendered due to their size.
Returns a string representation of dot-separated build identifiers.
Instances For
Equations
- DotSepBuildIdents.instToString = { toString := DotSepBuildIdents.toString }
Parses the given string slice and if it is a valid dot-separated build identifiers,
returns it wrapped in a ParserResult.
Equations
Instances For
Equations
Defines the type for pre-release identifiers in accordance with
<pre-release identifier> ::= <alphanumeric identifier>
| <numeric identifier>
(see https://semver.org/#backusnaur-form-grammar-for-valid-semver-versions).
- alphanumIdent (val : AlphanumIdent) : PreRelIdent
- numIdent (val : NumIdent) : PreRelIdent
Instances For
Equations
- instDecidableEqPreRelIdent.decEq (PreRelIdent.alphanumIdent a) (PreRelIdent.alphanumIdent b) = if h : a = b then h ▸ isTrue ⋯ else isFalse ⋯
- instDecidableEqPreRelIdent.decEq (PreRelIdent.alphanumIdent val) (PreRelIdent.numIdent val_1) = isFalse ⋯
- instDecidableEqPreRelIdent.decEq (PreRelIdent.numIdent val) (PreRelIdent.alphanumIdent val_1) = isFalse ⋯
- instDecidableEqPreRelIdent.decEq (PreRelIdent.numIdent a) (PreRelIdent.numIdent b) = if h : a = b then h ▸ isTrue ⋯ else isFalse ⋯
Instances For
Equations
- instBEqPreRelIdent.beq (PreRelIdent.alphanumIdent a) (PreRelIdent.alphanumIdent b) = (a == b)
- instBEqPreRelIdent.beq (PreRelIdent.numIdent a) (PreRelIdent.numIdent b) = (a == b)
- instBEqPreRelIdent.beq x✝¹ x✝ = false
Instances For
Equations
- instBEqPreRelIdent = { beq := instBEqPreRelIdent.beq }
Equations
- instReprPreRelIdent = { reprPrec := instReprPreRelIdent.repr }
Equations
- One or more equations did not get rendered due to their size.
Instances For
Less-than-relation for pre-release identifiers. Numeric identifiers always have lower precedence than alphanumeric (non-numeric) identifiers (see https://semver.org/, section 11.4.3).
Equations
- (PreRelIdent.alphanumIdent val).lt (PreRelIdent.numIdent val_1) = False
- (PreRelIdent.numIdent val).lt (PreRelIdent.alphanumIdent val_1) = True
- (PreRelIdent.alphanumIdent s).lt (PreRelIdent.alphanumIdent t) = (s < t)
- (PreRelIdent.numIdent s).lt (PreRelIdent.numIdent t) = (s < t)
Instances For
Equations
- PreRelIdent.instLT = { lt := PreRelIdent.lt }
Decidable less-than for PreRelIdent.
Equations
- (PreRelIdent.alphanumIdent s).decLt (PreRelIdent.alphanumIdent t) = if h : s < t then isTrue h else isFalse h
- (PreRelIdent.numIdent s).decLt (PreRelIdent.numIdent t) = if h : s < t then isTrue h else isFalse h
- (PreRelIdent.alphanumIdent val).decLt (PreRelIdent.numIdent val_1) = isFalse ⋯
- (PreRelIdent.numIdent val).decLt (PreRelIdent.alphanumIdent val_1) = isTrue ⋯
Instances For
Returns the string representation of a pre-release identifier.
Equations
Instances For
Equations
- PreRelIdent.instToString = { toString := PreRelIdent.toString }
Parses the given string slice and if it is a valid pre-release identifier, returns
it wrapped in a ParserResult.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- PreRelIdent.instParser = { parse := PreRelIdent.parse }
Defines dot-separated pre-release identifiers in accordance with
<dot-separated pre-release identifiers> ::= <pre-release identifier>
| <pre-release identifier> "." <dot-separated pre-release identifiers>
(see https://semver.org/#backusnaur-form-grammar-for-valid-semver-versions).
Equations
Instances For
Equations
Equations
- instReprDotSepPreRelIdents = { reprPrec := instReprDotSepPreRelIdents._aux_1 }
Equations
- One or more equations did not get rendered due to their size.
Provides a representation for dot-separated pre-release identifiers
so that #eval can be used.
Instances For
Equations
- DotSepPreRelIdents.instRepr = { reprPrec := DotSepPreRelIdents.repr }
Equations
- a.lt b = NonEmptyList.lt a b
Instances For
Equations
Decidable less-than-relation for DotSepPreRelIdents.
Equations
- a.decLt b = NonEmptyList.decLt a b
Instances For
Instances For
Equations
- DotSepPreRelIdents.instToString = { toString := DotSepPreRelIdents.toString }
Parses the given string slice and if it is a valid dot-separated pre-release
identifiers, returns it wrapped in a ParserResult.
Equations
Instances For
Equations
Defines the version core in accordance with
<version core> ::= <major> "." <minor> "." <patch>
<major> ::= <numeric identifier>
<minor> ::= <numeric identifier>
<patch> ::= <numeric identifier>
(see https://semver.org/#backusnaur-form-grammar-for-valid-semver-versions).
Version cores default to 1.0.0.
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
Instances For
Equations
- instBEqVersionCore = { beq := instBEqVersionCore.beq }
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- instReprVersionCore = { reprPrec := instReprVersionCore.repr }
Equations
- instInhabitedVersionCore = { default := instInhabitedVersionCore.default }
Equations
Instances For
Equations
- VersionCore.instToString = { toString := VersionCore.toString }
Less-than-relation for version cores.
Instances For
Equations
- VersionCore.instLT = { lt := VersionCore.lt }
Decides if < holds true for two version cores.
Equations
- v.decLt w = v.toList.decidableLT w.toList
Instances For
Parses the given string and if it is a valid version core, returns it
wrapped in a ParserResult.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- VersionCore.instParser = { parse := VersionCore.parse }
Defines a full semantic version in accordance with
<version> ::= <version core>
| <version core> "-" <pre-release>
| <version core> "+" <build>
| <version core> "-" <pre-release> "+" <build>
<pre-release> ::= <dot-separated pre-release identifiers>
<build> ::= <dot-separated build identifiers>
(see https://semver.org/#backusnaur-form-grammar-for-valid-semver-versions).
- preRelease : Option DotSepPreRelIdents
- build : Option DotSepBuildIdents
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- instBEqVersion = { beq := instBEqVersion.beq }
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- instReprVersion = { reprPrec := instReprVersion.repr }
Equations
- instInhabitedVersion = { default := instInhabitedVersion.default }
Equations
Instances For
Returns the string representation of a version.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- Version.instToString = { toString := Version.toString }
Helper function for comparing the parts of versions outside the version core.
Equations
Instances For
Less-than-relation for versions in accordance with section 11 of the SemVer specification.
Equations
- v.lt w = (v.toVersionCore < w.toVersionCore ∨ v.toVersionCore = w.toVersionCore ∧ v.ltPreRelease w = true)
Instances For
Equations
- Version.instLT = { lt := Version.lt }
Decides if < holds true for two versions.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
Helper function that parses the version core and optional pre-release-part of a version string slice.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Parses the given string slice and if it is a valid version, returns it
wrapped in a ParserResult.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- Version.instParser = { parse := Version.parse }
Returns true if public API provided under this version is stable.
Equations
Instances For
Returns a version that is the subsequent pre-release version based on the provided version and pre-release string.
If the resulting version is not greater than the provided version, or if
the pre-release string is invalid, none is returned.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Returns a version that is the same as the provided version but with the pre-release part set to the provided string.
If the resulting version is not greater than the provided version, or if
the pre-release string is invalid, none is returned.
Equations
Instances For
Returns a version that is the same as the provided version but with the build part set to the provided string.
If the given string is not valid as build metadata, none is returned.
Equations
- { toVersionCore := c, build := build }.setBuild? str = (Version.parse (toString c ++ toString "+" ++ toString str).toSlice).to?
- { toVersionCore := c, preRelease := some p, build := build }.setBuild? str = (Version.parse (toString c ++ toString "-" ++ toString p ++ toString "+" ++ toString str).toSlice).to?
Instances For
Helper function that checks if a character can be the start of a version in a string, given the previous character (if any).
Equations
Instances For
Helper function that checks if a character is valid in a version string.
Equations
- c.isValidForVersion = (c.isAllowedForIdentifier || c == '.' || c == '+')
Instances For
Equations
- c.addPreRelease? suffix = (Version.parse (toString c ++ toString "-" ++ toString suffix).toSlice).to?
Instances For
Instances For
Extracts all versions that are contained in a given string.