Skip to content

Package io.github.qishr.cascara.common.semver

Class Tokenizer

java.lang.Object
        io.github.qishr.cascara.common.semver.Tokenizer


public class Tokenizer

Utility class to convert a NPM requirement string into a list of tokens.

Nested Class Summary

Modifier and Type Class Description
protected static io.github.qishr.cascara.common.semver.Tokenizer.Token A token in a requirement string.

Constructor Summary

Constructor Description
Tokenizer()

Method Summary

Modifier and Type Method Description
protected static List<Token> tokenize(String requirement, SemVerType type) Takes a NPM requirement string and creates a list of tokens by performing 3 operations: - If the token is a version, it will add the version string - If the token is an operator, it will add the operator - It will insert missing "AND" operators for ranges

Method Details

tokenize

protected static List<Token> tokenize(String requirement, SemVerType type)

Takes a NPM requirement string and creates a list of tokens by performing 3 operations: - If the token is a version, it will add the version string - If the token is an operator, it will add the operator - It will insert missing "AND" operators for ranges

Parameters:

requirement - the requirement string

type - the version system used when tokenizing the requirement

Returns:

the list of tokens