code: public IVersionRange getRange(String vstring) throws InvalidRangeException
    {
      if (vstring == null || vstring.isEmpty()) {
        if (strict) {
          throw new InvalidRangeException("Cannot have an empty version");
        } else {
          IVersion version = new NamedVersion("");
          return new VersionSet(version);
        }
      }
      try {
        InputStream stream = new ByteArrayInputStream(vstring.getBytes(StandardCharsets.UTF_8));
        ANTLRInputStream input = new ANTLRInputStream(stream);
  
        VersionErrorListener errorListener = new VersionErrorListener();
  
        VersionLexer lexer = new VersionLexer(input);
        lexer.removeErrorListeners();
        lexer.addErrorListener(errorListener);
  
        CommonTokenStream tokens = new CommonTokenStream(lexer);
  
        VersionParser parser = new VersionParser(tokens);
  
        parser.addErrorListener(errorListener);
  
        RangeContext context = parser.range();
  
        ParseTreeWalker walker = new ParseTreeWalker();
        VersionListener listener = new VersionListener(strict);
        walker.walk(listener, context);
  
        IVersionRange range = listener.getRange();
        if (errorListener.hasErrors()) {
          if (strict) {
            throw new InvalidRangeException("Parse errors on " + vstring);
          }
          range.setHasErrors(true);
        }
        return range;
      }
      catch (EmptyStackException e) {
        if (strict) {
          throw new InvalidRangeException(e);
        }
        System.err.println("ERROR: Could not parse: " + vstring);
      }
      catch (InvalidRangeRuntimeException e) {
        // These are always critical. They indicate a fundamental problem with the version range.
        throw new InvalidRangeException(e.getMessage(), e);
      }
      catch (Exception e) {
        // Parse errors and wot not will come here
        if (strict) {
          throw new InvalidRangeException(e);
        }
        System.err.println("ERROR: Could not parse: " + vstring);
      }
  
      // Fall back to a named version
      IVersion version = new NamedVersion(vstring);
      return new VersionSet(version);
    }
docs: Get a version range