diff options
author | murphy <murphy@rubychan.de> | 2005-10-04 04:04:07 +0000 |
---|---|---|
committer | murphy <murphy@rubychan.de> | 2005-10-04 04:04:07 +0000 |
commit | 48e144a20829faaeca9a7db8fbc6128f1f5d7297 (patch) | |
tree | 24326041ae8a5cc12a87ab96b8cdc67dba1e585e /lib/coderay/encoders/statistic.rb | |
parent | 0ae9f844faf25d3be9f6fe5f8157f6bfebb30942 (diff) | |
download | coderay-48e144a20829faaeca9a7db8fbc6128f1f5d7297.tar.gz |
Two new encoders: debug and xml.
encoder.rb: new token handling
encoders/statistic.rb: using new handling
ruby_helper.rb: small improvements
ruby.rb:
- escapes in subtoken
- Float detection changed
- some multi-char operators are now scanned as one token
- def and module definition handling changed
bin/coderay: improved, new interface (still in progress)
plugin.rb: more expressive load error message
Diffstat (limited to 'lib/coderay/encoders/statistic.rb')
-rw-r--r-- | lib/coderay/encoders/statistic.rb | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/lib/coderay/encoders/statistic.rb b/lib/coderay/encoders/statistic.rb index 0685c03..cd26272 100644 --- a/lib/coderay/encoders/statistic.rb +++ b/lib/coderay/encoders/statistic.rb @@ -22,17 +22,22 @@ module CodeRay module Encoders super
end
- def token text, type
+ def text_token text, kind
+ @real_token_count += 1 unless kind == :space
+ @type_stats[kind].count += 1
+ @type_stats[kind].size += text.size
+ @type_stats['TOTAL'].size += text.size
+ end
+
+ # TODO Hierarchy handling
+ def block_token action, kind
+ #@content_type = kind
+ @type_stats['open/close'].count += 1
+ end
+
+ def token text, kind
+ super
@type_stats['TOTAL'].count += 1
- if text.is_a? String
- @real_token_count += 1 unless type == :space
- @type_stats[type].count += 1
- @type_stats[type].size += text.size
- @type_stats['TOTAL'].size += text.size
- else
- @content_type = type
- @type_stats['open/close'].count += 1
- end
end
STATS = <<-STATS
|