From 47cdfb3de0664e25b6735dad331faf1c93ea33f7 Mon Sep 17 00:00:00 2001 From: Tommy Date: Sat, 10 Jun 2017 20:24:46 +0100 Subject: [PATCH] added crontab highlighting. (#689) * added crontab highlighting. * added day and month keywords. added label keywords. --- runtime/syntax/crontab.yaml | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 runtime/syntax/crontab.yaml diff --git a/runtime/syntax/crontab.yaml b/runtime/syntax/crontab.yaml new file mode 100644 index 00000000..536bf936 --- /dev/null +++ b/runtime/syntax/crontab.yaml @@ -0,0 +1,36 @@ +filetype: crontab + +detect: + filename: "crontab$" + header: "^#.*?/etc/crontab" + +rules: + # The time and date fields are: + # field allowed values + # ----- -------------- + # minute 0-59 + # hour 0-23 + # day of month 0-31 + # month 0-12 (or names, see below) + # day of week 0-7 (0 or 7 is Sun, or use names) + + - statement: "^([\\*0-9,\\-\\/]+)\\s+([\\*0-9,\\-\\/]+)\\s+([\\*0-9,\\-\\/]+)\\s+([\\*0-9,\\-\\/]+)\\s+([\\*0-9,\\-\\/]+)\\s+(.*)$\\n?" + - constant: "^([\\*0-9,\\-\\/]+)\\s+([\\*0-9,\\-\\/]+)\\s+([\\*0-9,\\-\\/]+)\\s+([\\*0-9,\\-\\/]+)\\s+([\\*0-9,\\-\\/]+)" + + # Shell Values + - type: "^[A-Z]+\\=" + + # Months and weekday keywords + - type: "jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec" + - constant: "sun|mon|tue|wed|thu|fri|sat" + - type: "\\@(reboot|yearly|annually|monthly|weekly|daily|midnight|hourly)" + + # Conditionals + - special: "(\\{|\\}|\\(|\\)|\\;|\\]|\\[|`|\\\\|\\$|<|>|^|!|=|&|\\|)" + + - comment: + start: "#" + end: "$" + rules: + - todo: "(TODO|XXX|FIXME):?" +