Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

32 lines (28 sloc) 0.662 kb
# author: Vincent Landgraf <setcool@gmx.de>
# licence: GPLv2.1
require "rubygems"
require "coderay"
module CodeRay
module Scanners
class Term < Scanner
include CodeRay::Streamable
register_for :term
def scan_tokens (tokens, options)
prev = nil
until eos?
line = scan(/.*?\n/)
if line =~ /^(\$)(.*)/
tokens << [$1, :prompt]
tokens << [$2 + "\n", :command]
elsif prev =~ /\\$/
tokens << [line, :command]
else
tokens << [line, :output]
end
prev = line
end
return tokens
end
end
end
end
Jump to Line
Something went wrong with that request. Please try again.