blob: 42670bcce72e6f585499cfb8c8239f42ea409b64 (
plain)
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
|
module CodeRay
module Scanners
class Taskpaper < Scanner
register_for :taskpaper
file_extension 'taskpaper'
protected
def scan_tokens encoder, options
until eos?
if match = scan(/\S.*:.*$/) # project
encoder.text_token(match, :namespace)
elsif match = scan(/-.+@done.*/) # completed task
encoder.text_token(match, :done)
elsif match = scan(/-(?:[^@\n]+|@(?!due))*/) # task
encoder.text_token(match, :plain)
elsif match = scan(/@due.*/) # comment
encoder.text_token(match, :important)
elsif match = scan(/.+/) # comment
encoder.text_token(match, :comment)
elsif match = scan(/\s+/) # space
encoder.text_token(match, :space)
else # other
encoder.text_token getch, :error
end
end
encoder
end
end
end
end
|