Skip to content

Commit af24dd3

Browse files
committed
refactor, should be pretty good now
1 parent 35d635c commit af24dd3

File tree

1 file changed

+36
-32
lines changed

1 file changed

+36
-32
lines changed

syntaxes/klog.json

Lines changed: 36 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,23 @@
66
"name": "keyword.other.tag.klog",
77
"match": "#[\\p{L}\\d_]+"
88
},
9+
"summary-under-date": {
10+
"name": "string.unquoted.summary.after-date.klog",
11+
"begin": "\\G",
12+
"end": "(?=^\\s*$|^(?: {2,4}|\t))",
13+
"patterns": [
14+
{
15+
"name": "invalid.illegal.summary.whitespace-prefix.klog",
16+
"match": "^ ."
17+
},
18+
{
19+
"include": "#tag"
20+
}
21+
]
22+
},
923
"summary-behind-entry": {
1024
"name": "string.unquoted.summary.behind-entry.klog",
11-
"begin": "\\G",
25+
"begin": "(?<= +)",
1226
"end": "$",
1327
"patterns": [
1428
{
@@ -22,18 +36,15 @@
2236
},
2337
"timespan-open-ended": {
2438
"name": "markup.other.timespan.open-ended.klog",
25-
"match": "((<?(?:[01]?\\d|2[0-3]):[0-5]\\d(?:am|pm)?>?) ?- ?\\?)"
39+
"match": "((<?(?:[01]?\\d|2[0-3]):[0-5]\\d(?:am|pm)?>?) ?- ?\\?+)"
2640
},
27-
"duration": {
28-
"match": "(?:(\\+?(?:\\d+h\\d+m|\\d+h|\\d+m))|(-(?:\\d+h\\d+m|\\d+h|\\d+m)))",
29-
"captures": {
30-
"1": {
31-
"name": "markup.other.duration.positive.klog"
32-
},
33-
"2": {
34-
"name": "markup.other.duration.negative.klog"
35-
}
36-
}
41+
"duration-negative": {
42+
"match": "-(?:\\d+h\\d+m|\\d+h|\\d+m)",
43+
"name": "markup.other.duration.negative.klog"
44+
},
45+
"duration-positive": {
46+
"match": "\\+?(?:\\d+h\\d+m|\\d+h|\\d+m)",
47+
"name": "markup.other.duration.positive.klog"
3748
},
3849
"record": {
3950
"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 @@
4758
},
4859
"patterns": [
4960
{
50-
"name": "string.unquoted.summary.after-date.klog",
51-
"begin": "\\G",
52-
"end": "(?=^$|^(?: {2,4}|\t))",
53-
"patterns": [
54-
{
55-
"name": "invalid.illegal.summary.whitespace-prefix.klog",
56-
"match": "^ \\w"
57-
},
58-
{
59-
"include": "#tag"
60-
}
61-
]
61+
"include": "#summary-under-date"
6262
},
6363
{
6464
"begin": "^(?:\t| {2,4})",
@@ -71,17 +71,21 @@
7171
"include": "#timespan-open-ended"
7272
},
7373
{
74-
"include": "#duration"
74+
"include": "#duration-positive"
75+
},
76+
{
77+
"include": "#duration-negative"
78+
},
79+
{
80+
"include": "#summary-behind-entry"
7581
},
7682
{
77-
"name": "string.unquoted.summary.behind-entry.klog",
78-
"begin": " +",
79-
"end": "$",
80-
"patterns": [
81-
{
82-
"include": "#tag"
83+
"match": "([^ ]*)(?: |$)",
84+
"captures": {
85+
"1": {
86+
"name": "invalid.illegal.missing-spacing-after-entry.klog"
8387
}
84-
]
88+
}
8589
}
8690
]
8791
}

0 commit comments

Comments
 (0)