summaryrefslogtreecommitdiff
path: root/ext/ripper/tools/list-scan-event-ids.rb
blob: 28cd8bbe8a52dd9b4c4ff05946f9a6dd65b0a163 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# $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 - ['scan']).uniq
end

main