diff options
-rw-r--r-- | ChangeLog | 6 | ||||
-rwxr-xr-x | ext/ripper/tools/list-parse-event-ids.rb | 29 | ||||
-rwxr-xr-x | ext/ripper/tools/list-scan-event-ids.rb | 25 |
3 files changed, 26 insertions, 34 deletions
@@ -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. diff --git a/ext/ripper/tools/list-parse-event-ids.rb b/ext/ripper/tools/list-parse-event-ids.rb index 2936f9b092..84c7e4c445 100755 --- a/ext/ripper/tools/list-parse-event-ids.rb +++ b/ext/ripper/tools/list-parse-event-ids.rb @@ -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 diff --git a/ext/ripper/tools/list-scan-event-ids.rb b/ext/ripper/tools/list-scan-event-ids.rb index 6f25362b5d..28cd8bbe8a 100755 --- a/ext/ripper/tools/list-scan-event-ids.rb +++ b/ext/ripper/tools/list-scan-event-ids.rb @@ -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 |