style: use snake_case for constants

This commit is contained in:
2026-10-08 21:04:44 +02:00
parent 57e544f255
commit cb3f187b54
8 changed files with 20 additions and 20 deletions
+2 -2
View File
@@ -260,9 +260,9 @@ scan_ident proc(start usize, program []u8) ScanIdentResult {
# don't intern keywords (already O(1) lookup via token kind)
kind :: strmap.get(&keywords, program[start..cursor]) orelse .ident
str_id :: if (kind == .ident)
strpool.intern(&strpool.strings, program[start..cursor]) catch strpool.NO_STR
strpool.intern(&strpool.strings, program[start..cursor]) catch strpool.no_str
else
strpool.NO_STR
strpool.no_str
return ScanIdentResult{ end = cursor, kind = kind, str_id = str_id }
}
+3 -3
View File
@@ -3,7 +3,7 @@ import "@source/diagnostics"
import "@source/strpool"
TokenId :: distinct u32
NO_TOKEN :: maxval!(TokenId)
no_token :: maxval!(TokenId)
TokenData :: union {
str_id strpool.StringId
@@ -13,7 +13,7 @@ TokenData :: union {
Token :: struct {
span diagnostics.Span
kind TokenKind
data TokenData = TokenData{ str_id = strpool.NO_STR }
data TokenData = TokenData{ str_id = strpool.no_str }
}
TokenKind :: enum {
@@ -73,6 +73,6 @@ render_token proc(token Token, program []u8) void {
}
token_id proc(index uint) TokenId {
debug.assert(u64(index) < u64(NO_TOKEN))
debug.assert(u64(index) < u64(no_token))
return TokenId(index)
}