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

Can't parse certain wildcard ranges #45

Closed
Ziaunys opened this issue Oct 23, 2018 · 2 comments
Closed

Can't parse certain wildcard ranges #45

Ziaunys opened this issue Oct 23, 2018 · 2 comments

Comments

@Ziaunys
Copy link

Ziaunys commented Oct 23, 2018

Using the latest version 0.9.0 I am unable to parse certain wildcard ranges such as "5.x.x". Specifically, the wildcard specified in the patch field is a problem for the parser. Even though ranges like this are redundant they should still be valid syntax. Currently attempting to parse such a range will result in the following exception:

Unexpected token 'DOT(.) at position 3', expecting '[EOI(^(?!))]'
	at com.github.zafarkhaja.semver.expr.ExpressionParser.consumeNextToken(ExpressionParser.java:507)
	at com.github.zafarkhaja.semver.expr.ExpressionParser.parse(ExpressionParser.java:88)
	at com.github.zafarkhaja.semver.expr.ExpressionParser.parse(ExpressionParser.java:43)

I did some debugging and found that the exception is thrown because it assumes that after parsing the wildcard in the "minor" field it should then find an EOI token. This isn't the case if parsing a version range like "5.x.x". Could we just allow version ranges like this? I can't just easily change the version ranges I'm working with because they're externally defined.

heisluft added a commit to AntiLaby/jsemver that referenced this issue Mar 24, 2019
@zafarkhaja
Copy link
Owner

zafarkhaja commented Apr 15, 2023

Hello Eric! Sorry it took me this long to get back to you.

Most likely it's not relevant to you anymore, but just in case and for future reference I'm going to respond anyway :)

The current wildcard grammar is as follows

<wildcard-range> ::= <wildcard>
                   | <major> "." <wildcard>
                   | <major> "." <minor> "." <wildcard>

so it will have to change in order to accommodate your needs.

I'm going to investigate if this can be done easily without ending up writing a whole new parser.

@zafarkhaja
Copy link
Owner

Closing this issue in favor of #70, the progress can be followed from there.

@zafarkhaja zafarkhaja closed this as not planned Won't fix, can't repro, duplicate, stale Jan 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants