aboutsummaryrefslogtreecommitdiffstats
path: root/src/lexer.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lexer.c')
-rw-r--r--src/lexer.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/lexer.c b/src/lexer.c
index 36a5636..2d2b6fc 100644
--- a/src/lexer.c
+++ b/src/lexer.c
@@ -23,11 +23,13 @@ typedef enum TokenKind {
23 // Keywords. 23 // Keywords.
24 TOK_BREAK, // break 24 TOK_BREAK, // break
25 TOK_CASE, // case 25 TOK_CASE, // case
26 TOK_COND, // match
26 TOK_CONTINUE, // continue 27 TOK_CONTINUE, // continue
28 TOK_ELSE, // else
29 TOK_ENUM, // enum
27 TOK_FALSE, // false 30 TOK_FALSE, // false
28 TOK_FUN, // fun 31 TOK_FUN, // fun
29 TOK_IF, // if 32 TOK_IF, // if
30 TOK_ELSE, // else
31 TOK_LET, // let 33 TOK_LET, // let
32 TOK_MATCH, // match 34 TOK_MATCH, // match
33 TOK_NIL, // nil 35 TOK_NIL, // nil
@@ -93,8 +95,10 @@ Str token_str[] = {
93 // Keywords. 95 // Keywords.
94 [TOK_BREAK] = cstr("BREAK"), 96 [TOK_BREAK] = cstr("BREAK"),
95 [TOK_CASE] = cstr("CASE"), 97 [TOK_CASE] = cstr("CASE"),
98 [TOK_COND] = cstr("COND"),
96 [TOK_CONTINUE] = cstr("CONTINUE"), 99 [TOK_CONTINUE] = cstr("CONTINUE"),
97 [TOK_ELSE] = cstr("ELSE"), 100 [TOK_ELSE] = cstr("ELSE"),
101 [TOK_ENUM] = cstr("ENUM"),
98 [TOK_FALSE] = cstr("FALSE"), 102 [TOK_FALSE] = cstr("FALSE"),
99 [TOK_FUN] = cstr("FUN"), 103 [TOK_FUN] = cstr("FUN"),
100 [TOK_IF] = cstr("IF"), 104 [TOK_IF] = cstr("IF"),
@@ -540,11 +544,17 @@ scan_token(Scanner *scanner) {
540 if (str_has_prefix(val, cstr("continue"))) { 544 if (str_has_prefix(val, cstr("continue"))) {
541 return emit_token(current, scanner, TOK_CONTINUE); 545 return emit_token(current, scanner, TOK_CONTINUE);
542 } 546 }
547 if (str_has_prefix(val, cstr("cond"))) {
548 return emit_token(current, scanner, TOK_COND);
549 }
543 } break; 550 } break;
544 case 'e': { 551 case 'e': {
545 if (str_has_prefix(val, cstr("else"))) { 552 if (str_has_prefix(val, cstr("else"))) {
546 return emit_token(current, scanner, TOK_ELSE); 553 return emit_token(current, scanner, TOK_ELSE);
547 } 554 }
555 if (str_has_prefix(val, cstr("enum"))) {
556 return emit_token(current, scanner, TOK_ENUM);
557 }
548 } break; 558 } break;
549 case 'f': { 559 case 'f': {
550 if (str_has_prefix(val, cstr("false"))) { 560 if (str_has_prefix(val, cstr("false"))) {