This commit is contained in:
uan
2026-02-04 22:35:26 +01:00
parent 6c9679ff57
commit 3eaeefcd4c
3 changed files with 19 additions and 14 deletions

View File

@@ -4,6 +4,7 @@ import term
enum TokenType as u8 {
kw_let
kw_const
type
kw_if
kw_else
@@ -92,6 +93,7 @@ fn toktype_from_delimiter(delimiter string) TokenType {
fn toktype_from_kw(kw string) TokenType {
return match kw {
'let' {.kw_let}
'const' {.kw_const}
'void', 'real', 'bool', 'int' {.type}
'if' {.kw_if}
'else' {.kw_else}
@@ -116,7 +118,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", "true", "false", "print"
"void", "int", "real", "bool", "if", "else", "for", "break", "fn", "return", "let", "const", "true", "false", "print"
].contains(str)
}