while loops

This commit is contained in:
uan
2026-02-07 15:48:59 +01:00
parent 58f0dfa969
commit 9d26256023
5 changed files with 47 additions and 7 deletions

View File

@@ -10,7 +10,7 @@ enum TokenType as u8 {
kw_if
kw_else
kw_elif
kw_for
kw_while
kw_break
kw_fn
kw_return
@@ -106,7 +106,7 @@ fn toktype_from_kw(kw string) TokenType {
'if' {.kw_if}
'else' {.kw_else}
'elif' {.kw_elif}
'for' {.kw_for}
'while' {.kw_while}
'break' {.kw_break}
'fn' {.kw_fn}
'return' {.kw_return}
@@ -133,7 +133,7 @@ fn is_real(str string) bool {
fn is_keyword(str string) bool {
return [
"void", "int", "real", "bool", "string", "if", "else", "elif", "for", "break", "fn", "return", "let", "const", "true", "false", "print", "class", "immutable"
"void", "int", "real", "bool", "string", "if", "else", "elif", "while", "break", "fn", "return", "let", "const", "true", "false", "print", "class", "immutable"
].contains(str)
}