summaryrefslogtreecommitdiff
path: root/test/ripper/dummyparser.rb
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-02-06 03:18:44 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-02-06 03:18:44 +0000
commitb1986003bdcee30cf4e52c5638d3bc197195952b (patch)
treeeb7e2fdb5fdde5ed023d4a5d9f2569dd7668a4ba /test/ripper/dummyparser.rb
parent58195557b203972799cf84c3b224bf144bf5756f (diff)
* parse.y (words, qwords): dispatch array events. based on a
patch from Michael Edgar. [Bug #4365]. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30805 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ripper/dummyparser.rb')
-rw-r--r--test/ripper/dummyparser.rb38
1 files changed, 27 insertions, 11 deletions
diff --git a/test/ripper/dummyparser.rb b/test/ripper/dummyparser.rb
index 07a7eda..d9bd69e 100644
--- a/test/ripper/dummyparser.rb
+++ b/test/ripper/dummyparser.rb
@@ -130,44 +130,44 @@ class DummyParser < Ripper
on_args_add_block(m.children, b)
m
end
-
+
def on_paren(params)
params
end
-
+
def on_brace_block(params, code)
Node.new('block', params, code)
end
-
+
def on_block_var(params, shadow)
params
end
-
+
def on_rest_param(var)
"*#{var}"
end
-
+
def on_blockarg(var)
"&#{var}"
end
-
+
def on_params(required, optional, rest, more, block)
args = NodeList.new
-
+
required.each do |req|
args.push(req)
end if required
-
+
optional.each do |var, val|
args.push("#{var}=#{val}")
end if optional
-
+
args.push(rest) if rest
-
+
more.each do |m|
args.push(m)
end if more
-
+
args.push(block) if block
args
end
@@ -184,6 +184,22 @@ class DummyParser < Ripper
Node.new('assocs', *a)
end
+ def on_words_new
+ NodeList.new
+ end
+
+ def on_words_add(words, word)
+ words.push word
+ end
+
+ def on_qwords_new
+ NodeList.new
+ end
+
+ def on_qwords_add(words, word)
+ words.push word
+ end
+
(Ripper::PARSER_EVENTS.map(&:to_s) - instance_methods(false).map {|n|n.to_s.sub(/^on_/, '')}).each do |event|
define_method(:"on_#{event}") do |*args|
Node.new(event, *args)