about summary refs log tree commit diff
path: root/boot/lex.c
diff options
context:
space:
mode:
authorMel <mel@rnrd.eu>2025-07-06 03:32:07 +0200
committerMel <mel@rnrd.eu>2025-07-06 03:32:07 +0200
commitebd176b8e7eb14060375a28d6ac50500d9d2c808 (patch)
tree6c79ac631b5b8a4c025c09940a4a0fb1c71dd129 /boot/lex.c
parent620d82a5e314a82784e02b4af387a67d53242149 (diff)
downloadcatskill-ebd176b8e7eb14060375a28d6ac50500d9d2c808.tar.zst
catskill-ebd176b8e7eb14060375a28d6ac50500d9d2c808.zip
Parse variadic parameters in function definitions
Signed-off-by: Mel <mel@rnrd.eu>
Diffstat (limited to 'boot/lex.c')
-rw-r--r--boot/lex.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/boot/lex.c b/boot/lex.c
index f450798..82d3567 100644
--- a/boot/lex.c
+++ b/boot/lex.c
@@ -123,6 +123,7 @@ enum Token_Kind
     TOKEN_AMPERSAND,
     TOKEN_DOT,
     TOKEN_DOT_DOT,
+    TOKEN_DOT_DOT_DOT,
     TOKEN_BANG,
     TOKEN_QUESTION,
     TOKEN_PERCENT,
@@ -244,6 +245,8 @@ token_kind_to_string(enum Token_Kind kind)
         return "DOT";
     case TOKEN_DOT_DOT:
         return "DOT_DOT";
+    case TOKEN_DOT_DOT_DOT:
+        return "DOT_DOT_DOT";
     case TOKEN_BANG:
         return "BANG";
     case TOKEN_QUESTION:
@@ -618,10 +621,12 @@ lexer_symbol_token(struct Lexer* l, struct Lexer_Char current)
         if (a.got_match) RET{ TOKEN_ASSIGN_AMPERSAND, 2 };
         RET{ TOKEN_AMPERSAND, 1 };
     }
-    case '.':
-        a = lexer_match_char(l, '.');
+    case '.': {
+        lexer_match_chars(l, '.', '.', &a, &b);
+        if (a.got_match && b.got_match) RET{ TOKEN_DOT_DOT_DOT, 3 };
         if (a.got_match) RET{ TOKEN_DOT_DOT, 2 };
         RET{ TOKEN_DOT, 1 };
+    }
     case '!': {
         a = lexer_match_char(l, '=');
         if (a.got_match) RET{ TOKEN_NOT_EQUAL, 2 };