Skip to content
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

Accept both loose and strict parsing of versionnumber #9

Open
o314 opened this issue Nov 30, 2022 · 1 comment
Open

Accept both loose and strict parsing of versionnumber #9

o314 opened this issue Nov 30, 2022 · 1 comment

Comments

@o314
Copy link

o314 commented Nov 30, 2022

It could be useful to accept parsing of versionnumber eitheir more strictly, or more loosely ;
instead of only parsing more loosely as for now.

I have just spent hours debugging a mismatch between conda and julia around version
that could have been fixed very earlier if strict mode was reinforceable

Here are some regexes that could help for that

ver_strict_re = 
    r"""^
    (?<major>\d+).(?<minor>\d+).(?<patch>\d+)                   # core
    (-(?<pre_rel>[\d\w-]+(.[\d\w-]+)*))?                        # pre_rel::qid
    (\+(?<build>[\d\w-]+(.[\d\w-]+)*))?                         # build::qid
    $
    """x

ver_semistrict_re = 
    r"""^
    (?<major>\d+)(.(?<minor>\d+)(.(?<patch>\d+))?)?             # core
    (-(?<pre_rel>[\d\w-]+(.[\d\w-]+)*))?                        # pre_rel::qid
    (\+(?<build>[\d\w-]+(.[\d\w-]+)*))?                         # build::qid
    $
    """x

built around the inlining of

qid = r"[\d\w-]+(.[\d\w-]+)*"
id = r"[\d\w-]+" # approx

Please note that the id, qid are only an approximation of semver ones today

@stevengj
Copy link
Collaborator

stevengj commented Dec 3, 2022

If you want strict mode you can just do VersionNumber(string), no? The whole point of vparse is to supplement this with something looser.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants