* 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>
* ext/Setup: add ripper.

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

@ -1,27 +1,22 @@
#
# 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
# $Id$
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|
if $OPT_a
then puts "#{id} #{arity}"
else puts id
if with_arity
puts "#{id} #{arity}"
else
puts id
end
end
end
def extract_ids( f )
def extract_ids(f)
results = []
f.each do |line|
next if /\A\#\s*define\s+s?dispatch/ === line

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

@ -1,23 +1,14 @@
#
# 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
# $Id$
def main
ok = getopts('a', 'help')
usage 0 if $OPT_help
usage 1 unless ok
if ARGV.first == '-a'
with_arity = true
ARGV.delete_at 0
else
with_arity = false
end
extract_ids(ARGF).sort.each do |id|
if $OPT_a
if with_arity
puts "#{id} 1"
else
puts id