blob: 96a0e51187885f8127266bfd38825298a0d62085 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
require 'set'
require 'coderay/simple_scanner_dsl'
module CodeRay
module Scanners
class SimpleScanner < Scanner
extend SimpleScannerDSL
class << self
def define_scan_tokens!
if ENV['PUTS']
puts CodeRay.scan(scan_tokens_code, :ruby).terminal
puts "callbacks: #{callbacks.size}"
end
class_eval <<-RUBY
def scan_tokens encoder, options
#{ scan_tokens_code.chomp.gsub(/^/, ' ' * 2) }
end
RUBY
end
end
def scan_tokens tokens, options
self.class.define_scan_tokens!
scan_tokens tokens, options
end
protected
def setup
@state = :initial
end
def close_groups encoder, states
# TODO
end
end
end
end
|