Let’s first review what a lexeme is:
The lexemes are the raw substrings of the source code.
Then the structure of a token:
class Token {
final TokenType type;
final String lexeme;
final Object literal;
public String toString() {
return type + " " + lexeme + " " + literal;
}
}
In the case of “NUMBER 42.40
42.4”, the lexeme is "42.40"
. It is just a raw string from the source code, and you don’t need to change it in any way:
Does this make sense?