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
version: add new Version::Parser
class
#10378
version: add new Version::Parser
class
#10378
Conversation
Review period will end on 2021-01-21 at 22:58:36 UTC. |
adc7544
to
568fc86
Compare
Version::Parser
class
Review period ended. |
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.
Yeh, that's dramatically cleaner, nice work!
|
||
class Version | ||
# @api private | ||
class Parser |
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.
Any unit tests for these would be lovely but non-blocking.
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.
👏🏻 ❤️
brew style
with your changes locally?brew typecheck
with your changes locally?brew tests
with your changes locally?brew man
locally and committed any changes?This PR adds four new classes for parsing version strings from
Pathname
s:Parser
,RegexParser
,UrlParser
, andStemParser
Parser
is the base abstract class and currently does nothing; all it contains is an abstractparse
method.RegexParser
is a sub-class ofParser
and uses regular expressions to extract version strings fromPathname
s.RegexParser
must implement theprocess_spec
method.block
that is called to finalize the parsed version string; this is used for Boost version styles to replace underscores (_
) with dots (.
)UrlParser
is a sub-class ofRegexParser
that parses the fullPathname
(i.e. URL) string.StemParser
is a sub-class ofRegexParser
that only parses the stem of thePathname
(i.e. the base file name)