MCPcopy Create free account
hub / github.com/github/gh-aw / extractTimeBetween

Method extractTimeBetween

pkg/parser/schedule_parser.go:512–529  ·  view source on GitHub ↗

extractTimeBetween extracts a time specification from tokens between startPos and endPos (exclusive) Used for parsing the start time in "between START and END" clauses

(startPos, endPos int)

Source from the content-addressed store, hash-verified

510// extractTimeBetween extracts a time specification from tokens between startPos and endPos (exclusive)
511// Used for parsing the start time in "between START and END" clauses
512func (p *ScheduleParser) extractTimeBetween(startPos, endPos int) (string, error) {
513 if startPos >= len(p.tokens) || startPos >= endPos {
514 return "", errors.New("expected time specification")
515 }
516
517 // The time is in the tokens between startPos and endPos
518 // It might be a single token (e.g., "9am") or multiple tokens (e.g., "14:00 utc+9")
519 timeTokens := []string{}
520 for i := startPos; i < endPos && i < len(p.tokens); i++ {
521 timeTokens = append(timeTokens, p.tokens[i])
522 }
523
524 if len(timeTokens) == 0 {
525 return "", errors.New("expected time specification")
526 }
527
528 return normalizeTimeTokens(timeTokens), nil
529}
530
531// extractTimeAfter extracts a time specification from tokens starting at startPos until the end
532// Used for parsing the end time in "between START and END" clauses

Callers 1

parseDailyBetweenMethod · 0.95

Calls 1

normalizeTimeTokensFunction · 0.85

Tested by

no test coverage detected