[macruby-changes] [4674] DietRB/trunk
source_changes at macosforge.org
source_changes at macosforge.org
Fri Oct 8 03:57:48 PDT 2010
Revision: 4674
http://trac.macosforge.org/projects/ruby/changeset/4674
Author: eloy.de.enige at gmail.com
Date: 2010-10-08 03:57:47 -0700 (Fri, 08 Oct 2010)
Log Message:
-----------
Finished implementing Wirble's colorizing of literals, not fully compliant with Range
From: Eloy Duran <eloy.de.enige at gmail.com>
Modified Paths:
--------------
DietRB/trunk/TODO
DietRB/trunk/lib/irb/ext/colorize.rb
DietRB/trunk/spec/colorize_spec.rb
Modified: DietRB/trunk/TODO
===================================================================
--- DietRB/trunk/TODO 2010-10-08 10:57:37 UTC (rev 4673)
+++ DietRB/trunk/TODO 2010-10-08 10:57:47 UTC (rev 4674)
@@ -3,4 +3,5 @@
* Make sure the following formatters work: hirb, awesome_print, and looksee
* Make sure the majority of the utils in utility_belt work
* Possibly add copy-paste support as an ext
-* Make sure ported/used code is attributed
\ No newline at end of file
+* Make sure ported/used code is attributed
+* Decide whether or not we need more control for colorizing which could be done with Ripper::SexpBuilder
\ No newline at end of file
Modified: DietRB/trunk/lib/irb/ext/colorize.rb
===================================================================
--- DietRB/trunk/lib/irb/ext/colorize.rb 2010-10-08 10:57:37 UTC (rev 4673)
+++ DietRB/trunk/lib/irb/ext/colorize.rb 2010-10-08 10:57:47 UTC (rev 4674)
@@ -48,13 +48,6 @@
:on_lbracket => :green,
:on_rbracket => :green,
- # object colors
- :open_object => :light_red,
- :object_class => :white,
- :object_addr_prefix => :blue,
- :object_line_prefix => :blue,
- :close_object => :light_red,
-
# symbol colors
:on_ident => :yellow, # hmm ident...
:on_symbeg => :yellow,
@@ -67,8 +60,14 @@
# misc colors
:on_int => :cyan,
:keyword => :green,
- :class => :light_green,
- :range => :red,
+ :on_const => :light_green,
+
+ # object colors
+ # :open_object => :light_red,
+ # :object_class => :white,
+ # :object_addr_prefix => :blue,
+ # :object_line_prefix => :blue,
+ # :close_object => :light_red,
}
#
@@ -91,7 +90,6 @@
:number => :cyan,
:string => :cyan,
:keyword => :white,
- :range => :light_blue,
}
attr_reader :colors
@@ -102,7 +100,7 @@
def colorize(str)
Ripper.lex(str).map do |_, type, token|
- p type, token
+ # p type, token
if color = colors[type]
"#{Color.escape(color)}#{token}#{Color::CLEAR}"
else
Modified: DietRB/trunk/spec/colorize_spec.rb
===================================================================
--- DietRB/trunk/spec/colorize_spec.rb 2010-10-08 10:57:37 UTC (rev 4673)
+++ DietRB/trunk/spec/colorize_spec.rb 2010-10-08 10:57:47 UTC (rev 4674)
@@ -10,9 +10,15 @@
end
it "colorizes a constant" do
- @formatter.result("Hash").should == "=> \e[1;32mHash\e[0;0m"
+ @formatter.result(Hash).should == "=> \e[1;32mHash\e[0;0m"
end
+ # Not Wirble compliant
+ it "colorizes a Range" do
+ # @formatter.result(1..3).should == "=> \e[0;36m1\e[0;0m\e[0;31m..\e[0;0m\e[0;36m3\e[0;0m"
+ @formatter.result(1..3).should == "=> \e[0;36m1\e[0;0m\e[0;34m..\e[0;0m\e[0;36m3\e[0;0m"
+ end
+
it "colorizes a String" do
@formatter.result("foo bar").should == "=> \e[0;31m\"\e[0;0m\e[0;36mfoo bar\e[0;0m\e[0;31m\"\e[0;0m"
end
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-changes/attachments/20101008/ac53c083/attachment.html>
More information about the macruby-changes
mailing list