Parses a classic UNIX style crontab string into a data structure, Cron
, from which
you can extract information.
The main entrypoint is the fromString function.
Cron.fromString "* * */3 4 *"
fromString returns a Result (List DeadEnd) Cron
.
A Cron
expression consists of exactly five elements:
1. Minutes (0-59)
2. Hours (0-23)
3. Day of month (1-31)
4. Month (1-12 or jan,feb,...)
5. Week day (0-6 or mon, tue, ...)
fromString : String -> Result (List Parser.DeadEnd) Cron
Parse a crontab string to a Cron expression
Represents each of the five parts of a crontab
A Single is just a number or ordinal such as 1 or MON. Multiple is a comma-separated list of terms, such as 1,2,5 or JAN,FEB Every represents the star meaning "everything matches"
A term can be either:
An atom is either
The months of the year
The week days