summaryrefslogtreecommitdiff
path: root/ext/ripper/tools
diff options
context:
space:
mode:
Diffstat (limited to 'ext/ripper/tools')
-rwxr-xr-xext/ripper/tools/generate-eventids1.rb16
-rwxr-xr-xext/ripper/tools/generate-ripper_rb.rb60
-rwxr-xr-xext/ripper/tools/list-parse-event-ids.rb39
-rwxr-xr-xext/ripper/tools/list-scan-event-ids.rb23
4 files changed, 0 insertions, 138 deletions
diff --git a/ext/ripper/tools/generate-eventids1.rb b/ext/ripper/tools/generate-eventids1.rb
deleted file mode 100755
index ec7ec4949a..0000000000
--- a/ext/ripper/tools/generate-eventids1.rb
+++ /dev/null
@@ -1,16 +0,0 @@
-# $Id$
-
-ids = File.readlines(ARGV[0]).map {|s| s.split[0] }
-
-ids.each do |id|
- puts "static ID ripper_id_#{id};"
-end
-
-puts
-puts 'static void'
-puts 'ripper_init_eventids1()'
-puts '{'
-ids.each do |id|
- puts %Q[ ripper_id_#{id} = rb_intern("on_#{id}");]
-end
-puts '}'
diff --git a/ext/ripper/tools/generate-ripper_rb.rb b/ext/ripper/tools/generate-ripper_rb.rb
deleted file mode 100755
index 5c06ca40a4..0000000000
--- a/ext/ripper/tools/generate-ripper_rb.rb
+++ /dev/null
@@ -1,60 +0,0 @@
-# $Id$
-
-def main
- template, ids1, ids2 = *ARGV
- print <<header
-# This file is automatically generated from #{File.basename(template)} and parse.y.
-# DO NOT MODIFY!!!!!!
-
-header
- File.foreach(template) do |line|
- case line
- when /\A\#include ids1/
- print_items read_ids(ids1)
- when /\A\#include ids2/
- print_items read_ids(ids2)
- when /\A\#include handlers1/
- File.foreach(ids1) do |line|
- id, arity = line.split
- arity = arity.to_i
- puts
- puts " def on_#{id}#{paramdecl(arity)}"
- puts " #{arity == 0 ? 'nil' : 'a'}"
- puts " end"
- end
- when /\A\#include handlers2/
- File.foreach(ids2) do |line|
- id, arity = line.split
- arity = arity.to_i
- puts
- puts " def on_#{id}(token)"
- puts " token"
- puts " end"
- end
- when /\A\#include (.*)/
- raise "unknown operation: #include #{$1}"
- else
- print line
- end
- end
-end
-
-def print_items(ids)
- comma = ''
- ids.each do |id, arity|
- print comma; comma = ",\n"
- print " #{id.intern.inspect} => #{arity}"
- end
- puts
-end
-
-def read_ids(path)
- File.readlines(path).map {|line| line.split }
-end
-
-def paramdecl(n)
- return '' if n == 0
- '(' + %w(a b c d e f g h i j k l m)[0, n].join(', ') + ')'
-end
-
-main
diff --git a/ext/ripper/tools/list-parse-event-ids.rb b/ext/ripper/tools/list-parse-event-ids.rb
deleted file mode 100755
index a8566fcbcf..0000000000
--- a/ext/ripper/tools/list-parse-event-ids.rb
+++ /dev/null
@@ -1,39 +0,0 @@
-# $Id$
-
-def main
- if ARGV[0] == '-a'
- with_arity = true
- ARGV.delete_at 0
- else
- with_arity = false
- end
- extract_ids(ARGF).each do |id, arity|
- if with_arity
- puts "#{id} #{arity}"
- else
- puts id
- end
- end
-end
-
-def extract_ids(f)
- ids = {}
- f.each do |line|
- next if /\A\#\s*define\s+s?dispatch/ =~ line
- next if /ripper_dispatch/ =~ line
- if a = line.scan(/dispatch(\d)\((\w+)/)
- a.each do |arity, event|
- if ids[event]
- unless ids[event] == arity.to_i
- $stderr.puts "arity mismatch: #{event} (#{ids[event]} vs #{arity})"
- exit 1
- end
- end
- ids[event] = arity.to_i
- end
- end
- end
- ids.to_a.sort
-end
-
-main
diff --git a/ext/ripper/tools/list-scan-event-ids.rb b/ext/ripper/tools/list-scan-event-ids.rb
deleted file mode 100755
index 670ae9ed09..0000000000
--- a/ext/ripper/tools/list-scan-event-ids.rb
+++ /dev/null
@@ -1,23 +0,0 @@
-# $Id$
-
-def main
- if ARGV.first == '-a'
- with_arity = true
- ARGV.delete_at 0
- else
- with_arity = false
- end
- extract_ids(ARGF).sort.each do |id|
- if with_arity
- puts "#{id} 1"
- else
- puts id
- end
- end
-end
-
-def extract_ids(f)
- f.read.scan(/ripper_id_(\w+)/).flatten.uniq
-end
-
-main