diff options
| author | Mel <mel@rnrd.eu> | 2026-05-28 00:36:13 +0200 |
|---|---|---|
| committer | Mel <mel@rnrd.eu> | 2026-05-28 00:36:13 +0200 |
| commit | 1aef923b312f2bc9c0963381eae8619c187081c6 (patch) | |
| tree | 2e324f09960c31b13f72b3961fc7abaf0fa2865e /boot/lex.c | |
| parent | 7db79f43b431b94d525308699a87a3daeff31d92 (diff) | |
| download | catskill-1aef923b312f2bc9c0963381eae8619c187081c6.tar.zst catskill-1aef923b312f2bc9c0963381eae8619c187081c6.zip | |
Use semicolon tokens as statement separators
Signed-off-by: Mel <mel@rnrd.eu>
Diffstat (limited to 'boot/lex.c')
| -rw-r--r-- | boot/lex.c | 8 |
1 files changed, 7 insertions, 1 deletions
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); |
