diff --git a/alpha.go b/alpha.go new file mode 100644 index 0000000..f27d3b0 --- /dev/null +++ b/alpha.go @@ -0,0 +1,9 @@ +package rfc3986 + +import ( + "github.com/reiver/go-rfc2234" +) + +func IsAlpha(r rune) bool { + return rfc2234.IsAlpha(r) +} diff --git a/digit.go b/digit.go new file mode 100644 index 0000000..0d5dfa0 --- /dev/null +++ b/digit.go @@ -0,0 +1,9 @@ +package rfc3986 + +import ( + "github.com/reiver/go-rfc2234" +) + +func IsDigit(r rune) bool { + return rfc2234.IsDigit(r) +} diff --git a/hexdig.go b/hexdig.go new file mode 100644 index 0000000..e345340 --- /dev/null +++ b/hexdig.go @@ -0,0 +1,9 @@ +package rfc3986 + +import ( + "github.com/reiver/go-rfc2234" +) + +func IsHexDig(r rune) bool { + return rfc2234.IsHexDig(r) +} diff --git a/pctencoded.go b/pctencoded.go index ee1703f..76e1ab2 100644 --- a/pctencoded.go +++ b/pctencoded.go @@ -4,7 +4,6 @@ import ( "io" "github.com/reiver/go-erorr" - "github.com/reiver/go-rfc2234" ) const pctencodedprefix = '%' @@ -34,11 +33,11 @@ func HasPrefixPctEncoded(str string) bool { return false } - if !rfc2234.IsHexDig(str1) { + if !IsHexDig(str1) { return false } - if !rfc2234.IsHexDig(str2) { + if !IsHexDig(str2) { return false } diff --git a/unreserved.go b/unreserved.go index a90634f..c9dbb6a 100644 --- a/unreserved.go +++ b/unreserved.go @@ -12,7 +12,7 @@ func IsUnreserved(r rune) bool { return true } - if rfc2234.IsDigit(r) { + if IsDigit(r) { return true } diff --git a/unreserved_test.go b/unreserved_test.go index fcb30fb..2acf136 100644 --- a/unreserved_test.go +++ b/unreserved_test.go @@ -3,8 +3,6 @@ package rfc3986_test import ( "testing" - "github.com/reiver/go-rfc2234" - "github.com/reiver/go-rfc3986" ) @@ -25,8 +23,8 @@ func TestIsUnreserved(t *testing.T) { Expected: false, } - if rfc2234.IsAlpha(r) || - rfc2234.IsDigit(r) || + if rfc3986.IsAlpha(r) || + rfc3986.IsDigit(r) || '-' == r || '.' == r || '_' == r ||