Merge pull request #6087 from dozn/json-unmarshal-runes

[encoding/json] Allow Unmarshalling to rune
This commit is contained in:
Laytan
2025-12-31 03:31:28 +01:00
committed by GitHub
2 changed files with 10 additions and 0 deletions

View File

@@ -76,6 +76,7 @@ Error :: enum {
Invalid_Number,
String_Not_Terminated,
Invalid_String,
Invalid_Rune,
// Parsing Errors

View File

@@ -225,6 +225,15 @@ unmarshal_string_token :: proc(p: ^Parser, val: any, token: Token, ti: ^reflect.
}
ok = true
return
case rune:
for rne, i in str {
if i > 0 {
dst = {}
return false, .Invalid_Rune
}
dst = rne
}
return true, nil
}
#partial switch variant in ti.variant {