rbs 1.2.0 → 1.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +9 -0
- data/docs/sigs.md +3 -1
- data/lib/rbs/parser.rb +108 -109
- data/lib/rbs/parser.y +0 -1
- data/lib/rbs/version.rb +1 -1
- data/rbs.gemspec +1 -1
- data/steep/Gemfile.lock +12 -12
- metadata +3 -12
- data/bin/annotate-with-rdoc +0 -153
- data/bin/console +0 -14
- data/bin/query-rdoc +0 -103
- data/bin/rbs-prof +0 -9
- data/bin/run_in_md.rb +0 -49
- data/bin/setup +0 -8
- data/bin/sort +0 -89
- data/bin/steep +0 -4
- data/bin/test_runner.rb +0 -29
data/bin/setup
DELETED
data/bin/sort
DELETED
@@ -1,89 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
require "bundler/setup"
|
4
|
-
require "rbs"
|
5
|
-
|
6
|
-
Members = RBS::AST::Members
|
7
|
-
|
8
|
-
def group(member)
|
9
|
-
case member
|
10
|
-
when Members::Include, Members::Extend, Members::Prepend
|
11
|
-
0
|
12
|
-
when Members::ClassVariable
|
13
|
-
-3
|
14
|
-
when Members::ClassInstanceVariable
|
15
|
-
-2
|
16
|
-
when Members::InstanceVariable
|
17
|
-
-1
|
18
|
-
when Members::AttrAccessor, Members::AttrWriter, Members::AttrReader
|
19
|
-
2
|
20
|
-
when Members::MethodDefinition
|
21
|
-
if member.singleton?
|
22
|
-
if member.name == :new
|
23
|
-
0.4
|
24
|
-
else
|
25
|
-
1
|
26
|
-
end
|
27
|
-
else
|
28
|
-
if member.name == :initialize
|
29
|
-
0.5
|
30
|
-
else
|
31
|
-
3
|
32
|
-
end
|
33
|
-
end
|
34
|
-
when Members::Alias
|
35
|
-
if member.singleton?
|
36
|
-
1
|
37
|
-
else
|
38
|
-
3
|
39
|
-
end
|
40
|
-
when Members::Private, Members::Public
|
41
|
-
-4
|
42
|
-
end
|
43
|
-
end
|
44
|
-
|
45
|
-
def key(member)
|
46
|
-
case member
|
47
|
-
when Members::Include, Members::Extend, Members::Prepend
|
48
|
-
member.name.to_s
|
49
|
-
when Members::ClassVariable, Members::ClassInstanceVariable, Members::InstanceVariable
|
50
|
-
member.name.to_s
|
51
|
-
when Members::AttrAccessor, Members::AttrWriter, Members::AttrReader
|
52
|
-
member.name.to_s
|
53
|
-
when Members::MethodDefinition
|
54
|
-
member.name.to_s
|
55
|
-
when Members::Alias
|
56
|
-
member.new_name.to_s
|
57
|
-
else
|
58
|
-
1
|
59
|
-
end
|
60
|
-
end
|
61
|
-
|
62
|
-
ARGV.map {|f| Pathname(f) }.each do |path|
|
63
|
-
puts "Opening #{path}..."
|
64
|
-
|
65
|
-
buffer = RBS::Buffer.new(name: path, content: path.read)
|
66
|
-
sigs = RBS::Parser.parse_signature(buffer)
|
67
|
-
|
68
|
-
sigs.each do |sig|
|
69
|
-
case sig
|
70
|
-
when RBS::AST::Declarations::Class, RBS::AST::Declarations::Module, RBS::AST::Declarations::Interface
|
71
|
-
sig.members.sort! do |m1, m2|
|
72
|
-
group1 = group(m1)
|
73
|
-
group2 = group(m2)
|
74
|
-
|
75
|
-
if group1 == group2
|
76
|
-
key(m1) <=> key(m2)
|
77
|
-
else
|
78
|
-
group1 <=> group2
|
79
|
-
end
|
80
|
-
end
|
81
|
-
end
|
82
|
-
end
|
83
|
-
|
84
|
-
puts "Writing #{path}..."
|
85
|
-
path.open('w') do |out|
|
86
|
-
writer = RBS::Writer.new(out: out)
|
87
|
-
writer.write sigs
|
88
|
-
end
|
89
|
-
end
|
data/bin/steep
DELETED
data/bin/test_runner.rb
DELETED
@@ -1,29 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
$LOAD_PATH << File.join(__dir__, "../lib")
|
4
|
-
|
5
|
-
require "set"
|
6
|
-
|
7
|
-
IS_LATEST_RUBY = Gem::Version.new(RUBY_VERSION).yield_self do |ruby_version|
|
8
|
-
Gem::Version.new('3.0.0') <= ruby_version && ruby_version < Gem::Version.new('3.1.0')
|
9
|
-
end
|
10
|
-
|
11
|
-
unless IS_LATEST_RUBY
|
12
|
-
STDERR.puts "⚠️⚠️⚠️⚠️ stdlib test assumes Ruby 3.0 but RUBY_VERSION==#{RUBY_VERSION} ⚠️⚠️⚠️⚠️"
|
13
|
-
end
|
14
|
-
|
15
|
-
KNOWN_FAILS = %w(dbm).map do |lib|
|
16
|
-
/cannot load such file -- #{lib}/
|
17
|
-
end
|
18
|
-
|
19
|
-
ARGV.each do |arg|
|
20
|
-
begin
|
21
|
-
load arg
|
22
|
-
rescue LoadError => exn
|
23
|
-
if KNOWN_FAILS.any? {|pat| pat =~ exn.message }
|
24
|
-
STDERR.puts "Loading #{arg} failed, ignoring it: #{exn.inspect}"
|
25
|
-
else
|
26
|
-
raise
|
27
|
-
end
|
28
|
-
end
|
29
|
-
end
|