bind expression (:=) instead of let
This commit is contained in:
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user