2004-09-12 21:44:13 +00:00
|
|
|
# $Id$
|
2004-09-12 17:34:30 +00:00
|
|
|
|
|
|
|
def main
|
2004-09-12 21:44:13 +00:00
|
|
|
if ARGV[0] == '-a'
|
|
|
|
with_arity = true
|
|
|
|
ARGV.delete_at 0
|
|
|
|
else
|
|
|
|
with_arity = false
|
|
|
|
end
|
2004-09-12 17:34:30 +00:00
|
|
|
extract_ids(ARGF).each do |id, arity|
|
2004-09-12 21:44:13 +00:00
|
|
|
if with_arity
|
|
|
|
puts "#{id} #{arity}"
|
|
|
|
else
|
|
|
|
puts id
|
2004-09-12 17:34:30 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2004-09-12 21:44:13 +00:00
|
|
|
def extract_ids(f)
|
2005-09-19 05:40:47 +00:00
|
|
|
ids = {}
|
2004-09-12 17:34:30 +00:00
|
|
|
f.each do |line|
|
2005-09-19 05:40:47 +00:00
|
|
|
next if /\A\#\s*define\s+s?dispatch/ =~ line
|
|
|
|
next if /ripper_dispatch/ =~ line
|
2004-09-12 17:34:30 +00:00
|
|
|
if a = line.scan(/dispatch(\d)\((\w+)/)
|
|
|
|
a.each do |arity, event|
|
2005-09-19 05:40:47 +00:00
|
|
|
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
|
2004-09-12 17:34:30 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
2005-09-19 05:40:47 +00:00
|
|
|
ids.to_a.sort
|
2004-09-12 17:34:30 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
main
|