-
Notifications
You must be signed in to change notification settings - Fork 92
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
Rewrite semver parsing #1036
Open
andreypopp
wants to merge
26
commits into
master
Choose a base branch
from
andreypopp/semver
base: master
Could not load branches
Branch not found: {{ refName }}
Could not load tags
Nothing to show
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Rewrite semver parsing #1036
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
andreypopp
force-pushed
the
andreypopp/semver
branch
from
January 4, 2020 22:12
cb91808
to
a084cfc
Compare
I think this is ready for review. I've ported subset of the test suite from node-semver and made it pass. Before merging I still want to check parsers on an npm metadata dump. |
ManasJayanth
approved these changes
Jan 9, 2020
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I could only take a shallow look. Looks amazing! Very nice packaged (and tested)
This simplifies both lexing and parsing definitions. Though I've did a hack with backtracking lexer position.
Seen at https://github.com/facebook/reason/blob/master/src/reason-parser/reason_declarative_lexer.mll#L180, thanks @anmonteiro for the hint and whoever implemented this in Reason.
andreypopp
force-pushed
the
andreypopp/semver
branch
from
January 13, 2020 21:56
27458eb
to
4513b1a
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR rewrites semver version/formula handling from ad-hoc/angstrom parsers to ocamllex/menhir.
Why:
Maintaining menhir grammar specifications is easier than ad-hoc parsers and menhor provides us with location info (something angstrom lacks by design) so we also going to get better error messages.
We can get rid of some 3rd party dependencies eventually (menhir parsers can be "ejected")
The AST for formulas keeps more info now which might be handy later for programmatic modifications of
package.json
(bump ranges and so on).I'm introducing a new
semver
library here which I want to promote to a package later (we are going tolink-dev:
it into esy but it can be also released separately).Before merging this I plan to test it on a dump of npm registry metadata to make sure parser can handle all the variety.