Implemented for loops
This commit is contained in:
parent
ac03657307
commit
d26bf9d1a9
16 changed files with 142 additions and 120 deletions
|
@ -69,6 +69,7 @@ const (
|
|||
Const // const
|
||||
Else // else
|
||||
Extern // extern
|
||||
For // for
|
||||
If // if
|
||||
Import // import
|
||||
Loop // loop
|
||||
|
|
|
@ -25,15 +25,16 @@ func TestFunction(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestKeyword(t *testing.T) {
|
||||
tokens := token.Tokenize([]byte("assert const if import else extern loop return struct switch"))
|
||||
tokens := token.Tokenize([]byte("assert const else extern if import for loop return struct switch"))
|
||||
|
||||
expected := []token.Kind{
|
||||
token.Assert,
|
||||
token.Const,
|
||||
token.If,
|
||||
token.Import,
|
||||
token.Else,
|
||||
token.Extern,
|
||||
token.If,
|
||||
token.Import,
|
||||
token.For,
|
||||
token.Loop,
|
||||
token.Return,
|
||||
token.Struct,
|
||||
|
|
|
@ -23,6 +23,8 @@ func identifier(tokens List, buffer []byte, i Position) (List, Position) {
|
|||
kind = Else
|
||||
case "extern":
|
||||
kind = Extern
|
||||
case "for":
|
||||
kind = For
|
||||
case "import":
|
||||
kind = Import
|
||||
case "loop":
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue