tokenize breaks the input into tokens
()
| 60 | |
| 61 | // tokenize breaks the input into tokens |
| 62 | func (p *ScheduleParser) tokenize() error { |
| 63 | // Normalize the input |
| 64 | input := strings.ToLower(strings.TrimSpace(p.input)) |
| 65 | |
| 66 | // Split on whitespace |
| 67 | tokens := strings.Fields(input) |
| 68 | if len(tokens) == 0 { |
| 69 | return errors.New("empty schedule expression") |
| 70 | } |
| 71 | |
| 72 | p.tokens = tokens |
| 73 | p.pos = 0 |
| 74 | return nil |
| 75 | } |
| 76 | |
| 77 | // parse parses the tokens into a cron expression |
| 78 | func (p *ScheduleParser) parse() (string, error) { |
no test coverage detected