Skip to content

Commit

Permalink
Remove broken TOML 1.1 "Unicode keys" feature
Browse files Browse the repository at this point in the history
  • Loading branch information
arp242 committed Jun 15, 2024
1 parent 7234339 commit eb72747
Show file tree
Hide file tree
Showing 5 changed files with 4 additions and 82 deletions.
3 changes: 1 addition & 2 deletions bench_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,7 @@ func BenchmarkEncode(b *testing.B) {
// "next" version of TOML.
switch path {
case "valid/string/escape-esc.toml", "valid/datetime/no-seconds.toml",
"valid/string/hex-escape.toml", "valid/inline-table/newline.toml",
"valid/key/unicode.toml":
"valid/string/hex-escape.toml", "valid/inline-table/newline.toml":
return nil
}

Expand Down
44 changes: 0 additions & 44 deletions internal/toml-test/tests/valid/key/unicode.json

This file was deleted.

15 changes: 0 additions & 15 deletions internal/toml-test/tests/valid/key/unicode.toml

This file was deleted.

21 changes: 2 additions & 19 deletions lex.go
Original file line number Diff line number Diff line change
Expand Up @@ -1265,23 +1265,6 @@ func isBinary(r rune) bool { return r == '0' || r == '1' }
func isOctal(r rune) bool { return r >= '0' && r <= '7' }
func isHex(r rune) bool { return (r >= '0' && r <= '9') || (r|0x20 >= 'a' && r|0x20 <= 'f') }
func isBareKeyChar(r rune, tomlNext bool) bool {
if tomlNext {
return (r >= 'A' && r <= 'Z') ||
(r >= 'a' && r <= 'z') ||
(r >= '0' && r <= '9') ||
r == '_' || r == '-' ||
r == 0xb2 || r == 0xb3 || r == 0xb9 || (r >= 0xbc && r <= 0xbe) ||
(r >= 0xc0 && r <= 0xd6) || (r >= 0xd8 && r <= 0xf6) || (r >= 0xf8 && r <= 0x037d) ||
(r >= 0x037f && r <= 0x1fff) ||
(r >= 0x200c && r <= 0x200d) || (r >= 0x203f && r <= 0x2040) ||
(r >= 0x2070 && r <= 0x218f) || (r >= 0x2460 && r <= 0x24ff) ||
(r >= 0x2c00 && r <= 0x2fef) || (r >= 0x3001 && r <= 0xd7ff) ||
(r >= 0xf900 && r <= 0xfdcf) || (r >= 0xfdf0 && r <= 0xfffd) ||
(r >= 0x10000 && r <= 0xeffff)
}

return (r >= 'A' && r <= 'Z') ||
(r >= 'a' && r <= 'z') ||
(r >= '0' && r <= '9') ||
r == '_' || r == '-'
return (r >= 'A' && r <= 'Z') || (r >= 'a' && r <= 'z') ||
(r >= '0' && r <= '9') || r == '_' || r == '-'
}
3 changes: 1 addition & 2 deletions toml_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -263,8 +263,7 @@ func TestTomlNextFails(t *testing.T) {
"valid/string/escape-esc",
"valid/datetime/no-seconds",
"valid/string/hex-escape",
"valid/inline-table/newline",
"valid/key/unicode")
"valid/inline-table/newline")
}

func runTomlTest(t *testing.T, includeNext bool, wantFail ...string) {
Expand Down

0 comments on commit eb72747

Please sign in to comment.