further tidying

This commit is contained in:
gorhill
2013-09-08 10:37:12 -04:00
parent 13ba1270e1
commit 17ea23bf08
4 changed files with 139 additions and 127 deletions

View File

@@ -371,6 +371,29 @@ func (expr *Expression) domFieldHandler(s string) error {
/******************************************************************************/
func populateOne(values map[int]bool, v int) {
values[v] = true
}
func populateMany(values map[int]bool, min, max, step int) {
for i := min; i <= max; i += step {
values[i] = true
}
}
func toList(set map[int]bool) []int {
list := make([]int, len(set))
i := 0
for k := range set {
list[i] = k
i += 1
}
sort.Ints(list)
return list
}
/******************************************************************************/
func genericFieldParse(s string, desc fieldDescriptor) ([]*cronDirective, error) {
// At least one entry must be present
indices := entryFinder.FindAllStringIndex(s, -1)
@@ -451,29 +474,6 @@ func genericFieldParse(s string, desc fieldDescriptor) ([]*cronDirective, error)
/******************************************************************************/
func populateOne(values map[int]bool, v int) {
values[v] = true
}
func populateMany(values map[int]bool, min, max, step int) {
for i := min; i <= max; i += step {
values[i] = true
}
}
func toList(set map[int]bool) []int {
list := make([]int, len(set))
i := 0
for k := range set {
list[i] = k
i += 1
}
sort.Ints(list)
return list
}
/******************************************************************************/
func makeLayoutRegexp(layout, value string) *regexp.Regexp {
layout = strings.Replace(layout, `%value%`, value, -1)
re := layoutRegexp[layout]