Created addToken function

This commit is contained in:
Michael Thomson 2025-04-09 20:25:41 +00:00
parent 22ee24e8ae
commit 94aca70c09

View File

@ -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));
}
} }