@@ -127,11 +127,10 @@ func parseField(field string, b bound, t translater) (bitset, error) {
127127// parseFieldExpr returns the bits indicated by the given expression:
128128// number | number "-" number [ "/" number ]
129129func 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 )
133132
134- rangeAndStep := strings .Split (fieldexpr , "/" )
133+ rangeAndStep := strings .Split (newexpr , "/" )
135134 if ! (len (rangeAndStep ) == 1 || len (rangeAndStep ) == 2 ) {
136135 return 0 , fmt .Errorf ("Failed to parse the expr '%s', too many '/'" , fieldexpr )
137136 }
@@ -172,7 +171,7 @@ func parseFieldExpr(fieldexpr string, b bound, t translater) (bitset, error) {
172171
173172 // Parse the step, second.
174173 step := 1
175- if len ( rangeAndStep ) == 2 {
174+ if hasStep {
176175 var err error
177176 if step , err = strconv .Atoi (rangeAndStep [1 ]); err != nil {
178177 return 0 , fmt .Errorf ("Failed to parse the expr '%s': %w" , fieldexpr , err )
0 commit comments