blob: d43cc9addac66d0f7f4edc3524d3825ec524d4f9 (
plain)
1
2
3
4
5
6
7
8
|
require 'coderay'
token_stream = CodeRay::TokenStream.new do |kind, text|
puts 'kind: %s, text size: %d.' % [kind, text.size]
end
token_stream << [:regexp, '/\d+/'] << [:space, "\n"]
#-> kind: rexpexp, text size: 5.
|