func LessThanNil(x interface{}) px.Parser { return func(st px.ParsexState) (interface{}, error) { val, _ := px.AnyOne(st) if x == nil || val == nil { return false, nil } return nil, ParsexSignErrorf("except nil value but: %v", val) } }
func TimeValue(st px.ParsexState) (interface{}, error) { val, err := px.AnyOne(st) if err == nil { if _, ok := val.(tm.Time); ok { return val, nil } return nil, ParsexSignErrorf("except a time value but: %v", err) } return nil, ParsexSignErrorf("except a time value but error: %v", err) }
func ListValue(st px.ParsexState) (interface{}, error) { val, err := px.AnyOne(st) if err == nil { if _, ok := val.(List); ok { return val, nil } return nil, ParsexSignErrorf("except a list value but %v ", val) } return nil, ParsexSignErrorf("except a list value but error: %v", err) }
func FalseIfHasNil(st px.ParsexState) (interface{}, error) { for { val, err := px.AnyOne(st) if err != nil { if err == io.EOF { return nil, fmt.Errorf("False If Nil Error: Found EOF.") } return nil, err } if val == nil { return false, err } } }