зеркало из https://github.com/github/ruby.git
* 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:
Родитель
5cdf9a0a19
Коммит
98258515dd
|
@ -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
|
||||
|
|
Загрузка…
Ссылка в новой задаче