@@ -127,11 +127,10 @@ func parseField(field string, b bound, t translater) (bitset, error) {
127
127
// parseFieldExpr returns the bits indicated by the given expression:
128
128
// number | number "-" number [ "/" number ]
129
129
func parseFieldExpr (fieldexpr string , b bound , t translater ) (bitset , error ) {
130
- if fieldexpr == "*" {
131
- return bitsetStar , nil
132
- }
130
+ // Replace "*" into "min-max".
131
+ newexpr := strings .Replace (fieldexpr , "*" , fmt .Sprintf ("%d-%d" , b .min , b .max ), 1 )
133
132
134
- rangeAndStep := strings .Split (fieldexpr , "/" )
133
+ rangeAndStep := strings .Split (newexpr , "/" )
135
134
if ! (len (rangeAndStep ) == 1 || len (rangeAndStep ) == 2 ) {
136
135
return 0 , fmt .Errorf ("Failed to parse the expr '%s', too many '/'" , fieldexpr )
137
136
}
@@ -172,7 +171,7 @@ func parseFieldExpr(fieldexpr string, b bound, t translater) (bitset, error) {
172
171
173
172
// Parse the step, second.
174
173
step := 1
175
- if len ( rangeAndStep ) == 2 {
174
+ if hasStep {
176
175
var err error
177
176
if step , err = strconv .Atoi (rangeAndStep [1 ]); err != nil {
178
177
return 0 , fmt .Errorf ("Failed to parse the expr '%s': %w" , fieldexpr , err )
0 commit comments