Class SimpleToken
java.lang.Object
org.antlr.v4.runtime.CommonToken
com.puppycrawl.tools.checkstyle.grammar.SimpleToken
- All Implemented Interfaces:
Serializable,org.antlr.v4.runtime.Token,org.antlr.v4.runtime.WritableToken
A simple wrapper for ANTLR
Token that provides a proper equals(Object)
and hashCode() implementation based on the token's type and text.
This is useful because ANTLR's default CommonToken does not override
equals, It compares references.
- See Also:
-
Field Summary
FieldsFields inherited from class org.antlr.v4.runtime.CommonToken
channel, charPositionInLine, EMPTY_SOURCE, index, line, source, start, stop, text, typeFields inherited from interface org.antlr.v4.runtime.Token
DEFAULT_CHANNEL, EOF, EPSILON, HIDDEN_CHANNEL, INVALID_TYPE, MIN_USER_CHANNEL_VALUE, MIN_USER_TOKEN_TYPE -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivateSimpleToken(org.antlr.v4.runtime.Token token) Constructs a new instance from an existing ANTLRToken. -
Method Summary
Modifier and TypeMethodDescriptionbooleanstatic SimpleTokenfrom(org.antlr.v4.runtime.Token token) Creates a new instance from an existing ANTLRToken.inthashCode()Methods inherited from class org.antlr.v4.runtime.CommonToken
getChannel, getCharPositionInLine, getInputStream, getLine, getStartIndex, getStopIndex, getText, getTokenIndex, getTokenSource, getType, setChannel, setCharPositionInLine, setLine, setStartIndex, setStopIndex, setText, setTokenIndex, setType, toString, toString
-
Field Details
-
serialVersionUID
- See Also:
-
-
Constructor Details
-
SimpleToken
Constructs a new instance from an existing ANTLRToken.- Parameters:
token- the ANTLR token to wrap
-
-
Method Details