refactoed a bit

master
Charles Iliya Krempeaux 2024-08-24 08:53:20 -07:00
parent b924b31e4c
commit 9579e23598
6 changed files with 32 additions and 8 deletions

9
alpha.go 100644
View File

@ -0,0 +1,9 @@
package rfc3986
import (
"github.com/reiver/go-rfc2234"
)
func IsAlpha(r rune) bool {
return rfc2234.IsAlpha(r)
}

9
digit.go 100644
View File

@ -0,0 +1,9 @@
package rfc3986
import (
"github.com/reiver/go-rfc2234"
)
func IsDigit(r rune) bool {
return rfc2234.IsDigit(r)
}

9
hexdig.go 100644
View File

@ -0,0 +1,9 @@
package rfc3986
import (
"github.com/reiver/go-rfc2234"
)
func IsHexDig(r rune) bool {
return rfc2234.IsHexDig(r)
}

View File

@ -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
}

View File

@ -12,7 +12,7 @@ func IsUnreserved(r rune) bool {
return true
}
if rfc2234.IsDigit(r) {
if IsDigit(r) {
return true
}

View File

@ -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 ||