mirror of
https://github.com/Kugelschieber/asl.git
synced 2026-01-18 12:00:25 +00:00
Small improvements to for.
This commit is contained in:
@@ -85,7 +85,7 @@ func Tokenize(code []byte) []Token {
|
|||||||
|
|
||||||
tokens = append(tokens, Token{string(c)})
|
tokens = append(tokens, Token{string(c)})
|
||||||
token = ""
|
token = ""
|
||||||
} else if stringArrayContains(keywords, strings.ToLower(token)) && !isIdentifierCharacter(c) {
|
} else if stringArrayContains(strings.ToLower(token)) && !isIdentifierCharacter(c) {
|
||||||
tokens = append(tokens, Token{token})
|
tokens = append(tokens, Token{token})
|
||||||
token = ""
|
token = ""
|
||||||
} else if !byteArrayContains(whitespace, c) {
|
} else if !byteArrayContains(whitespace, c) {
|
||||||
@@ -179,9 +179,9 @@ func byteArrayContains(haystack []byte, needle byte) bool {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Checks if a byte array (string) contains a string delimeter.
|
// Checks if a byte array (string) contains a string delimeter.
|
||||||
func stringArrayContains(haystack []string, needle string) bool {
|
func stringArrayContains(needle string) bool {
|
||||||
for i := range haystack {
|
for i := range keywords {
|
||||||
if haystack[i] == needle {
|
if keywords[i] == needle {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user