bind expression (:=) instead of let
Some checks failed
Build / build (push) Successful in 10m26s
Test / build (push) Failing after 16m44s

This commit is contained in:
Chuck Smith
2024-03-21 17:43:03 -04:00
parent 66d5453ecc
commit 6282075e66
36 changed files with 425 additions and 583 deletions

View File

@@ -134,7 +134,14 @@ func (l *Lexer) NextToken() token.Token {
case ']':
tok = newToken(token.RBRACKET, l.ch)
case ':':
tok = newToken(token.COLON, l.ch)
if l.peekChar() == '=' {
ch := l.ch
l.readChar()
literal := string(ch) + string(l.ch)
tok = token.Token{Type: token.BIND, Literal: literal}
} else {
tok = newToken(token.COLON, l.ch)
}
default:
if isLetter(l.ch) {
tok.Literal = l.readIdentifier()