begin variables

This commit is contained in:
Robin 2025-02-02 21:31:56 +01:00
parent 0692729b40
commit 1d70a700c9
3 changed files with 12 additions and 4 deletions

View File

@ -65,6 +65,8 @@ func (l *Lexer) NextToken() token.Token {
switch l.ch {
case ';':
tok = l.newToken(token.Semicolon)
case ':':
tok = l.newToken(token.Colon)
case '=':
if l.peekByte() == '=' {
pos := l.position

13
test.tt
View File

@ -1,6 +1,11 @@
fn main() = {
if 3 == 2 {
if 3 == 3 in 3
else 4
} else 2
hi: i64 = 4;
if hi == 2 {
hi = 3
} else {
hi = 2
}
hi
};

View File

@ -32,6 +32,7 @@ const (
Int TokenType = "INT"
Semicolon TokenType = ";"
Colon TokenType = ":"
Equal TokenType = "="
OpenParen TokenType = "("
CloseParen TokenType = ")"