struct -> class

This commit is contained in:
uan
2026-02-05 19:40:59 +01:00
parent 0d5cc35b5a
commit 5af769acc2
4 changed files with 86 additions and 56 deletions

View File

@@ -13,7 +13,7 @@ enum TokenType as u8 {
kw_fn
kw_return
kw_print
kw_struct
kw_class
integer
real
boolean
@@ -104,7 +104,7 @@ fn toktype_from_kw(kw string) TokenType {
'return' {.kw_return}
'true', 'false' {.boolean}
'print' {.kw_print}
'struct' {.kw_struct}
'class' {.kw_class}
else {.unknown}
}
}
@@ -120,7 +120,7 @@ fn is_real(str string) bool {
fn is_keyword(str string) bool {
return [
"void", "int", "real", "bool", "if", "else", "for", "break", "fn", "return", "let", "const", "true", "false", "print", "struct"
"void", "int", "real", "bool", "if", "else", "for", "break", "fn", "return", "let", "const", "true", "false", "print", "class"
].contains(str)
}