about summary refs log tree commit diff
path: root/boot/lex.c
diff options
context:
space:
mode:
Diffstat (limited to 'boot/lex.c')
-rw-r--r--boot/lex.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/boot/lex.c b/boot/lex.c
index 52760e9..f09e5e3 100644
--- a/boot/lex.c
+++ b/boot/lex.c
@@ -97,6 +97,7 @@ enum Token_Kind
     TOKEN_WORD_SWITCH,
     TOKEN_WORD_RETURN,
     TOKEN_WORD_VAR,
+    TOKEN_WORD_LET,
     TOKEN_WORD_TYPE,
     TOKEN_WORD_VARIANT,
     TOKEN_WORD_CLASS,
@@ -200,6 +201,8 @@ token_kind_to_string(enum Token_Kind kind)
         return "WORD_RETURN";
     case TOKEN_WORD_VAR:
         return "WORD_VAR";
+    case TOKEN_WORD_LET:
+        return "WORD_LET";
     case TOKEN_WORD_TYPE:
         return "WORD_TYPE";
     case TOKEN_WORD_VARIANT:
@@ -407,6 +410,12 @@ token_can_begin_type(const struct Token* t)
 }
 
 bool
+token_can_begin_declaration(const struct Token* t)
+{
+    return token_is(t, TOKEN_WORD_VAR) || token_is(t, TOKEN_WORD_LET);
+}
+
+bool
 ascii_in_range(ascii c, ascii from, ascii to)
 {
     return c >= from && c <= to;
@@ -793,6 +802,8 @@ lexer_word_from_name(struct Lexer* l, struct String word_or_name)
         return TOKEN_WORD_RETURN;
     case 1662845996: // "var"
         return TOKEN_WORD_VAR;
+    case 860722406:
+        return TOKEN_WORD_LET;
     case 91700392: // "type"
         return TOKEN_WORD_TYPE;
     case 3267162257: // "variant"