Skip to content
This repository has been archived by the owner on Aug 11, 2022. It is now read-only.

Commit

Permalink
semver@5.1.0
Browse files Browse the repository at this point in the history
Add BNF grammar to documentation.

Credit: @isaacs
Reviewed-By: @othiym23
  • Loading branch information
othiym23 committed Dec 11, 2015
1 parent 95e99fa commit b835b72
Show file tree
Hide file tree
Showing 6 changed files with 140 additions and 34 deletions.
26 changes: 25 additions & 1 deletion doc/misc/semver.md
Original file line number Diff line number Diff line change
Expand Up @@ -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'
```

Expand Down Expand Up @@ -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
Expand Down
26 changes: 25 additions & 1 deletion node_modules/semver/README.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

92 changes: 73 additions & 19 deletions node_modules/semver/package.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 16 additions & 0 deletions node_modules/semver/range.bnf

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 0 additions & 12 deletions node_modules/semver/semver.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@
"request": "~2.67.0",
"retry": "~0.8.0",
"rimraf": "~2.4.4",
"semver": "~5.0.3",
"semver": "~5.1.0",
"sha": "~2.0.1",
"slide": "~1.1.6",
"sorted-object": "~1.0.0",
Expand Down

0 comments on commit b835b72

Please sign in to comment.