GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — [BUG] BNF does not match the implementation · Issue #665 · npm/node-semver

[BUG] BNF does not match the implementation #665

New issue
Copy link
New issue
Copy link
Closed
#846
Closed
[BUG] BNF does not match the implementation#665
#846
Copy link
Labels
Bugthing that needs fixingNeeds Triageneeds an initial review

Description

@ShuiRuTian
ShuiRuTian
opened on Dec 6, 2023
Issue body actions

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

semver.valid('1.2.3-00') // 'null'
semver.valid('1.2.3+00') // '1.2.3'

However, according to the BNF

qualifier  ::= ( '-' pre )? ( '+' build )?
pre        ::= parts
build      ::= parts
parts      ::= part ( '.' part ) *
part       ::= nr | [-0-9A-Za-z]+

pre and build are just the same.

Expected Behavior

The behavior of program is correct, but BNF is not.

We need to update the BNF form.

Steps To Reproduce

No response

Environment

  • npm: 9.9.1
  • Node: v18.17.0
  • OS: windows

Activity

  1. ShuiRuTian
    added
    Bugthing that needs fixing
    Needs Triageneeds an initial review
    on Dec 6, 2023
  2. ShuiRuTian
    changed the title [-][BUG] <title> BNF does not match the implmentation[/-] [+][BUG] BNF does not match the implementation[/+] on Dec 6, 2023
  3. mbtools commented on Feb 1, 2024

    @mbtools
    mbtools
    on Feb 1, 2024
    Contributor
    More actions

    Agree. Numeric parts of a pre-release must not have leading zero. Also the part definition isn't BNF but a regex.

    How about this?

    alphanum   ::= ( ['0'-'9'] | ['A'-'Z'] | ['a'-'z'] | '-' ) +
    pre        ::= ( nr | alphanum ) ( '.' ( nr | alphanum ) ) *
    build      ::= alphanum ( '.' alphanum ) *
    

    PS: This isn't perfect since alphanum could be a just numbers starting with a zero but the definition makes the difference between pre-release and build much clearer.

  4. ShuiRuTian commented on Feb 22, 2024

    @ShuiRuTian
    ShuiRuTian
    on Feb 22, 2024
    Author
    More actions

    Sorry for the late response. I was on Chinese Spring Festival.

    It looks good to me!

    And just out of curious, why we did not keep it same with(or close to) Semver?

  5. mbtools commented on Feb 25, 2024

    @mbtools
    mbtools
    on Feb 25, 2024
    Contributor
    More actions

    Because it was invented 10 years ago. I'm working on a update to a formal EBNF that will settle several issues (PR after my vacation)

    Reacted by Song Gao and Gar
  6. abhu85
    added a commit that references this issue on Feb 24, 2026

    docs: fix BNF grammar to distinguish prerelease from build identifiers

    This issue will close once commit 3106a1d is merged into the 'main' branch.
    3106a1d
  7. wraithgar
    closed this as completedin #846on Feb 24, 2026
  8. wraithgar
    added a commit that references this issue on Feb 24, 2026

    docs: fix BNF grammar to distinguish prerelease from build identifiers (

    This issue will close once commit 37776c3 is merged into the 'main' branch.
    37776c3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Bugthing that needs fixingNeeds Triageneeds an initial review

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402775 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.