Express hex-shaped data with the hex() builtin instead of a hand-rolled choice

This commit is contained in:
lilleman
2026-08-27 23:18:20 +02:00
committed by lilleman-tw
parent aec0497ce5
commit af09a86e71
4 changed files with 5 additions and 11 deletions
+1 -2
View File
@@ -5,7 +5,6 @@
"o": [{ "format": "0", "weight": 3 }, { "format": "10", "weight": 4 }, { "format": "#100", "weight": 2 }] "o": [{ "format": "0", "weight": 3 }, { "format": "10", "weight": 4 }, { "format": "#100", "weight": 2 }]
}, },
{ {
"format": "{g}:{g}:{g}:{g}:{g}:{g}:{g}:{g}", "format": "{hex(4)}:{hex(4)}:{hex(4)}:{hex(4)}:{hex(4)}:{hex(4)}:{hex(4)}:{hex(4)}"
"g": [{ "format": "{x}{x}{x}{x}", "x": ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "a", "b", "c", "d", "e", "f"] }]
} }
] ]
+1 -4
View File
@@ -1,6 +1,3 @@
[ [
{ { "format": "{hex(2)}:{hex(2)}:{hex(2)}:{hex(2)}:{hex(2)}:{hex(2)}" }
"format": "{x}{x}:{x}{x}:{x}{x}:{x}{x}:{x}{x}:{x}{x}",
"x": ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "a", "b", "c", "d", "e", "f"]
}
] ]
+2 -3
View File
@@ -1,7 +1,6 @@
[ [
{ {
"format": "{x}{x}{x}{x}{x}{x}{x}{x}-{x}{x}{x}{x}-4{x}{x}{x}-{y}{x}{x}{x}-{x}{x}{x}{x}{x}{x}{x}{x}{x}{x}{x}{x}", "format": "{hex(8)}-{hex(4)}-4{hex(3)}-{variant}{hex(3)}-{hex(12)}",
"x": ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "a", "b", "c", "d", "e", "f"], "variant": ["8", "9", "a", "b"]
"y": ["8", "9", "a", "b"]
} }
] ]
+1 -2
View File
@@ -5,7 +5,6 @@
"o": [{ "format": "0", "weight": 3 }, { "format": "10", "weight": 4 }, { "format": "#100", "weight": 2 }] "o": [{ "format": "0", "weight": 3 }, { "format": "10", "weight": 4 }, { "format": "#100", "weight": 2 }]
}, },
{ {
"format": "{g}:{g}:{g}:{g}:{g}:{g}:{g}:{g}", "format": "{hex(4)}:{hex(4)}:{hex(4)}:{hex(4)}:{hex(4)}:{hex(4)}:{hex(4)}:{hex(4)}"
"g": [{ "format": "{x}{x}{x}{x}", "x": ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "a", "b", "c", "d", "e", "f"] }]
} }
] ]