diff --git a/syntaxes/klog.json b/syntaxes/klog.json index fd52708..7e0603b 100644 --- a/syntaxes/klog.json +++ b/syntaxes/klog.json @@ -6,9 +6,23 @@ "name": "keyword.other.tag.klog", "match": "#[\\p{L}\\d_]+" }, + "summary-under-date": { + "name": "string.unquoted.summary.after-date.klog", + "begin": "\\G", + "end": "(?=^\\s*$|^(?: {2,4}|\t))", + "patterns": [ + { + "name": "invalid.illegal.summary.whitespace-prefix.klog", + "match": "^ ." + }, + { + "include": "#tag" + } + ] + }, "summary-behind-entry": { "name": "string.unquoted.summary.behind-entry.klog", - "begin": "\\G", + "begin": "(?<= +)", "end": "$", "patterns": [ { @@ -22,18 +36,15 @@ }, "timespan-open-ended": { "name": "markup.other.timespan.open-ended.klog", - "match": "((?) ?- ?\\?)" + "match": "((?) ?- ?\\?+)" }, - "duration": { - "match": "(?:(\\+?(?:\\d+h\\d+m|\\d+h|\\d+m))|(-(?:\\d+h\\d+m|\\d+h|\\d+m)))", - "captures": { - "1": { - "name": "markup.other.duration.positive.klog" - }, - "2": { - "name": "markup.other.duration.negative.klog" - } - } + "duration-negative": { + "match": "-(?:\\d+h\\d+m|\\d+h|\\d+m)", + "name": "markup.other.duration.negative.klog" + }, + "duration-positive": { + "match": "\\+?(?:\\d+h\\d+m|\\d+h|\\d+m)", + "name": "markup.other.duration.positive.klog" }, "record": { "begin": "^(\\d{4}-\\d{2}-\\d{2}|\\d{4}\\\\\\d{2}\\\\\\d{2})(?:\\s+\\((\\d+h\\d+m|\\d+h|\\d+m)!\\))?", @@ -47,18 +58,7 @@ }, "patterns": [ { - "name": "string.unquoted.summary.after-date.klog", - "begin": "\\G", - "end": "(?=^$|^(?: {2,4}|\t))", - "patterns": [ - { - "name": "invalid.illegal.summary.whitespace-prefix.klog", - "match": "^ \\w" - }, - { - "include": "#tag" - } - ] + "include": "#summary-under-date" }, { "begin": "^(?:\t| {2,4})", @@ -71,17 +71,21 @@ "include": "#timespan-open-ended" }, { - "include": "#duration" + "include": "#duration-positive" + }, + { + "include": "#duration-negative" + }, + { + "include": "#summary-behind-entry" }, { - "name": "string.unquoted.summary.behind-entry.klog", - "begin": " +", - "end": "$", - "patterns": [ - { - "include": "#tag" + "match": "([^ ]*)(?: |$)", + "captures": { + "1": { + "name": "invalid.illegal.missing-spacing-after-entry.klog" } - ] + } } ] }