; Backus-Naur Form Grammar for a Semantic Version Range ; https://semver.xyz/grammar/#ranges ; ; A range-set is one or more comparator sets joined by "||". A version matches ; the range-set if it satisfies every comparator in at least one set. The ; advanced forms (hyphen, x-range, tilde, caret, approximate) desugar to ; primitive comparators in deterministic ways. ::= ( ) * ::= ( " " ) * "||" ( " " ) * ::= | ( " " ) * | "" ::= " - " ::= | | | | | ::= ::= "<" | ">" | ">=" | "<=" | "=" ::= "~" ; The pessimistic operator keeps its RubyGems meaning: drop the last supplied ; part and allow up to the next value of the part before it. One or three parts ; equal the tilde; two parts reach the next major. ; ~>1.2 -> >=1.2.0 <2.0.0-0 (~1.2 is >=1.2.0 <1.3.0-0) ; ~>1.2.3 -> >=1.2.3 <1.3.0-0 ::= "~>" ::= "^" ; "*-*" is the UNIVERSAL pre-release channel: admit pre-releases on every tuple ; (the range-driven replacement for an "includePrerelease" flag). "*" alone is ; still stable-only. ::= "*-*" ::= [ "." [ "." ? ] ] ::= "x" | "X" | "*" | ::= ( "-" ) ? ( "+" ) ? ; A range pre-release may be the wildcard "*" (any pre-release of this tuple); ; versions themselves never use it (see VERSION.bnf's stricter ). ::= "*" | ; , , and 's leaf tokens ; are defined by the version grammar (see VERSION.bnf). ; ; Build channels: a "+ " on a , or is a ; CHANNEL FILTER, orthogonal to the numeric comparison. The numeric comparison ; ignores build metadata on both sides; a candidate then satisfies the channel ; iff its own build identifiers begin with the channel's (prefix match). A ; / channel applies to every comparator it desugars to; a ; range keeps each endpoint's build as that endpoint's channel. ; ^1.0.0+win -> >=1.0.0+win <2.0.0-0+win (the "win" channel within ^1.0.0) ; ; Pre-release channels: a "- " on a , or ; is likewise a CHANNEL FILTER on that comparator's [major, minor, patch] tuple, ; matched as a PREFIX. Stable versions are unaffected; a pre-release is admitted ; only if some comparator declares a matching channel on its tuple. Pre-releases ; are excluded by default because they rank BELOW their release (the mirror of ; build, which ranks above and is therefore included by default). ; ^1.0.0-rc -> >=1.0.0-rc <2.0.0-0 (the "rc" channel of 1.0.0; not beta) ; ^1.0.0-* -> >=1.0.0-0 <2.0.0-0 (any pre-release of the 1.0.0 tuple) ; *-* (any pre-release, any tuple)