* ext/ripper/tools/list-parse-event-ids.rb: does not use getopts.

* 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
This commit is contained in:
aamine 2004-09-12 21:44:13 +00:00
Родитель 5cdf9a0a19
Коммит 98258515dd
3 изменённых файлов: 26 добавлений и 34 удалений

Просмотреть файл

@ -1,3 +1,9 @@
Mon Sep 13 06:43:42 2004 Minero Aoki <aamine@loveruby.net>
* ext/ripper/tools/list-parse-event-ids.rb: does not use getopts.
* ext/ripper/tools/list-scan-event-ids.rb: ditto.
Mon Sep 13 02:42:28 2004 Minero Aoki <aamine@loveruby.net> Mon Sep 13 02:42:28 2004 Minero Aoki <aamine@loveruby.net>
* ext/Setup: add ripper. * ext/Setup: add ripper.

Просмотреть файл

@ -1,27 +1,22 @@
# # $Id$
# list-parse-event-ids.rb
#
require 'getopts'
def usage( status )
(status == 0 ? $stdout : $stderr).print(<<EOS)
Usage: #{File.basename($0)} [-a] filename
EOS
exit status
end
def main def main
getopts('a') or usage(1) if ARGV[0] == '-a'
with_arity = true
ARGV.delete_at 0
else
with_arity = false
end
extract_ids(ARGF).each do |id, arity| extract_ids(ARGF).each do |id, arity|
if $OPT_a if with_arity
then puts "#{id} #{arity}" puts "#{id} #{arity}"
else puts id else
puts id
end end
end end
end end
def extract_ids( f ) def extract_ids(f)
results = [] results = []
f.each do |line| f.each do |line|
next if /\A\#\s*define\s+s?dispatch/ === line next if /\A\#\s*define\s+s?dispatch/ === line

Просмотреть файл

@ -1,23 +1,14 @@
# # $Id$
# list-scan-event-ids.rb
#
require 'getopts'
def usage(status)
(status == 0 ? $stdout : $stderr).puts(<<EOS)
Usage: #{File.basename($0)} eventids2.c
-a print IDs with arity.
EOS
exit status
end
def main def main
ok = getopts('a', 'help') if ARGV.first == '-a'
usage 0 if $OPT_help with_arity = true
usage 1 unless ok ARGV.delete_at 0
else
with_arity = false
end
extract_ids(ARGF).sort.each do |id| extract_ids(ARGF).sort.each do |id|
if $OPT_a if with_arity
puts "#{id} 1" puts "#{id} 1"
else else
puts id puts id