[GH-ISSUE #448] BN form does not match spec #3042

Closed
opened 2026-04-25 17:15:38 -05:00 by GiteaMirror · 3 comments
Owner

Originally created by @jellelicht on GitHub (Jun 27, 2018).
Original GitHub issue: https://github.com/semver/semver/issues/448

The current spec does not allow alphanumeric identifiers to have a numeric prefix part.

The spec allows a pre-release to be composed of dot-separated identifiers, where identifiers are either alphanumeric or numeric identifiers.

In my understanding, "1.2.3-731b" would be a valid semver, with "731b" being the alphanumeric identifier for the pre-release part.

So either I am wrong (but the definition of 'alphanumeric identifier' could be clarified in the spec), or the current form of the BN grammar needs a tiny update.

Originally created by @jellelicht on GitHub (Jun 27, 2018). Original GitHub issue: https://github.com/semver/semver/issues/448 The current spec does not allow alphanumeric identifiers to have a numeric prefix part. The spec allows a pre-release to be composed of dot-separated identifiers, where identifiers are either alphanumeric or numeric identifiers. In my understanding, "1.2.3-731b" would be a valid semver, with "731b" being the alphanumeric identifier for the pre-release part. So either I am wrong (but the definition of 'alphanumeric identifier' could be clarified in the spec), or the current form of the BN grammar needs a tiny update.
Author
Owner

@FichteFoll commented on GitHub (Jun 27, 2018):

See https://github.com/semver/semver.org/issues/59.

TL;DR: 1.2.3-731b is a valid semver with a single alphanumeric pre-release identifier. The grammar currently only present in this repo (and not on the website) is being worked on.

<!-- gh-comment-id:400651181 --> @FichteFoll commented on GitHub (Jun 27, 2018): See https://github.com/semver/semver.org/issues/59. TL;DR: `1.2.3-731b` is a valid semver with a single alphanumeric pre-release identifier. The grammar currently only present in this repo (and not on the website) is being worked on.
Author
Owner

@jwdonahue commented on GitHub (Jul 12, 2018):

@jellelicht,

The current spec does not allow alphanumeric identifiers to have a numeric prefix part.

Where do you see that in the spec? To the best of my knowledge, numeric fields in prerelease tags are prohibited from having leading zeroes, but there's no such prohibition on alphanumeric fields. The relevant BN bits are:

<pre-release identifier> ::= <alphanumeric identifier>
                           | <numeric identifier>

<alphanumeric identifier> ::= <non-digit>
                            | <non-digit> <identifier characters>
                            | <identifier characters> <non-digit>
                            | <identifier characters> <non-digit> <identifier characters>

<numeric identifier> ::= "0"
                       | <positive digit>
                       | <positive digit> <digits>

<identifier character> ::= <digit>
                         | <non-digit>

<non-digit> ::= <letter>
              | "-"

Seems fairly clear to me and I don't see any conflict with the language in the spec. These are all valid prerelease tags:

-0xyz
-0
-231
-a123
-123456zyxwv

Does this clear it up for you, or am I missing something?

<!-- gh-comment-id:404633059 --> @jwdonahue commented on GitHub (Jul 12, 2018): @jellelicht, > The current spec does not allow alphanumeric identifiers to have a numeric prefix part. Where do you see that in the spec? To the best of my knowledge, numeric fields in prerelease tags are prohibited from having leading zeroes, but there's no such prohibition on alphanumeric fields. The relevant BN bits are: ``` <pre-release identifier> ::= <alphanumeric identifier> | <numeric identifier> <alphanumeric identifier> ::= <non-digit> | <non-digit> <identifier characters> | <identifier characters> <non-digit> | <identifier characters> <non-digit> <identifier characters> <numeric identifier> ::= "0" | <positive digit> | <positive digit> <digits> <identifier character> ::= <digit> | <non-digit> <non-digit> ::= <letter> | "-" ``` Seems fairly clear to me and I don't see any conflict with the language in the spec. These are all valid prerelease tags: -0xyz -0 -231 -a123 -123456zyxwv Does this clear it up for you, or am I missing something?
Author
Owner

@jellelicht commented on GitHub (Jul 13, 2018):

@jwdonahue I am not quite clear what exactly I had misunderstood, but thanks for the explanation anyway.

<!-- gh-comment-id:404869108 --> @jellelicht commented on GitHub (Jul 13, 2018): @jwdonahue I am not quite clear what exactly I had misunderstood, but thanks for the explanation anyway.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/semver#3042