[macruby-changes] [4758] DietRB/trunk

source_changes at macosforge.org source_changes at macosforge.org
Fri Oct 8 04:10:34 PDT 2010


Revision: 4758
          http://trac.macosforge.org/projects/ruby/changeset/4758
Author:   eloy.de.enige at gmail.com
Date:     2010-10-08 04:10:33 -0700 (Fri, 08 Oct 2010)
Log Message:
-----------
Increase the source level for strings and regexps.

From: Eloy Duran <eloy.de.enige at gmail.com>

Modified Paths:
--------------
    DietRB/trunk/lib/irb/source.rb
    DietRB/trunk/spec/source_spec.rb

Modified: DietRB/trunk/lib/irb/source.rb
===================================================================
--- DietRB/trunk/lib/irb/source.rb	2010-10-08 11:10:24 UTC (rev 4757)
+++ DietRB/trunk/lib/irb/source.rb	2010-10-08 11:10:33 UTC (rev 4758)
@@ -183,6 +183,36 @@
         @level -= 1
         super
       end
+
+      def on_tstring_beg(token)
+        @level += 1
+        super
+      end
+
+      def on_tstring_end(token)
+        @level -= 1
+        super
+      end
+
+      def on_qwords_beg(token)
+        @level += 1
+        super
+      end
+
+      def on_words_sep(token)
+        @level -= 1
+        super
+      end
+
+      def on_regexp_beg(token)
+        @level += 1
+        super
+      end
+
+      def on_regexp_end(token)
+        @level -= 1
+        super
+      end
     end
   end
 end

Modified: DietRB/trunk/spec/source_spec.rb
===================================================================
--- DietRB/trunk/spec/source_spec.rb	2010-10-08 11:10:24 UTC (rev 4757)
+++ DietRB/trunk/spec/source_spec.rb	2010-10-08 11:10:33 UTC (rev 4758)
@@ -186,8 +186,13 @@
     [
       ["lambda { |x|", "}"],
       ["{", "}"],
-      ['"#{', '}"'],
-      ["[", "]"]
+      ["[", "]"],
+      ["'", "'"],
+      ['"', '"'],
+      ["%{", "}"],
+      ["%w{", "}"],
+      ["%r{", "}"],
+      ["/", "/"]
     ].each do |open, close|
       reflect(open).level.should == 1
       reflect("#{open}\n#{close}").level.should == 0
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-changes/attachments/20101008/6ed36aaa/attachment-0001.html>


More information about the macruby-changes mailing list