Skip to content

Can't parse certain wildcard ranges #45

Description

@Ziaunys

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.

Metadata

Metadata

Assignees

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions