зеркало из 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>
|
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
|
||||||
|
|
Загрузка…
Ссылка в новой задаче