mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
98258515dd
* ext/ripper/tools/list-scan-event-ids.rb: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@6893 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
33 lines
557 B
Ruby
Executable file
33 lines
557 B
Ruby
Executable file
# $Id$
|
|
|
|
def main
|
|
if ARGV[0] == '-a'
|
|
with_arity = true
|
|
ARGV.delete_at 0
|
|
else
|
|
with_arity = false
|
|
end
|
|
extract_ids(ARGF).each do |id, arity|
|
|
if with_arity
|
|
puts "#{id} #{arity}"
|
|
else
|
|
puts id
|
|
end
|
|
end
|
|
end
|
|
|
|
def extract_ids(f)
|
|
results = []
|
|
f.each do |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]
|
|
end
|
|
end
|
|
end
|
|
results.uniq.sort
|
|
end
|
|
|
|
main
|