Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.
Sign upSupport parsing range sets #22
Comments
This was referenced Oct 21, 2017
steveklabnik
added
the
enhancement
label
Nov 24, 2017
This comment has been minimized.
This comment has been minimized.
|
Hey, I'm playing around with rewriting the parser for semver as a simple lexer + recursive-descent parser here: The rationale is:
The way I'm doing it would (probably) also permit swapping out the parser for an LR(1) parser generated by lalrpop. Please note that this is only an experiment that I've spent a couple of hours playing around with. I'm at the stage where I'd like to get feedback if this is something desirable for this project or not. |
This comment has been minimized.
This comment has been minimized.
|
Neat! What mostly matters to this project is:
I'm not really particularly tied to internals other than those things. |
This comment has been minimized.
This comment has been minimized.
|
Thanks. The implementation is now feature complete according to the tests available. A minor benchmark seems to indicate that it has a slight edge over the current approach, probably because most decisions can be made using a single pass and only one token of lookahead. More importantly there's probably no significant regression (all though this hasn't been rigorously tested):
There are two improvements I'd like to accomplish with the current parser at some point:
|
udoprog
referenced this issue
Nov 26, 2017
Merged
Introduce a recursive-descent parser for ranges and comparators #34
This comment has been minimized.
This comment has been minimized.
|
I merged this in, so I think this is good now? |
KodrAus commentedOct 21, 2017
•
edited
The npm
semverpackage supports parsing sets of versions separated by some operator.It would be great if
semver_parseralso supportedVersionReq(what npm callsComparator) ranges where the versions are separated by:||for logicalorrangesandrangesAre there any others in the
npmpackage we should also support?I think this will need more discussion if we want to produce mentoring instructions someone can use to implement it. At least we should nail down exactly what we want to support on top of what
semver_parseralready does.Mentoring instructions
Leave a comment here on the thread and we'll work out how to get started.