Improved file structure

This commit is contained in:
Eduard Urbach 2024-06-05 15:51:05 +02:00
parent b6400cd77e
commit c0f399df7f
Signed by: eduard
GPG key ID: 49226B848C78F6C8
18 changed files with 106 additions and 378 deletions

6
src/token/Keywords.go Normal file
View file

@ -0,0 +1,6 @@
package token
// Keywords defines the keywords used in the language.
var Keywords = map[string]bool{
"return": true,
}

View file

@ -1,7 +1,5 @@
package token
import "git.akyoto.dev/cli/q/src/keywords"
// Pre-allocate these byte buffers so we can re-use them
// instead of allocating a new buffer every time.
var (
@ -87,7 +85,7 @@ func Tokenize(buffer []byte) List {
buffer[position:i],
}
if keywords.All[string(token.Bytes)] {
if Keywords[string(token.Bytes)] {
token.Kind = Keyword
}