Added short form for variable definitions

This commit is contained in:
2024-06-14 18:03:54 +02:00
parent 6de8ac7b9f
commit 65791ea5a1
6 changed files with 76 additions and 33 deletions

View File

@ -70,9 +70,6 @@ func Tokenize(buffer []byte) List {
case ']':
tokens = append(tokens, Token{ArrayEnd, i, arrayEndBytes})
case '=', ':', '+', '-', '*', '/', '<', '>', '!':
tokens = append(tokens, Token{Operator, i, buffer[i : i+1]})
// Separator
case ',':
tokens = append(tokens, Token{Separator, i, separatorBytes})
@ -122,6 +119,24 @@ func Tokenize(buffer []byte) List {
continue
}
// Operators
if isOperator(buffer[i]) {
position := i
i++
for i < len(buffer) && isOperator(buffer[i]) {
i++
}
tokens = append(tokens, Token{
Operator,
position,
buffer[position:i],
})
continue
}
}
i++