Implemented extern functions

This commit is contained in:
Eduard Urbach 2025-02-12 00:04:30 +01:00
parent 38b573085e
commit 4803b81845
Signed by: eduard
GPG key ID: 49226B848C78F6C8
24 changed files with 304 additions and 169 deletions

View file

@ -66,6 +66,7 @@ const (
___KEYWORDS___ // <keywords>
Assert // assert
Else // else
Extern // extern
If // if
Import // import
Loop // loop

View file

@ -25,13 +25,14 @@ func TestFunction(t *testing.T) {
}
func TestKeyword(t *testing.T) {
tokens := token.Tokenize([]byte("assert if import else loop return struct switch"))
tokens := token.Tokenize([]byte("assert if import else extern loop return struct switch"))
expected := []token.Kind{
token.Assert,
token.If,
token.Import,
token.Else,
token.Extern,
token.Loop,
token.Return,
token.Struct,

View file

@ -19,6 +19,8 @@ func identifier(tokens List, buffer []byte, i Position) (List, Position) {
kind = If
case "else":
kind = Else
case "extern":
kind = Extern
case "import":
kind = Import
case "loop":