MSP-8292 Up deps
This commit is contained in:
1 parent
3a66223a89
commit
5daaea50a1
186 files changed
+7092
-1579
No files matched your search
+5
-1
@@ -24,6 +24,7 @@ var (
|
||||
err8141QComponentStart = "expecting only one q-component (starting with the ?= sequence) [col %d]"
|
||||
err8141MalformedRComp = "expecting a non-empty r-component containing alnum, hex, or others ([~&()+,-.:=@;$_!*'] or [/?] but not at its beginning) [col %d]"
|
||||
err8141MalformedQComp = "expecting a non-empty q-component containing alnum, hex, or others ([~&()+,-.:=@;$_!*'] or [/?] but not at its beginning) [col %d]"
|
||||
errInvalidSyntax = "invalid URN syntax [col %d]"
|
||||
)
|
||||
var _toStateActions []byte = []byte{
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
@@ -4358,7 +4359,7 @@ func (m *machine) Parse(input []byte) (*URN, error) {
|
||||
|
||||
if m.parsingMode != RFC8141Only {
|
||||
// Throw an error when:
|
||||
// - we are entering here matching the the prefix in the namespace identifier part
|
||||
// - we are entering here matching the prefix in the namespace identifier part
|
||||
// - looking ahead (3 chars) we find a colon
|
||||
if pos := m.p + 3; pos < m.pe && m.data[pos] == 58 && output.prefix != "" {
|
||||
m.err = fmt.Errorf(errNoUrnWithinID, pos)
|
||||
@@ -5026,6 +5027,9 @@ func (m *machine) Parse(input []byte) (*URN, error) {
|
||||
}
|
||||
|
||||
if m.cs < firstFinal || m.cs == enFail {
|
||||
if m.err == nil {
|
||||
m.err = fmt.Errorf(errInvalidSyntax, m.p)
|
||||
}
|
||||
return nil, m.err
|
||||
}
|
||||
|
||||
|
||||
+6
-2
@@ -24,6 +24,7 @@ var (
|
||||
err8141QComponentStart = "expecting only one q-component (starting with the ?= sequence) [col %d]"
|
||||
err8141MalformedRComp = "expecting a non-empty r-component containing alnum, hex, or others ([~&()+,-.:=@;$_!*'] or [/?] but not at its beginning) [col %d]"
|
||||
err8141MalformedQComp = "expecting a non-empty q-component containing alnum, hex, or others ([~&()+,-.:=@;$_!*'] or [/?] but not at its beginning) [col %d]"
|
||||
errInvalidSyntax = "invalid URN syntax [col %d]"
|
||||
)
|
||||
|
||||
%%{
|
||||
@@ -48,7 +49,7 @@ action set_pre {
|
||||
action throw_pre_urn_err {
|
||||
if m.parsingMode != RFC8141Only {
|
||||
// Throw an error when:
|
||||
// - we are entering here matching the the prefix in the namespace identifier part
|
||||
// - we are entering here matching the prefix in the namespace identifier part
|
||||
// - looking ahead (3 chars) we find a colon
|
||||
if pos := m.p + 3; pos < m.pe && m.data[pos] == 58 && output.prefix != "" {
|
||||
m.err = fmt.Errorf(errNoUrnWithinID, pos)
|
||||
@@ -366,6 +367,9 @@ func (m *machine) Parse(input []byte) (*URN, error) {
|
||||
%% write exec;
|
||||
|
||||
if m.cs < first_final || m.cs == en_fail {
|
||||
if m.err == nil {
|
||||
m.err = fmt.Errorf(errInvalidSyntax, m.p)
|
||||
}
|
||||
return nil, m.err
|
||||
}
|
||||
|
||||
@@ -383,4 +387,4 @@ func (m *machine) WithParsingMode(x ParsingMode) {
|
||||
m.startParsingAt = en_scim_only
|
||||
}
|
||||
m.parsingModeSet = true
|
||||
}
|
||||
}
|
||||
+4
-4
@@ -8,7 +8,7 @@ import (
|
||||
|
||||
const errInvalidURN = "invalid URN: %s"
|
||||
|
||||
// URN represents an Uniform Resource Name.
|
||||
// URN represents a Uniform Resource Name.
|
||||
//
|
||||
// The general form represented is:
|
||||
//
|
||||
@@ -32,7 +32,7 @@ type URN struct {
|
||||
|
||||
// Normalize turns the receiving URN into its norm version.
|
||||
//
|
||||
// Which means: lowercase prefix, lowercase namespace identifier, and immutate namespace specific string chars (except <hex> tokens which are lowercased).
|
||||
// Which means: lowercase prefix, lowercase namespace identifier, and leave namespace-specific string chars unchanged (except <hex> tokens which are lowercased).
|
||||
func (u *URN) Normalize() *URN {
|
||||
return &URN{
|
||||
prefix: "urn",
|
||||
@@ -82,10 +82,10 @@ func (u *URN) String() string {
|
||||
return res
|
||||
}
|
||||
|
||||
// Parse is responsible to create an URN instance from a byte array matching the correct URN syntax (RFC 2141).
|
||||
// Parse is responsible for creating a URN instance from a byte array matching the correct URN syntax (RFC 2141).
|
||||
func Parse(u []byte, options ...Option) (*URN, bool) {
|
||||
urn, err := NewMachine(options...).Parse(u)
|
||||
if err != nil {
|
||||
if err != nil || urn == nil {
|
||||
return nil, false
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user