[macruby-changes] [4625] DietRB/trunk
source_changes at macosforge.org
source_changes at macosforge.org
Fri Oct 8 03:50:25 PDT 2010
Revision: 4625
http://trac.macosforge.org/projects/ruby/changeset/4625
Author: eloy.de.enige at gmail.com
Date: 2010-10-08 03:50:23 -0700 (Fri, 08 Oct 2010)
Log Message:
-----------
Only use level to judge whether or not the source is a code block.
From: Eloy Duran <eloy.de.enige at gmail.com>
Modified Paths:
--------------
DietRB/trunk/Rakefile
DietRB/trunk/lib/irb/source.rb
Modified: DietRB/trunk/Rakefile
===================================================================
--- DietRB/trunk/Rakefile 2010-10-08 10:50:15 UTC (rev 4624)
+++ DietRB/trunk/Rakefile 2010-10-08 10:50:23 UTC (rev 4625)
@@ -1,4 +1,4 @@
-task :default => :spec
+task :default => :run
desc "Run the specs"
task :spec do
@@ -10,6 +10,11 @@
sh "kicker -e 'rake spec' lib spec"
end
+desc "Run dietrb with ruby19"
+task :run do
+ sh "ruby19 -Ilib ./bin/dietrb"
+end
+
begin
require 'jeweler'
Jeweler::Tasks.new do |gemspec|
Modified: DietRB/trunk/lib/irb/source.rb
===================================================================
--- DietRB/trunk/lib/irb/source.rb 2010-10-08 10:50:15 UTC (rev 4624)
+++ DietRB/trunk/lib/irb/source.rb 2010-10-08 10:50:23 UTC (rev 4625)
@@ -37,12 +37,12 @@
@reflection ||= Reflector.new(source)
end
- class Reflector < Ripper::SexpBuilder
+ class Reflector < Ripper
def initialize(source)
super
@level = 0
@syntax_error = false
- @code_block = !parse.nil?
+ parse
end
# Returns the code block indentation level.
@@ -55,7 +55,8 @@
attr_reader :level
# Returns whether or not the source is a valid code block, but does not
- # take syntax errors into account.
+ # take syntax errors into account. In short, it's a valid code block if
+ # after parsing the level is at zero.
#
# For example, this is not a valid full code block:
#
@@ -65,7 +66,7 @@
#
# def foo; p :ok; end
def code_block?
- @code_block
+ @level == 0
end
# Returns whether or not the source contains a syntax error. However, it
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-changes/attachments/20101008/80802235/attachment.html>
More information about the macruby-changes
mailing list