diff options
Diffstat (limited to 'src/com/craftinginterpreters/lox/Token.java')
-rw-r--r-- | src/com/craftinginterpreters/lox/Token.java | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/com/craftinginterpreters/lox/Token.java b/src/com/craftinginterpreters/lox/Token.java new file mode 100644 index 0000000..84762a4 --- /dev/null +++ b/src/com/craftinginterpreters/lox/Token.java @@ -0,0 +1,19 @@ +package com.craftinginterpreters.lox; + +class Token { + final TokenType type; + final String lexeme; + final Object literal; + final int line; + + Token(TokenType type, String lexeme, Object literal, int line) { + this.type = type; + this.lexeme = lexeme; + this.literal = literal; + this.line = line; + } + + public String toString() { + return type + " " + lexeme + " " + literal; + } +} |