From 1aef923b312f2bc9c0963381eae8619c187081c6 Mon Sep 17 00:00:00 2001 From: Mel Date: Thu, 28 May 2026 00:36:13 +0200 Subject: Use semicolon tokens as statement separators Signed-off-by: Mel --- boot/lex.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'boot/lex.c') diff --git a/boot/lex.c b/boot/lex.c index e585e1a..6c3e86f 100644 --- a/boot/lex.c +++ b/boot/lex.c @@ -53,6 +53,7 @@ enum Token_Kind TOKEN_SQUARE_CLOSE, TOKEN_COMMA, + TOKEN_SEMICOLON, TOKEN_AMPERSAND, TOKEN_DOT, TOKEN_DOT_DOT, @@ -176,6 +177,8 @@ token_kind_to_string(enum Token_Kind kind) case TOKEN_COMMA: return "COMMA"; + case TOKEN_SEMICOLON: + return "SEMICOLON"; case TOKEN_AMPERSAND: return "AMPERSAND"; case TOKEN_DOT: @@ -331,7 +334,8 @@ token_is_empty(const struct Token* t) bool token_ends_statement(const struct Token* t) { - return token_is(t, TOKEN_END_OF_FILE) || token_is(t, TOKEN_NEWLINE); + return token_is(t, TOKEN_END_OF_FILE) || token_is(t, TOKEN_NEWLINE) + || token_is(t, TOKEN_SEMICOLON); } bool @@ -574,6 +578,8 @@ lexer_symbol_token(struct Lexer* l, struct Lexer_Char current) case ',': RET{ TOKEN_COMMA, 1 }; + case ';': + RET{ TOKEN_SEMICOLON, 1 }; case '&': { lexer_match_chars(l, '&', '=', &a, &b); -- cgit 1.4.1