-
Notifications
You must be signed in to change notification settings - Fork 19
/
TodoTxt.sublime-syntax
81 lines (71 loc) · 2.08 KB
/
TodoTxt.sublime-syntax
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
%YAML 1.2
---
# See http://www.sublimetext.com/docs/3/syntax.html
name: Todo.txt
file_extensions:
- todo.txt
- done.txt
scope: text.todotxt
variables:
date: (?:[1-2]\d{3}[-/\\.](?:0?[1-9]|1[012])[-/\\.](?:0[1-9]|[12]\d|3[01]))
contexts:
main:
- include: comments
- include: task_done
- include: task_todo
task_done:
# Complex regexp:
# - 'x ' is required
# - then goes optional Completion date
# - then goes optional Creation date
- match: ^\s*x\s+(?:({{date}})\s+(?:({{date}})\s+)?)?
comment: Todo done item
scope: comment.line.todotxt
captures:
1: constant.numeric.todotxt.date
2: constant.numeric.todotxt.date
push:
- meta_scope: comment.line.todotxt
- include: inside_task
- match: $\n?
pop: true
task_todo:
# Complex regexp:
# - the whole regexp is optional
# - firstly goes optional Priority
# - then goes Creation date
- match: '^(?:\s*(?:(\([A-Z]\))\s+)?(?:({{date}})\s+)?)?'
comment: Todo item undone
captures:
1: invalid.deprecated.todotxt
2: constant.language.todotxt.priority
push:
- meta_scope: entity.task.todotxt
- include: inside_task
- match: $\n?
pop: true
inside_task:
- match: (?:\s|^|\G)(\@\S+)
comment: Todo item context
captures:
1: entity.name.tag.todotxt.context
- match: (?:\s|^|\G)(\+\S+)
comment: Todo item project
captures:
1: string.quoted.double.todotxt.project
# Non standard WAIT
- match: '\b(?i:WAIT)\b'
comment: Todo WAIT command
scope: keyword.other.todotxt.wait
- match: (\s+[^\s:]+:[^\s:]+)+\s*$
comment: Custom attributes
scope: variable.annotation.todotxt.attribute
comments:
# Comments begin with a '//' and finish at the end of the line.
- match: //
scope: punctuation.definition.comment.example-c
push:
# This is an anonymous context push for brevity.
- meta_scope: comment.line.double-slash.example-c
- match: $\n?
pop: true