diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-07-01 01:29:22 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-07-01 01:29:22 +0000 |
commit | 046f8469f322756c4fb7676e551ed7d62e4d629f (patch) | |
tree | bb90b71ec58be98adf8c7acec847033a0a8cdc6b /test/ripper/dummyparser.rb | |
parent | 24171da2226cf82bdd46b691d56ccffafb6b30b4 (diff) | |
download | ruby-046f8469f322756c4fb7676e551ed7d62e4d629f.tar.gz |
test_parser_events.rb: simplify
* test/ripper/dummyparser.rb (DummyParser): simplified mlhs node
representation.
* test/ripper/test_parser_events.rb (test_mlhs_add_star):
simplified assertions.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59243 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ripper/dummyparser.rb')
-rw-r--r-- | test/ripper/dummyparser.rb | 33 |
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 |