strings handled as built-in struct, and added immutable keyword
This commit is contained in:
4
lexer.v
4
lexer.v
@@ -5,6 +5,7 @@ import term
|
||||
enum TokenType as u8 {
|
||||
kw_let
|
||||
kw_const
|
||||
kw_immutable
|
||||
type
|
||||
kw_if
|
||||
kw_else
|
||||
@@ -108,6 +109,7 @@ fn toktype_from_kw(kw string) TokenType {
|
||||
'true', 'false' {.boolean}
|
||||
'print' {.kw_print}
|
||||
'class' {.kw_class}
|
||||
'immutable' {.kw_immutable}
|
||||
else {.unknown}
|
||||
}
|
||||
}
|
||||
@@ -127,7 +129,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"
|
||||
"void", "int", "real", "bool", "string", "if", "else", "elif", "for", "break", "fn", "return", "let", "const", "true", "false", "print", "class", "immutable"
|
||||
].contains(str)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user