Created addToken function
This commit is contained in:
@@ -51,4 +51,9 @@ class Scanner {
|
|||||||
private void addToken(TokenType type) {
|
private void addToken(TokenType type) {
|
||||||
addToken(type, null);
|
addToken(type, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void addToken(TokenType type, Object literal) {
|
||||||
|
String text = source.substring(start, current);
|
||||||
|
tokens.add(new Token(type, text, literal, line));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user