Created addToken function
This commit is contained in:
parent
22ee24e8ae
commit
94aca70c09
@ -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));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user