summaryrefslogtreecommitdiff
path: root/lib/coderay/scanners/taskpaper.rb
diff options
context:
space:
mode:
authorKornelius Kalnbach <murphy@rubychan.de>2013-06-12 16:04:51 +0200
committerKornelius Kalnbach <murphy@rubychan.de>2013-06-12 16:04:51 +0200
commitaddcbd446066d0da1627112814e3ce1b8d404da0 (patch)
tree55a4a46e10e89afb185b014f28d4d769c0144948 /lib/coderay/scanners/taskpaper.rb
parent7d2c3e59d1691bcde16fc3e51d92797bfc9a2442 (diff)
parent40bd2ef5d33d32c3b3987da1d115b717259819e4 (diff)
downloadcoderay-addcbd446066d0da1627112814e3ce1b8d404da0.tar.gz
Merge branch 'master' into go-scanner
Diffstat (limited to 'lib/coderay/scanners/taskpaper.rb')
-rw-r--r--lib/coderay/scanners/taskpaper.rb36
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