getField returns an Int with the bits set representing all of the times that the field represents or error parsing field value. A "field" is a comma-separated list of "ranges".
(field string, r bounds)
| 234 | // the field represents or error parsing field value. A "field" is a comma-separated |
| 235 | // list of "ranges". |
| 236 | func getField(field string, r bounds) (uint64, error) { |
| 237 | var bits uint64 |
| 238 | ranges := strings.FieldsFunc(field, func(r rune) bool { return r == ',' }) |
| 239 | for _, expr := range ranges { |
| 240 | bit, err := getRange(expr, r) |
| 241 | if err != nil { |
| 242 | return bits, err |
| 243 | } |
| 244 | bits |= bit |
| 245 | } |
| 246 | return bits, nil |
| 247 | } |
| 248 | |
| 249 | // getRange returns the bits indicated by the given expression: |
| 250 | // number | number "-" number [ "/" number ] |