diff options
Diffstat (limited to 'lib/coderay/scanners')
-rw-r--r-- | lib/coderay/scanners/taskpaper.rb | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/lib/coderay/scanners/taskpaper.rb b/lib/coderay/scanners/taskpaper.rb new file mode 100644 index 0000000..c6eb3b3 --- /dev/null +++ b/lib/coderay/scanners/taskpaper.rb @@ -0,0 +1,34 @@ +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, :project) + elsif match = scan(/^-.+@done(?:\(.*)?.*$/) # completed task + encoder.text_token(match, :complete) + elsif match = scan(/^-.+$/) # task + encoder.text_token(match, :plain) + 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 |