summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
authoraamine <aamine@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2004-09-12 21:44:13 +0000
committeraamine <aamine@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2004-09-12 21:44:13 +0000
commit98258515dd70c65174cb19b09fb93c217957daab (patch)
tree906022d44655a0237c5342730c7c6f0b748ec911 /ext
parent5cdf9a0a199c1b380140de09ac467c3aa9bdaa69 (diff)
* 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
Diffstat (limited to 'ext')
-rwxr-xr-xext/ripper/tools/list-parse-event-ids.rb29
-rwxr-xr-xext/ripper/tools/list-scan-event-ids.rb25
2 files changed, 20 insertions, 34 deletions
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