move hide behind @ and specify with :

This commit is contained in:
2026-08-10 22:45:41 +02:00
parent 5244bfbf1b
commit ba6052eef3
27 changed files with 162 additions and 149 deletions
+6 -6
View File
@@ -20,17 +20,17 @@ Token :: struct {
kind Kind
}
hide is_alpha func(value u8) bool {
@hide is_alpha func(value u8) bool {
return value == '_' or
value >= 'a' and value <= 'z' or
value >= 'A' and value <= 'Z'
}
hide is_digit func(value u8) bool {
@hide is_digit func(value u8) bool {
return value >= '0' and value <= '9'
}
hide word_kind func(word []u8) Kind {
@hide word_kind func(word []u8) Kind {
# ponytail: enough keywords for the demo; add the full language set when a parser needs it.
if mem.eql(word, "func") or mem.eql(word, "void") {
return .keyword
@@ -38,7 +38,7 @@ hide word_kind func(word []u8) Kind {
return .identifier
}
hide append_token func(tokens @mut std.ArrayList(Token), kind Kind, start, end usize) void ! mem.AllocError {
@hide append_token func(tokens @mut std.ArrayList(Token), kind Kind, start, end usize) void ! mem.AllocError {
try arraylist.append(tokens, Token {
start = start,
length = end - start,
@@ -95,7 +95,7 @@ lex func(source []u8, tokens @mut std.ArrayList(Token)) void ! mem.AllocError {
return
}
hide kind_name func(kind Kind) *c_char {
@hide kind_name func(kind Kind) *c_char {
return match kind {
.invalid: "invalid"
.eof: "eof"
@@ -108,7 +108,7 @@ hide kind_name func(kind Kind) *c_char {
}
}
hide print_token func(source []u8, token Token) void {
@hide print_token func(source []u8, token Token) void {
_ = c.printf("%-11s", kind_name(token.kind))
if token.length != 0 {
_ = c.printf(" `")