summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormurphy <murphy@rubychan.de>2010-01-22 02:25:34 +0000
committermurphy <murphy@rubychan.de>2010-01-22 02:25:34 +0000
commitb042c57cedf7461aaad41b953d3e61bcf1ee647a (patch)
treeb992058b9fd89225fcb3648faec54dfebadcdc76
parent88a7c8532f3f86206c25c40b81fc2e25f6ae2593 (diff)
downloadcoderay-b042c57cedf7461aaad41b953d3e61bcf1ee647a.tar.gz
Added some coderay statistic scripts, and ansi-color experiments from
http://frexx.de/xterm-256-notes/.
-rw-r--r--etc/ansi-color/256colors2.pl63
-rw-r--r--etc/ansi-color/colortable16.sh48
-rw-r--r--etc/coderay-lib.tmproj6
-rw-r--r--etc/grafix/languages_over_time.rb28
-rw-r--r--etc/grafix/pie_graph.rb243
5 files changed, 385 insertions, 3 deletions
diff --git a/etc/ansi-color/256colors2.pl b/etc/ansi-color/256colors2.pl
new file mode 100644
index 0000000..c97c2be
--- /dev/null
+++ b/etc/ansi-color/256colors2.pl
@@ -0,0 +1,63 @@
+#!/usr/bin/perl
+# Author: Todd Larason <jtl@molehill.org>
+# $XFree86: xc/programs/xterm/vttests/256colors2.pl,v 1.2 2002/03/26 01:46:43 dickey Exp $
+
+# use the resources for colors 0-15 - usually more-or-less a
+# reproduction of the standard ANSI colors, but possibly more
+# pleasing shades
+
+# colors 16-231 are a 6x6x6 color cube
+for ($red = 0; $red < 6; $red++) {
+ for ($green = 0; $green < 6; $green++) {
+ for ($blue = 0; $blue < 6; $blue++) {
+ printf("\x1b]4;%d;rgb:%2.2x/%2.2x/%2.2x\x1b\\",
+ 16 + ($red * 36) + ($green * 6) + $blue,
+ ($red ? ($red * 40 + 55) : 0),
+ ($green ? ($green * 40 + 55) : 0),
+ ($blue ? ($blue * 40 + 55) : 0));
+ }
+ }
+}
+
+# colors 232-255 are a grayscale ramp, intentionally leaving out
+# black and white
+for ($gray = 0; $gray < 24; $gray++) {
+ $level = ($gray * 10) + 8;
+ printf("\x1b]4;%d;rgb:%2.2x/%2.2x/%2.2x\x1b\\",
+ 232 + $gray, $level, $level, $level);
+}
+
+
+# display the colors
+
+# first the system ones:
+print "System colors:\n";
+for ($color = 0; $color < 8; $color++) {
+ print "\x1b[48;5;${color}m ";
+}
+print "\x1b[0m\n";
+for ($color = 8; $color < 16; $color++) {
+ print "\x1b[48;5;${color}m ";
+}
+print "\x1b[0m\n\n";
+
+# now the color cube
+print "Color cube, 6x6x6:\n";
+for ($green = 0; $green < 6; $green++) {
+ for ($red = 0; $red < 6; $red++) {
+ for ($blue = 0; $blue < 6; $blue++) {
+ $color = 16 + ($red * 36) + ($green * 6) + $blue;
+ print "\x1b[48;5;${color}m ";
+ }
+ print "\x1b[0m ";
+ }
+ print "\n";
+}
+
+
+# now the grayscale ramp
+print "Grayscale ramp:\n";
+for ($color = 232; $color < 256; $color++) {
+ print "\x1b[48;5;${color}m ";
+}
+print "\x1b[0m\n";
diff --git a/etc/ansi-color/colortable16.sh b/etc/ansi-color/colortable16.sh
new file mode 100644
index 0000000..6281628
--- /dev/null
+++ b/etc/ansi-color/colortable16.sh
@@ -0,0 +1,48 @@
+#!/bin/bash
+#
+# Description:
+#
+# Prints a color table of 8bg * 8fg * 2 states (regular/bold)
+#
+# Copyright:
+#
+# (C) 2009 Wolfgang Frisch <xororand@unfoog.de>
+#
+# License:
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+echo
+echo Table for 16-color terminal escape sequences.
+echo Replace ESC with \\033 in bash.
+echo
+echo "Background | Foreground colors"
+echo "---------------------------------------------------------------------"
+for((bg=40;bg<=47;bg++)); do
+ for((bold=0;bold<=1;bold++)) do
+ echo -en "\033[0m"" ESC[${bg}m | "
+ for((fg=30;fg<=37;fg++)); do
+ if [ $bold == "0" ]; then
+ echo -en "\033[${bg}m\033[${fg}m [${fg}m "
+ else
+ echo -en "\033[${bg}m\033[1;${fg}m [1;${fg}m"
+ fi
+ done
+ echo -e "\033[0m"
+ done
+ echo "--------------------------------------------------------------------- "
+done
+
+echo
+echo
diff --git a/etc/coderay-lib.tmproj b/etc/coderay-lib.tmproj
index 4c2dd92..cf18b13 100644
--- a/etc/coderay-lib.tmproj
+++ b/etc/coderay-lib.tmproj
@@ -28,7 +28,7 @@
<key>filename</key>
<string>../diff</string>
<key>lastUsed</key>
- <date>2010-01-12T00:13:02Z</date>
+ <date>2010-01-20T02:08:54Z</date>
</dict>
<dict>
<key>filename</key>
@@ -114,7 +114,7 @@
<key>filename</key>
<string>../test/scanners/coderay_suite.rb</string>
<key>lastUsed</key>
- <date>2010-01-08T23:35:03Z</date>
+ <date>2010-01-20T02:49:19Z</date>
</dict>
<dict>
<key>filename</key>
@@ -134,7 +134,7 @@
<key>metaData</key>
<dict/>
<key>showFileHierarchyDrawer</key>
- <false/>
+ <true/>
<key>windowFrame</key>
<string>{{0, 4}, {850, 774}}</string>
</dict>
diff --git a/etc/grafix/languages_over_time.rb b/etc/grafix/languages_over_time.rb
new file mode 100644
index 0000000..bcebfcc
--- /dev/null
+++ b/etc/grafix/languages_over_time.rb
@@ -0,0 +1,28 @@
+require 'rubygems'
+require 'gruff'
+
+g = Gruff::Line.new
+g.title = 'Supported Languages in CodeRay'
+g.hide_dots = true
+
+data, labels = [0], {}
+repo_creation = Date.parse `svn info -r1`[/Last Changed Date: ([-\d]+)/,1]
+index = 1
+$stdout.sync = true
+for day in repo_creation..Date.today
+ if day.mday == 1 # only check on 1st day of the month
+ labels[index] = day.year.to_s if day.month == 1
+ index += 1
+ data << `svn ls lib/coderay/scanners -r{#{day}} | \\
+ grep '^[[:alpha:]]\\w\\+.rb' | wc -l`.to_i
+ print day, "\r"
+ end
+end
+puts
+
+g.data 'CodeRay', data
+g.labels = labels
+
+FILE = 'test/scanners/languages_over_time.png'
+g.write FILE
+`open #{FILE}`
diff --git a/etc/grafix/pie_graph.rb b/etc/grafix/pie_graph.rb
new file mode 100644
index 0000000..0463bb8
--- /dev/null
+++ b/etc/grafix/pie_graph.rb
@@ -0,0 +1,243 @@
+require 'rubygems'
+require 'gruff'
+
+g = Gruff::Pie.new
+g.title = 'CodeRay Scanner tests'
+
+data = {}
+other = 0
+DATA.read.scan(/>> Testing (.*?) scanner <<.*?^Finished in ([\d.]+)s/m) do |lang, secs|
+ secs = secs.to_f
+ if secs > 2
+ data[lang] = secs
+ else
+ p lang
+ other += secs
+ end
+end
+
+g.add_color '#ff9966'
+g.add_color '#889977'
+g.add_color '#dd77aa'
+g.add_color '#bbddaa'
+g.add_color '#aa8888'
+g.add_color '#77dd99'
+g.add_color '#555555'
+g.add_color '#eecccc'
+data.sort_by { |k, v| v }.reverse_each do |lang, secs|
+ g.data lang, secs
+end
+
+g.data 'other', other if other > 0
+p other
+
+FILE = 'test/scanners/tests_pie.png'
+g.write FILE
+`open #{FILE}`
+
+__END__
+~/ruby/coderay norandom=1 rake test:scanners
+(in /Users/murphy/ruby/coderay)
+Loaded suite CodeRay::Scanners
+Started
+
+ >> Testing C scanner <<
+
+Loading examples in test/scanners/c/*.in.c...7 examples found.
+ elvis 0.4K: incremental, shuffled, complete, identity, highlighting, finished in 0.00s.
+ empty 0.0K: incremental, -skipped- complete, identity, highlighting, finished in 0.00s.
+ error 0.0K: incremental, -skipped- complete, identity, highlighting, finished in 0.00s.
+ error2 0.0K: incremental, -skipped- complete, identity, highlighting, finished in 0.00s.
+ open-string 0.0K: incremental, -skipped- complete, identity, highlighting, finished in 0.00s.
+ ruby 2297.4K: incremental, shuffled, complete, identity, highlighting, finished in 5.62s ( 115 Ktok/s).
+ strange 3.7K: incremental, shuffled, complete, identity, highlighting, finished in 0.01s ( 110 Ktok/s).
+Finished in 15.59s.
+.
+ >> Testing C++ scanner <<
+
+Loading examples in test/scanners/cpp/*.in.cpp...4 examples found.
+ elvis 0.4K: incremental, shuffled, complete, identity, highlighting, finished in 0.00s.
+ eventmachine 180.4K: incremental, shuffled, complete, identity, highlighting, finished in 0.24s ( 133 Ktok/s).
+ pleac 57.2K: incremental, shuffled, complete, identity, highlighting, finished in 0.07s ( 137 Ktok/s).
+ wedekind 0.1K: incremental, shuffled, complete, identity, highlighting, finished in 0.00s.
+Finished in 1.75s.
+.
+ >> Testing CSS scanner <<
+
+Loading examples in test/scanners/css/*.in.css...5 examples found.
+ ignos-draconis 28.4K: incremental, shuffled, complete, identity, highlighting, finished in 0.07s ( 127 Ktok/s).
+ redmine 22.6K: incremental, shuffled, complete, identity, highlighting, finished in 0.06s ( 125 Ktok/s).
+ S5 7.0K: incremental, shuffled, complete, identity, highlighting, finished in 0.02s ( 131 Ktok/s).
+ standard 0.2K: incremental, shuffled, complete, identity, highlighting, finished in 0.00s.
+ yui 380.1K: incremental, shuffled, complete, identity, highlighting, finished in 1.07s ( 96 Ktok/s).
+Finished in 7.88s.
+.
+ >> Testing CodeRay Token Dump scanner <<
+
+Loading examples in test/scanners/debug/*.in.raydebug...2 examples found.
+ class 1.6K: incremental, shuffled, complete, identity, highlighting, finished in 0.00s ( 119 Ktok/s).
+ kate 8.5K: incremental, shuffled, complete, identity, highlighting, finished in 0.01s ( 125 Ktok/s).
+Finished in 1.72s.
+.
+ >> Testing Delphi scanner <<
+
+Loading examples in test/scanners/delphi/*.in.pas...2 examples found.
+ pluto 278.1K: incremental, shuffled, complete, identity, highlighting, finished in 0.81s ( 93 Ktok/s).
+ ytools 64.0K: incremental, shuffled, complete, identity, highlighting, finished in 0.36s ( 64 Ktok/s).
+Finished in 3.64s.
+.
+ >> Testing diff output scanner <<
+
+Loading examples in test/scanners/diff/*.in.diff...2 examples found.
+coderay200vs250 66.2K: incremental, shuffled, complete, identity, highlighting, finished in 0.05s ( 188 Ktok/s).
+ example 0.8K: incremental, shuffled, complete, identity, highlighting, finished in 0.00s.
+Finished in 0.69s.
+.
+ >> Testing Groovy scanner <<
+
+Loading examples in test/scanners/groovy/*.in.groovy...4 examples found.
+ pleac 381.2K: incremental, shuffled, complete, identity, highlighting, finished in 0.87s ( 88 Ktok/s).
+ raistlin77 14.4K: incremental, shuffled, complete, identity, highlighting, finished in 0.03s ( 124 Ktok/s).
+ strange 0.0K: incremental, shuffled, complete, identity, highlighting, finished in 0.00s.
+ strings 1.1K: incremental, shuffled, complete, identity, highlighting, finished in 0.00s ( 120 Ktok/s).
+Finished in 4.60s.
+.
+ >> Testing HTML scanner <<
+
+Loading examples in test/scanners/html/*.in.html...3 examples found.
+ ampersand 0.0K: incremental, -skipped- complete, identity, highlighting, finished in 0.00s.
+ coderay-output 123.0K: incremental, shuffled, complete, identity, highlighting, finished in 0.32s ( 137 Ktok/s).
+ tolkien 12.3K: incremental, shuffled, complete, identity, highlighting, finished in 0.02s ( 144 Ktok/s).
+Finished in 2.20s.
+.
+ >> Testing Java scanner <<
+
+Loading examples in test/scanners/java/*.in.java...1 example found.
+ jruby 1854.9K: incremental, shuffled, complete, identity, highlighting, finished in 3.62s ( 120 Ktok/s).
+Finished in 7.98s.
+.
+ >> Testing JavaScript scanner <<
+
+Loading examples in test/scanners/javascript/*.in.js...5 examples found.
+ prototype 126.7K: incremental, shuffled, complete, identity, highlighting, finished in 0.35s ( 122 Ktok/s).
+script.aculo.us 225.6K: incremental, shuffled, complete, identity, highlighting, finished in 0.59s ( 126 Ktok/s).
+ sun-spider 916.0K: incremental, shuffled, complete, identity, highlighting, finished in 1.82s ( 110 Ktok/s).
+ trace-test 151.1K: incremental, shuffled, complete, identity, highlighting, finished in 0.41s ( 133 Ktok/s).
+ xml 0.1K: incremental, shuffled, ticket ?, identity, highlighting, finished in 0.00s.
+ KNOWN ISSUE: JavaScript scanner is confused by nested XML literals.
+ No ticket yet. Visit http://redmine.rubychan.de/projects/coderay/issues/new.
+Finished in 10.07s.
+.
+ >> Testing JSON scanner <<
+
+Loading examples in test/scanners/json/*.in.json...4 examples found.
+ big 9.4K: incremental, shuffled, complete, identity, highlighting, finished in 0.02s ( 166 Ktok/s).
+ big2 7.4K: incremental, shuffled, complete, identity, highlighting, finished in 0.02s ( 173 Ktok/s).
+ example 0.5K: incremental, shuffled, complete, identity, highlighting, finished in 0.00s.
+ json-lib 1.7K: incremental, shuffled, complete, identity, highlighting, finished in 0.00s ( 163 Ktok/s).
+Finished in 3.85s.
+.
+ >> Testing Nitro XHTML scanner <<
+
+Loading examples in test/scanners/nitro/*.in.xhtml...1 example found.
+ tags 2.6K: incremental, shuffled, complete, identity, highlighting, finished in 0.01s ( 109 Ktok/s).
+Finished in 1.74s.
+.
+ >> Testing PHP scanner <<
+
+Loading examples in test/scanners/php/*.in.php...7 examples found.
+ class 1.5K: incremental, shuffled, complete, identity, highlighting, finished in 0.00s ( 112 Ktok/s).
+ elvis 0.4K: incremental, shuffled, complete, identity, highlighting, finished in 0.00s.
+html+php_faulty 0.0K: incremental, -skipped- complete, identity, highlighting, finished in 0.00s.
+ labels 0.5K: incremental, shuffled, complete, identity, highlighting, finished in 0.00s.
+ pleac 145.8K: incremental, shuffled, complete, identity, highlighting, finished in 0.59s ( 63 Ktok/s).
+ strings 9.4K: incremental, shuffled, complete, identity, highlighting, finished in 0.01s ( 119 Ktok/s).
+ test 16.7K: incremental, shuffled, complete, identity, highlighting, finished in 0.03s ( 114 Ktok/s).
+Finished in 5.18s.
+.
+ >> Testing Python scanner <<
+
+Loading examples in test/scanners/python/*.in.py...6 examples found.
+ import 1.1K: incremental, shuffled, complete, identity, highlighting, finished in 0.00s ( 135 Ktok/s).
+ literals 0.5K: incremental, shuffled, complete, identity, highlighting, finished in 0.00s.
+ pleac 297.2K: incremental, shuffled, complete, identity, highlighting, finished in 0.60s ( 133 Ktok/s).
+ pygments 953.6K: incremental, shuffled, complete, identity, highlighting, finished in 2.55s ( 118 Ktok/s).
+ python3 0.5K: incremental, shuffled, complete, identity, highlighting, finished in 0.00s.
+ unistring 394.8K: incremental, shuffled, complete, identity, highlighting, finished in 0.99s ( 69 Ktok/s).
+Finished in 11.30s.
+.
+ >> Testing HTML ERB Template scanner <<
+
+Loading examples in test/scanners/rhtml/*.in.rhtml...1 example found.
+ day 0.6K: incremental, shuffled, complete, identity, highlighting, finished in 0.00s.
+Finished in 0.91s.
+.
+ >> Testing Ruby scanner <<
+
+Loading examples in test/scanners/ruby/*.in.rb...26 examples found.
+ 1 18.4K: incremental, shuffled, complete, identity, highlighting, finished in 0.07s ( 112 Ktok/s).
+ besetzung 1.4K: incremental, shuffled, complete, identity, highlighting, finished in 0.00s ( 103 Ktok/s).
+ class 1.6K: incremental, shuffled, complete, identity, highlighting, finished in 0.01s ( 106 Ktok/s).
+ comment 0.1K: incremental, shuffled, complete, identity, highlighting, finished in 0.00s.
+ diffed 0.9K: incremental, shuffled, complete, identity, highlighting, finished in 0.00s.
+ evil 15.6K: incremental, shuffled, complete, identity, highlighting, finished in 0.06s ( 99 Ktok/s).
+ example 100.2K: incremental, shuffled, complete, identity, highlighting, finished in 0.21s ( 109 Ktok/s).
+ jarh 11.1K: incremental, shuffled, complete, identity, highlighting, finished in 0.04s ( 110 Ktok/s).
+ nested-heredoc 0.4K: incremental, shuffled, complete, identity, highlighting, finished in 0.00s.
+ open-heredoc 0.0K: incremental, -skipped- complete, identity, highlighting, finished in 0.00s.
+ open-inline 0.0K: incremental, -skipped- complete, identity, highlighting, finished in 0.00s.
+ open-string 0.0K: incremental, -skipped- complete, identity, highlighting, finished in 0.00s.
+ operators 0.6K: incremental, shuffled, complete, identity, highlighting, finished in 0.00s.
+ pleac 156.6K: incremental, shuffled, complete, identity, highlighting, finished in 0.37s ( 110 Ktok/s).
+ quotes 0.1K: incremental, shuffled, complete, identity, highlighting, finished in 0.00s.
+ rails 2634.1K: incremental, shuffled, complete, identity, highlighting, finished in 5.61s ( 94 Ktok/s).
+ regexp 0.5K: incremental, shuffled, complete, identity, highlighting, finished in 0.00s.
+ ruby19 0.1K: incremental, shuffled, complete, identity, highlighting, finished in 0.00s.
+ sidebarize 3.7K: incremental, shuffled, complete, identity, highlighting, finished in 0.02s ( 35 Ktok/s).
+ simple 0.0K: incremental, shuffled, complete, identity, highlighting, finished in 0.00s.
+ strange 17.5K: incremental, shuffled, complete, identity, highlighting, finished in 0.10s ( 91 Ktok/s).
+ test-fitter 0.6K: incremental, shuffled, complete, identity, highlighting, finished in 0.00s.
+ tk-calc 0.4K: incremental, shuffled, complete, identity, highlighting, finished in 0.00s.
+ undef 0.2K: incremental, shuffled, complete, identity, highlighting, finished in 0.00s.
+ unicode 0.5K: incremental, shuffled, complete, identity, highlighting, finished in 0.00s.
+ zero 0.0K: incremental, -skipped- complete, identity, highlighting, finished in 0.00s.
+Finished in 33.82s.
+.
+ >> Testing Scheme scanner <<
+
+Loading examples in test/scanners/scheme/*.in.scm...2 examples found.
+ pleac 143.7K: incremental, shuffled, complete, identity, highlighting, finished in 0.27s ( 141 Ktok/s).
+ strange 1.1K: incremental, shuffled, complete, identity, highlighting, finished in 0.00s ( 129 Ktok/s).
+Finished in 1.91s.
+.
+ >> Testing SQL scanner <<
+
+Loading examples in test/scanners/sql/*.in.sql...4 examples found.
+ create_tables 3.0K: incremental, shuffled, complete, identity, highlighting, finished in 0.01s ( 142 Ktok/s).
+ maintenance 1.0K: incremental, shuffled, complete, identity, highlighting, finished in 0.00s.
+ reference 2.7K: incremental, shuffled, complete, identity, highlighting, finished in 0.01s ( 145 Ktok/s).
+ selects 1.4K: incremental, shuffled, complete, identity, highlighting, finished in 0.00s ( 140 Ktok/s).
+Finished in 2.22s.
+.
+ >> Testing XML scanner <<
+
+Loading examples in test/scanners/xml/*.in.xml...1 example found.
+ kate 3.9K: incremental, shuffled, complete, identity, highlighting, finished in 0.01s ( 148 Ktok/s).
+Finished in 0.92s.
+.
+ >> Testing YAML scanner <<
+
+Loading examples in test/scanners/yaml/*.in.yml...8 examples found.
+ basic 24.5K: incremental, shuffled, complete, identity, highlighting, finished in 0.02s ( 121 Ktok/s).
+ database 0.6K: incremental, shuffled, complete, identity, highlighting, finished in 0.00s.
+ faq 16.2K: incremental, shuffled, complete, identity, highlighting, finished in 0.00s ( 123 Ktok/s).
+ gemspec 3.0K: incremental, shuffled, complete, identity, highlighting, finished in 0.00s ( 115 Ktok/s).
+ latex_entities 48.4K: incremental, shuffled, complete, identity, highlighting, finished in 0.08s ( 143 Ktok/s).
+ multiline 0.7K: incremental, shuffled, complete, identity, highlighting, finished in 0.00s.
+ threshold 22.6K: incremental, shuffled, complete, identity, highlighting, finished in 0.02s ( 113 Ktok/s).
+ website 3.7K: incremental, shuffled, complete, identity, highlighting, finished in 0.00s ( 109 Ktok/s).
+Finished in 5.33s.
+.
+Finished in 123.310808 seconds.
+
+20 tests, 0 assertions, 0 failures, 0 errors