New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
EBNF grammar #192
Comments
it's much more complex than that... |
Just in case one hasn't seen it. There is BNF grammar for SemVer: https://github.com/mojombo/semver/blob/master/semver.md#backusnaur-form-grammar-for-valid-semver-versions |
Just found a flaw. |
FWIW, here is a regular expression I used for my Python implementation. It's not 2.0.0-comform because I allow empty build and pre-release fields to make version selectors more simple but otherwise it should be correct. Furthermore, I added a "whitespace detection" to the regex to allow extracting it from a string, but that doesn't matter when enclosing with |
Please comment and correct. |
@gvlx my corrections:
Version ::= VersionCore ('-' PreRelease)? ('+' Build)?
VersionCore ::= Major '.' Minor '.' Patch
Major ::= NumericIdentifier
Minor ::= NumericIdentifier
Patch ::= NumericIdentifier
PreRelease ::= CompoundPreReleaseIdentifier
Build ::= CompoundBuildIdentifier
CompoundPreReleaseIdentifier ::= PreReleaseIdentifier ('.' PreReleaseIdentifier)*
CompoundBuildIdentifier ::= BuildIdentifier ('.' BuildIdentifier)*
PreReleaseIdentifier ::= AlphaNumericIdentifier | NumericIdentifier
BuildIdentifier ::= IdentifierCharacter+
NumericIdentifier ::= '0' | ( PositiveNumeric NumericCharacter* )
AlphaNumericIdentifier ::= NumericCharacter* NonNumericCharacter IdentifierCharacter*
IdentifierCharacter ::= NonNumericCharacter | NumericCharacter
NonNumericCharacter ::= [A-Za-z-]
NumericCharacter ::= '0' | PositiveNumeric
PositiveNumeric ::= [1-9] |
The EBNF has been corrected by @glebec on #192 (comment) . This issue should now be closed. |
@christianhujer , unless you have further questions, can you please close this issue at your earliest possible convenience? |
@christianhujer Looks like the EBNF grammar has already been merged into |
The Semantic Versioning Spec could have an EBNF grammar.
Here it is, according to http://www.w3.org/TR/xml/#sec-notation.
version ::= MAJOR '.' MINOR '.' PATCH ('-' PRE)? ('+' BUILD)?
MAJOR ::= decimalnumber
MINOR ::= decimalnumber
PATCH ::= decimalnumber
PRE ::= string
BUILD ::= string
string ::= [0-9A-Za-z-]+
decimalnumber ::= [0-9]+
The text was updated successfully, but these errors were encountered: