diff options
author | Forrest L Norvell <forrest@npmjs.com> | 2015-12-11 06:22:07 +0300 |
---|---|---|
committer | Forrest L Norvell <forrest@npmjs.com> | 2015-12-11 07:00:04 +0300 |
commit | b835b72d1dd23b0a17321a85d8d395322d18005d (patch) | |
tree | 21cd38b3c1717f1936bdbd14b0b135a15205e4b2 /node_modules/semver/README.md | |
parent | 95e99faadcdc85a16210dd79c0e7d83add1b9f3e (diff) |
semver@5.1.0
Add BNF grammar to documentation.
Credit: @isaacs
Reviewed-By: @othiym23
Diffstat (limited to 'node_modules/semver/README.md')
-rw-r--r-- | node_modules/semver/README.md | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/node_modules/semver/README.md b/node_modules/semver/README.md index b5e35ff0b..0b14a7e81 100644 --- a/node_modules/semver/README.md +++ b/node_modules/semver/README.md @@ -107,7 +107,7 @@ The method `.inc` takes an additional `identifier` string argument that will append the value of the string as a prerelease identifier: ```javascript -> semver.inc('1.2.3', 'pre', 'beta') +> semver.inc('1.2.3', 'prerelease', 'beta') '1.2.4-beta.0' ``` @@ -228,6 +228,30 @@ zero. * `^1.x` := `>=1.0.0 <2.0.0` * `^0.x` := `>=0.0.0 <1.0.0` +### Range Grammar + +Putting all this together, here is a Backus-Naur grammar for ranges, +for the benefit of parser authors: + +```bnf +range-set ::= range ( logical-or range ) * +logical-or ::= ( ' ' ) * '||' ( ' ' ) * +range ::= hyphen | simple ( ' ' simple ) * | '' +hyphen ::= partial ' - ' partial +simple ::= primitive | partial | tilde | caret +primitive ::= ( '<' | '>' | '>=' | '<=' | '=' | ) partial +partial ::= xr ( '.' xr ( '.' xr qualifier ? )? )? +xr ::= 'x' | 'X' | '*' | nr +nr ::= '0' | ['1'-'9']['0'-'9']+ +tilde ::= '~' partial +caret ::= '^' partial +qualifier ::= ( '-' pre )? ( '+' build )? +pre ::= parts +build ::= parts +parts ::= part ( '.' part ) * +part ::= nr | [-0-9A-Za-z]+ +``` + ## Functions All methods and classes take a final `loose` boolean argument that, if |