diff options
author | Kornelius Kalnbach <murphy@rubychan.de> | 2016-02-13 16:12:48 +0100 |
---|---|---|
committer | Kornelius Kalnbach <murphy@rubychan.de> | 2016-02-13 16:12:48 +0100 |
commit | 0b8c69cfb7a65bec04c44e58e5776e323d2aa1af (patch) | |
tree | fd81bf6229bfc0d173f5b744534a76b5c70eb440 /lib/coderay/scanners/taskpaper.rb | |
parent | 916711c9983483c39f9a68c29e21a0ed40004bd2 (diff) | |
parent | 0a1f500d524ff0fb5eeafef051ccbb641954a87a (diff) | |
download | coderay-paint-integration.tar.gz |
Merge branch 'master' into paint-integrationpaint-integration
Diffstat (limited to 'lib/coderay/scanners/taskpaper.rb')
-rw-r--r-- | lib/coderay/scanners/taskpaper.rb | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/lib/coderay/scanners/taskpaper.rb b/lib/coderay/scanners/taskpaper.rb new file mode 100644 index 0000000..42670bc --- /dev/null +++ b/lib/coderay/scanners/taskpaper.rb @@ -0,0 +1,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 |