Enum Lexer.Token.Type
- java.lang.Object
-
- java.lang.Enum<Lexer.Token.Type>
-
- com.github.zafarkhaja.semver.expr.Lexer.Token.Type
-
- All Implemented Interfaces:
Stream.ElementType<Lexer.Token>
,java.io.Serializable
,java.lang.Comparable<Lexer.Token.Type>
- Enclosing class:
- Lexer.Token
static enum Lexer.Token.Type extends java.lang.Enum<Lexer.Token.Type> implements Stream.ElementType<Lexer.Token>
Valid token types.
-
-
Enum Constant Summary
Enum Constants Enum Constant Description AND
CARET
DOT
EOI
EQUAL
GREATER
GREATER_EQUAL
HYPHEN
LEFT_PAREN
LESS
LESS_EQUAL
NOT
NOT_EQUAL
NUMERIC
OR
RIGHT_PAREN
TILDE
WHITESPACE
WILDCARD
-
Field Summary
Fields Modifier and Type Field Description (package private) java.util.regex.Pattern
pattern
A pattern matching this type.
-
Constructor Summary
Constructors Modifier Constructor Description private
Type(java.lang.String regexp)
Constructs a token type with a regular expression for the pattern.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
isMatchedBy(Lexer.Token token)
Checks if the specified element matches this type.java.lang.String
toString()
Returns the string representation of this type.static Lexer.Token.Type
valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name.static Lexer.Token.Type[]
values()
Returns an array containing the constants of this enum type, in the order they are declared.
-
-
-
Enum Constant Detail
-
NUMERIC
public static final Lexer.Token.Type NUMERIC
-
DOT
public static final Lexer.Token.Type DOT
-
HYPHEN
public static final Lexer.Token.Type HYPHEN
-
EQUAL
public static final Lexer.Token.Type EQUAL
-
NOT_EQUAL
public static final Lexer.Token.Type NOT_EQUAL
-
GREATER
public static final Lexer.Token.Type GREATER
-
GREATER_EQUAL
public static final Lexer.Token.Type GREATER_EQUAL
-
LESS
public static final Lexer.Token.Type LESS
-
LESS_EQUAL
public static final Lexer.Token.Type LESS_EQUAL
-
TILDE
public static final Lexer.Token.Type TILDE
-
WILDCARD
public static final Lexer.Token.Type WILDCARD
-
CARET
public static final Lexer.Token.Type CARET
-
AND
public static final Lexer.Token.Type AND
-
OR
public static final Lexer.Token.Type OR
-
NOT
public static final Lexer.Token.Type NOT
-
LEFT_PAREN
public static final Lexer.Token.Type LEFT_PAREN
-
RIGHT_PAREN
public static final Lexer.Token.Type RIGHT_PAREN
-
WHITESPACE
public static final Lexer.Token.Type WHITESPACE
-
EOI
public static final Lexer.Token.Type EOI
-
-
Constructor Detail
-
Type
private Type(java.lang.String regexp)
Constructs a token type with a regular expression for the pattern.- Parameters:
regexp
- the regular expression for the pattern- See Also:
pattern
-
-
Method Detail
-
values
public static Lexer.Token.Type[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:for (Lexer.Token.Type c : Lexer.Token.Type.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
public static Lexer.Token.Type valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)- Parameters:
name
- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
java.lang.IllegalArgumentException
- if this enum type has no constant with the specified namejava.lang.NullPointerException
- if the argument is null
-
toString
public java.lang.String toString()
Returns the string representation of this type.- Overrides:
toString
in classjava.lang.Enum<Lexer.Token.Type>
- Returns:
- the string representation of this type
-
isMatchedBy
public boolean isMatchedBy(Lexer.Token token)
Checks if the specified element matches this type.- Specified by:
isMatchedBy
in interfaceStream.ElementType<Lexer.Token>
- Parameters:
token
- the element to be tested- Returns:
true
if the element matches this type orfalse
otherwise
-
-