summaryrefslogtreecommitdiff
path: root/test/ripper/dummyparser.rb
diff options
context:
space:
mode:
Diffstat (limited to 'test/ripper/dummyparser.rb')
-rw-r--r--test/ripper/dummyparser.rb33
1 files changed, 33 insertions, 0 deletions
diff --git a/test/ripper/dummyparser.rb b/test/ripper/dummyparser.rb
index 05220dc897..6de7e19013 100644
--- a/test/ripper/dummyparser.rb
+++ b/test/ripper/dummyparser.rb
@@ -38,6 +38,11 @@ class NodeList
self
end
+ def concat(item)
+ @list.concat item
+ self
+ end
+
def prepend(items)
@list.unshift items
end
@@ -209,6 +214,34 @@ class DummyParser < Ripper
words.push word
end
+ def on_mlhs_new
+ NodeList.new
+ end
+
+ def on_mlhs_paren(list)
+ Node.new(:mlhs, list)
+ end
+
+ def on_mlhs_add(list, node)
+ list.push node
+ end
+
+ def on_mlhs_add_block(list, blk)
+ if blk
+ list.push('&' + blk.to_s)
+ else
+ list
+ end
+ end
+
+ def on_mlhs_add_star(list, arg)
+ list.push('*' + arg.to_s)
+ end
+
+ def on_mlhs_add_post(list, post)
+ list.concat(post.list)
+ end
+
def on_rescue(exc, *rest)
Node.new('rescue', (exc && NodeList.new(exc)), *rest)
end