From ebd176b8e7eb14060375a28d6ac50500d9d2c808 Mon Sep 17 00:00:00 2001 From: Mel Date: Sun, 6 Jul 2025 03:32:07 +0200 Subject: Parse variadic parameters in function definitions Signed-off-by: Mel --- boot/lex.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'boot/lex.c') 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 }; -- cgit 1.4.1