summaryrefslogtreecommitdiff
path: root/ext/ripper/lib/ripper/sexp.rb
diff options
context:
space:
mode:
authoraamine <aamine@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-09-17 12:02:35 +0000
committeraamine <aamine@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-09-17 12:02:35 +0000
commit3f483f7082ebe5865817f6b12d238abdcfe6e40d (patch)
tree6bc755611703e6ea1a40db0efa356bed1bac14ce /ext/ripper/lib/ripper/sexp.rb
parent50f5de149110e9f86d7a1b8d13e2c57639763b0c (diff)
* parse.y (ripper): rename event: arglist_* -> args_*.
* parse.y (ripper): rename event: restparam -> rest_param. * parse.y (ripper): rename event: constpath_* -> const_path_*. * parse.y (ripper): rename event: topconst_* -> top_const_*. * parse.y (ripper): rename event: iter_block -> method_add_block. * parse.y (ripper): support block local parameter declaration. * parse.y (ripper): introduce new macro params_new. * ext/ripper/lib/ripper/sexp.rb: should not dispose event arguments whose name ends with "_new" but arity != 0. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13465 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/ripper/lib/ripper/sexp.rb')
-rw-r--r--ext/ripper/lib/ripper/sexp.rb9
1 files changed, 4 insertions, 5 deletions
diff --git a/ext/ripper/lib/ripper/sexp.rb b/ext/ripper/lib/ripper/sexp.rb
index d841f9d..f2260fe 100644
--- a/ext/ripper/lib/ripper/sexp.rb
+++ b/ext/ripper/lib/ripper/sexp.rb
@@ -43,15 +43,14 @@ class Ripper
class SexpBuilderPP < ::Ripper #:nodoc:
private
- PARSER_EVENTS.each do |event|
- case event.to_s
- when /_new\z/
+ PARSER_EVENT_TABLE.each do |event, arity|
+ if /_new\z/ =~ event.to_s and arity == 0
module_eval(<<-End, __FILE__, __LINE__ + 1)
- def on_#{event}(*args)
+ def on_#{event}
[]
end
End
- when /_add\z/
+ elsif /_add\z/ =~ event.to_s
module_eval(<<-End, __FILE__, __LINE__ + 1)
def on_#{event}(list, item)
list.push item