Constructor
new Token(type, lexeme, literal, line)
Creates a new token.
Parameters:
Name | Type | Description |
---|---|---|
type |
TokenType | This tokens type. Used by the |
lexeme |
string | Section of source code this token was parsed from. |
literal |
string | number | undefined | If a token represents a literal, this will be the extracted value; otherwise undefined. |
line |
number | Identifies which line of the source code this token was parsed from. |
Members
lexeme :string
Type:
- string
line :number
Type:
- number
literal :string|number|undefined
Type:
- string | number | undefined
type :TokenType
Type:
Methods
toString() → {string}
Returns a string representing the token.
Returns:
A string representing the object.
- Type
- string