|
|
@ -170,6 +170,28 @@ func implicitValueRequiredStruct(tag string, tp reflect.Type) (bool, error) {
|
|
|
|
return false, nil
|
|
|
|
return false, nil
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func isLeftInclude(b byte) (bool, error) {
|
|
|
|
|
|
|
|
switch b {
|
|
|
|
|
|
|
|
case '[':
|
|
|
|
|
|
|
|
return true, nil
|
|
|
|
|
|
|
|
case '(':
|
|
|
|
|
|
|
|
return false, nil
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
|
|
|
return false, errNumberRange
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func isRightInclude(b byte) (bool, error) {
|
|
|
|
|
|
|
|
switch b {
|
|
|
|
|
|
|
|
case ']':
|
|
|
|
|
|
|
|
return true, nil
|
|
|
|
|
|
|
|
case ')':
|
|
|
|
|
|
|
|
return false, nil
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
|
|
|
return false, errNumberRange
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
func maybeNewValue(field reflect.StructField, value reflect.Value) {
|
|
|
|
func maybeNewValue(field reflect.StructField, value reflect.Value) {
|
|
|
|
if field.Type.Kind() == reflect.Ptr && value.IsNil() {
|
|
|
|
if field.Type.Kind() == reflect.Ptr && value.IsNil() {
|
|
|
|
value.Set(reflect.New(value.Type().Elem()))
|
|
|
|
value.Set(reflect.New(value.Type().Elem()))
|
|
|
@ -211,14 +233,9 @@ func parseNumberRange(str string) (*numberRange, error) {
|
|
|
|
return nil, errNumberRange
|
|
|
|
return nil, errNumberRange
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
var leftInclude bool
|
|
|
|
leftInclude, err := isLeftInclude(str[0])
|
|
|
|
switch str[0] {
|
|
|
|
if err != nil {
|
|
|
|
case '[':
|
|
|
|
return nil, err
|
|
|
|
leftInclude = true
|
|
|
|
|
|
|
|
case '(':
|
|
|
|
|
|
|
|
leftInclude = false
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
|
|
|
return nil, errNumberRange
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
str = str[1:]
|
|
|
|
str = str[1:]
|
|
|
@ -226,14 +243,9 @@ func parseNumberRange(str string) (*numberRange, error) {
|
|
|
|
return nil, errNumberRange
|
|
|
|
return nil, errNumberRange
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
var rightInclude bool
|
|
|
|
rightInclude, err := isRightInclude(str[len(str)-1])
|
|
|
|
switch str[len(str)-1] {
|
|
|
|
if err != nil {
|
|
|
|
case ']':
|
|
|
|
return nil, err
|
|
|
|
rightInclude = true
|
|
|
|
|
|
|
|
case ')':
|
|
|
|
|
|
|
|
rightInclude = false
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
|
|
|
return nil, errNumberRange
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
str = str[:len(str)-1]
|
|
|
|
str = str[:len(str)-1]
|
|
|
|