parseBase parses base schedules like "daily", "weekly on monday", etc.
()
| 111 | |
| 112 | // parseBase parses base schedules like "daily", "weekly on monday", etc. |
| 113 | func (p *ScheduleParser) parseBase() (string, error) { |
| 114 | if len(p.tokens) == 0 { |
| 115 | return "", errors.New("empty schedule") |
| 116 | } |
| 117 | |
| 118 | baseType := p.tokens[0] |
| 119 | scheduleLog.Printf("Parsing base schedule: type=%s, tokens=%v", baseType, p.tokens) |
| 120 | hasWeekdaysSuffix := p.hasWeekdaysSuffix() |
| 121 | |
| 122 | switch baseType { |
| 123 | case "daily": |
| 124 | return p.parseDailyBase(hasWeekdaysSuffix) |
| 125 | case "hourly": |
| 126 | return p.parseHourlyBase(hasWeekdaysSuffix) |
| 127 | case "weekly": |
| 128 | return p.parseWeeklyBase() |
| 129 | case "bi-weekly": |
| 130 | return p.parseNamedFuzzyBase("bi-weekly", "FUZZY:BI_WEEKLY * * *") |
| 131 | case "tri-weekly": |
| 132 | return p.parseNamedFuzzyBase("tri-weekly", "FUZZY:TRI_WEEKLY * * *") |
| 133 | case "monthly": |
| 134 | return p.parseMonthlyBase() |
| 135 | |
| 136 | default: |
| 137 | return "", fmt.Errorf("unsupported schedule type '%s', use 'daily', 'hourly', 'weekly', 'bi-weekly', 'tri-weekly', or 'monthly'", baseType) |
| 138 | } |
| 139 | } |
| 140 | |
| 141 | func (p *ScheduleParser) parseShortDurationInterval(hasWeekdaysSuffix bool) (string, bool, error) { |
| 142 | if !p.usesShortDurationSyntax(hasWeekdaysSuffix) { |
no test coverage detected