java.lang.Object
java.lang.Record
technology.sola.script.tokenizer.Token
- Record Components:
type
- theTokenType
lexeme
- the text of the token in the source codeliteral
- the value of the token (ie String for strings and float for numbers)line
- the line number the token was found oncolumn
- the column number the token was found at
@NullMarked
public record Token(TokenType type, String lexeme, @Nullable Object literal, int line, int column)
extends Record
Token holds information about a recognized token that sola script understands.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionint
column()
Returns the value of thecolumn
record component.final boolean
Indicates whether some other object is "equal to" this one.final int
hashCode()
Returns a hash code value for this object.lexeme()
Returns the value of thelexeme
record component.int
line()
Returns the value of theline
record component.@Nullable Object
literal()
Returns the value of theliteral
record component.final String
toString()
Returns a string representation of this record class.type()
Returns the value of thetype
record component.
-
Constructor Details
-
Token
Creates an instance of aToken
record class.
-
-
Method Details
-
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared withObjects::equals(Object,Object)
; primitive components are compared with '=='. -
type
Returns the value of thetype
record component.- Returns:
- the value of the
type
record component
-
lexeme
Returns the value of thelexeme
record component.- Returns:
- the value of the
lexeme
record component
-
literal
Returns the value of theliteral
record component.- Returns:
- the value of the
literal
record component
-
line
public int line()Returns the value of theline
record component.- Returns:
- the value of the
line
record component
-
column
public int column()Returns the value of thecolumn
record component.- Returns:
- the value of the
column
record component
-