Skip to content

Commit

Permalink
2nd
Browse files Browse the repository at this point in the history
  • Loading branch information
Patrick Fleming committed Feb 14, 2021
1 parent 0aa7516 commit 223a04a
Show file tree
Hide file tree
Showing 13 changed files with 758 additions and 502 deletions.
23 changes: 13 additions & 10 deletions cronParser.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import (
func main() {

ex := GetExpressionDescriptor()
ex.Language("es")
//ex.setVerbose(true)
println(ex.toString("5-45/10,*/5,9 * * * *"))

Expand Down Expand Up @@ -328,9 +329,9 @@ func (parser *CronParser) normalize(expressionParts []string) error {


func (parser *CronParser) validate(parsed []string) {
parser.assertNoInvalidCharacters("DOW", parsed[5])
parser.assertNoInvalidCharacters("DOM", parsed[3])
parser.validateRange(parsed)
parser.assertNoInvalidCharacters("DOW", parsed[5])
parser.assertNoInvalidCharacters("DOM", parsed[3])
parser.validateRange(parsed)
}

func (parser *CronParser) validateRange(parsed []string) error {
Expand Down Expand Up @@ -372,13 +373,15 @@ func (parser *CronParser) validateRange(parsed []string) error {


func (parser *CronParser) assertNoInvalidCharacters(partDescription string, expression string) error {
// No characters other than 'L' or 'W' should remain after normalization
re := regexp.MustCompile("[A-KM-VX-Z]+/gi")
invalidChars := re.Match([]byte(expression))

if invalidChars {
return errors.New(partDescription + " part contains invalid values: " + string(re.Find([]byte(expression))))
}
// No characters other than 'L' or 'W' should remain after normalization
re := regexp.MustCompile("[A-KM-VX-Z]+/gi")
invalidChars := re.Match([]byte(expression))

if invalidChars {
return errors.New(partDescription + " part contains invalid values: " + string(re.Find([]byte(expression))))
}

return nil

return nil
}
256 changes: 0 additions & 256 deletions en.go

This file was deleted.

39 changes: 0 additions & 39 deletions enLocaleLoader.go

This file was deleted.

Loading

0 comments on commit 223a04a

Please sign in to comment.