summaryrefslogtreecommitdiff
path: root/test/ripper/dummyparser.rb
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-12-26 02:39:14 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-12-26 02:39:14 +0000
commitcc479b25ba715099ac721ad9d0b1b4237fa2b9f9 (patch)
treeaf9f6addc574d041d1105710ce2699b25fd293ca /test/ripper/dummyparser.rb
parent6d8c13bc61c465ab400a12e0a44e9de52f117b7b (diff)
* parse.y (stmt): missing ripper rule. i.e., `a::B ||= c 1'.
http://twitter.com/#!/wannabe53/status/18797576396472321 http://twitter.com/#!/wannabe53/status/18798416150663168 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30381 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ripper/dummyparser.rb')
-rw-r--r--test/ripper/dummyparser.rb14
1 files changed, 8 insertions, 6 deletions
diff --git a/test/ripper/dummyparser.rb b/test/ripper/dummyparser.rb
index ffc1f78..07a7eda 100644
--- a/test/ripper/dummyparser.rb
+++ b/test/ripper/dummyparser.rb
@@ -10,7 +10,7 @@ class Node
@children = nodes
end
- attr_reader :children
+ attr_reader :name, :children
def to_s
"#{@name}(#{Node.trim_nil(@children).map {|n| n.to_s }.join(',')})"
@@ -47,12 +47,14 @@ class NodeList
end
class DummyParser < Ripper
- def hook(name)
+ def hook(*names)
class << self; self; end.class_eval do
- define_method(name) do |*a, &b|
- result = super(*a, &b)
- yield(*a)
- result
+ names.each do |name|
+ define_method(name) do |*a, &b|
+ result = super(*a, &b)
+ yield(name, *a)
+ result
+ end
end
end
self