From 04165c20fe286d3123eff634412bdf871fc9da41 Mon Sep 17 00:00:00 2001 From: aamine Date: Mon, 19 Sep 2005 05:40:47 +0000 Subject: * parse.y (do_block): do_block event dispatches 2 args. [ruby-dev:26964] * ext/ripper/lib/ripper/core.rb: updated. * ext/ripper/tools/list-parser-event-ids.rb: check arity mismatch. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@9225 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ext/ripper/lib/ripper/core.rb | 5 ----- ext/ripper/tools/list-parse-event-ids.rb | 16 +++++++++++----- 2 files changed, 11 insertions(+), 10 deletions(-) (limited to 'ext') diff --git a/ext/ripper/lib/ripper/core.rb b/ext/ripper/lib/ripper/core.rb index 3a50a40c83..b16f465c34 100644 --- a/ext/ripper/lib/ripper/core.rb +++ b/ext/ripper/lib/ripper/core.rb @@ -61,7 +61,6 @@ class Ripper :def => 3, :defined => 1, :defs => 5, - :do_block => 1, :do_block => 2, :dot2 => 2, :dot3 => 2, @@ -388,10 +387,6 @@ class Ripper a end - def on_do_block(a) - a - end - def on_do_block(a, b) a end diff --git a/ext/ripper/tools/list-parse-event-ids.rb b/ext/ripper/tools/list-parse-event-ids.rb index 84c7e4c445..a8566fcbcf 100755 --- a/ext/ripper/tools/list-parse-event-ids.rb +++ b/ext/ripper/tools/list-parse-event-ids.rb @@ -17,17 +17,23 @@ def main end def extract_ids(f) - results = [] + ids = {} f.each do |line| - next if /\A\#\s*define\s+s?dispatch/ === line - next if /ripper_dispatch/ === line + next if /\A\#\s*define\s+s?dispatch/ =~ line + next if /ripper_dispatch/ =~ line if a = line.scan(/dispatch(\d)\((\w+)/) a.each do |arity, event| - results.push [event, arity.to_i] + if ids[event] + unless ids[event] == arity.to_i + $stderr.puts "arity mismatch: #{event} (#{ids[event]} vs #{arity})" + exit 1 + end + end + ids[event] = arity.to_i end end end - results.uniq.sort + ids.to_a.sort end main -- cgit v1.2.3