referencing and methods

This commit is contained in:
uan
2026-02-07 19:14:48 +01:00
parent 005828cec2
commit a3b978a09d
5 changed files with 269 additions and 39 deletions

View File

@@ -16,6 +16,8 @@ enum TokenType as u8 {
kw_return
kw_print
kw_class
kw_ref
kw_deref
integer
real
boolean
@@ -126,6 +128,8 @@ fn toktype_from_kw(kw string) TokenType {
'print' {.kw_print}
'class' {.kw_class}
'immutable' {.kw_immutable}
'ref' {.kw_ref}
'deref' {.kw_deref}
else {.unknown}
}
}
@@ -145,7 +149,7 @@ fn is_real(str string) bool {
fn is_keyword(str string) bool {
return [
"void", "int", "real", "bool", "string", "if", "else", "elif", "while", "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", "ref", "deref"
].contains(str)
}