ruby_mod_kit 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/LICENSE.txt +21 -0
- data/README.md +99 -0
- data/examples/user.rb +83 -0
- data/examples/user.rbm +47 -0
- data/exe/ruby_mod_kit +5 -0
- data/lib/ruby_mod_kit/cli.rb +27 -0
- data/lib/ruby_mod_kit/generation.rb +170 -0
- data/lib/ruby_mod_kit/memo/class.rb +27 -0
- data/lib/ruby_mod_kit/memo/ivar.rb +42 -0
- data/lib/ruby_mod_kit/memo/method.rb +49 -0
- data/lib/ruby_mod_kit/memo/offset_memo.rb +26 -0
- data/lib/ruby_mod_kit/memo/parameter.rb +39 -0
- data/lib/ruby_mod_kit/memo.rb +73 -0
- data/lib/ruby_mod_kit/mission/fix_parse_error.rb +213 -0
- data/lib/ruby_mod_kit/mission/ivar_arg.rb +42 -0
- data/lib/ruby_mod_kit/mission/overload.rb +73 -0
- data/lib/ruby_mod_kit/mission/type_attr.rb +75 -0
- data/lib/ruby_mod_kit/mission/type_parameter.rb +39 -0
- data/lib/ruby_mod_kit/mission/type_return.rb +33 -0
- data/lib/ruby_mod_kit/mission.rb +40 -0
- data/lib/ruby_mod_kit/node/call_node.rb +30 -0
- data/lib/ruby_mod_kit/node/class_node.rb +37 -0
- data/lib/ruby_mod_kit/node/def_node.rb +57 -0
- data/lib/ruby_mod_kit/node/parameter_node.rb +42 -0
- data/lib/ruby_mod_kit/node/program_node.rb +23 -0
- data/lib/ruby_mod_kit/node/statements_node.rb +27 -0
- data/lib/ruby_mod_kit/node/symbol_node.rb +34 -0
- data/lib/ruby_mod_kit/node/untyped_node.rb +25 -0
- data/lib/ruby_mod_kit/node.rb +164 -0
- data/lib/ruby_mod_kit/offset_diff.rb +37 -0
- data/lib/ruby_mod_kit/transpiler.rb +20 -0
- data/lib/ruby_mod_kit/version.rb +7 -0
- data/lib/ruby_mod_kit.rb +59 -0
- data/ruby_mod_kit.gemspec +51 -0
- data/sig/generated/examples/user.rbs +60 -0
- data/sig/generated/ruby_mod_kit/cli.rbs +14 -0
- data/sig/generated/ruby_mod_kit/generation.rbs +101 -0
- data/sig/generated/ruby_mod_kit/memo/class.rbs +20 -0
- data/sig/generated/ruby_mod_kit/memo/ivar.rbs +30 -0
- data/sig/generated/ruby_mod_kit/memo/located.rbs +14 -0
- data/sig/generated/ruby_mod_kit/memo/method.rbs +37 -0
- data/sig/generated/ruby_mod_kit/memo/offset_memo.rbs +20 -0
- data/sig/generated/ruby_mod_kit/memo/parameter.rbs +33 -0
- data/sig/generated/ruby_mod_kit/memo/parameter_type.rbs +14 -0
- data/sig/generated/ruby_mod_kit/memo.rbs +41 -0
- data/sig/generated/ruby_mod_kit/mission/fix_parse_error.rbs +73 -0
- data/sig/generated/ruby_mod_kit/mission/ivar_arg.rbs +19 -0
- data/sig/generated/ruby_mod_kit/mission/overload.rbs +20 -0
- data/sig/generated/ruby_mod_kit/mission/type_attr.rbs +18 -0
- data/sig/generated/ruby_mod_kit/mission/type_parameter.rbs +18 -0
- data/sig/generated/ruby_mod_kit/mission/type_return.rbs +18 -0
- data/sig/generated/ruby_mod_kit/mission.rbs +25 -0
- data/sig/generated/ruby_mod_kit/node/call_node.rbs +25 -0
- data/sig/generated/ruby_mod_kit/node/class_node.rbs +29 -0
- data/sig/generated/ruby_mod_kit/node/def_node.rbs +39 -0
- data/sig/generated/ruby_mod_kit/node/parameter_node.rbs +26 -0
- data/sig/generated/ruby_mod_kit/node/program_node.rbs +16 -0
- data/sig/generated/ruby_mod_kit/node/statements_node.rbs +21 -0
- data/sig/generated/ruby_mod_kit/node/symbol_node.rbs +24 -0
- data/sig/generated/ruby_mod_kit/node/untyped_node.rbs +21 -0
- data/sig/generated/ruby_mod_kit/node.rbs +63 -0
- data/sig/generated/ruby_mod_kit/offset_diff.rbs +20 -0
- data/sig/generated/ruby_mod_kit/transpiler.rbs +11 -0
- data/sig/generated/ruby_mod_kit/version.rbs +5 -0
- data/sig/generated/ruby_mod_kit.rbs +33 -0
- data/sig/sorted_set.rbs +8 -0
- data/sig/thor.rbs +3 -0
- metadata +157 -0
@@ -0,0 +1,24 @@
|
|
1
|
+
# Generated from lib/ruby_mod_kit/node/symbol_node.rb with RBS::Inline
|
2
|
+
|
3
|
+
module RubyModKit
|
4
|
+
class Node
|
5
|
+
# Transpiler program node
|
6
|
+
class SymbolNode < Node
|
7
|
+
@prism_node: Prism::SymbolNode
|
8
|
+
|
9
|
+
@parent: Node
|
10
|
+
|
11
|
+
attr_reader prism_node: Prism::SymbolNode
|
12
|
+
|
13
|
+
attr_reader parent: Node
|
14
|
+
|
15
|
+
# @rbs prism_node: Prism::SymbolNode
|
16
|
+
# @rbs parent: Node
|
17
|
+
# @rbs return: void
|
18
|
+
def initialize: (Prism::SymbolNode prism_node, parent: Node) -> void
|
19
|
+
|
20
|
+
# @rbs return: nil | Symbol
|
21
|
+
def value: () -> (nil | Symbol)
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
# Generated from lib/ruby_mod_kit/node/untyped_node.rb with RBS::Inline
|
2
|
+
|
3
|
+
module RubyModKit
|
4
|
+
class Node
|
5
|
+
# Transpiler program node
|
6
|
+
class UntypedNode < Node
|
7
|
+
@prism_node: Prism::Node
|
8
|
+
|
9
|
+
@parent: Node
|
10
|
+
|
11
|
+
attr_reader prism_node: Prism::Node
|
12
|
+
|
13
|
+
attr_reader parent: Node
|
14
|
+
|
15
|
+
# @rbs prism_node: Prism::Node
|
16
|
+
# @rbs parent: Node
|
17
|
+
# @rbs return: void
|
18
|
+
def initialize: (Prism::Node prism_node, parent: Node) -> void
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,63 @@
|
|
1
|
+
# Generated from lib/ruby_mod_kit/node.rb with RBS::Inline
|
2
|
+
|
3
|
+
module RubyModKit
|
4
|
+
# The class of transpile node.
|
5
|
+
class Node
|
6
|
+
@location: Prism::Location
|
7
|
+
|
8
|
+
@children: Array[Node]
|
9
|
+
|
10
|
+
@ancestors: Array[Node]
|
11
|
+
|
12
|
+
attr_reader location: Prism::Location
|
13
|
+
|
14
|
+
# @rbs return: void
|
15
|
+
def initialize: () -> void
|
16
|
+
|
17
|
+
# @rbs return: Array[Node]
|
18
|
+
def children: () -> Array[Node]
|
19
|
+
|
20
|
+
# @rbs prism_node: Prism::Node
|
21
|
+
# @rbs return: Node
|
22
|
+
def wrap: (Prism::Node prism_node) -> Node
|
23
|
+
|
24
|
+
# @rbs return: Array[Node]
|
25
|
+
def ancestors: () -> Array[Node]
|
26
|
+
|
27
|
+
# @rbs return: Symbol
|
28
|
+
def name: () -> Symbol
|
29
|
+
|
30
|
+
# @rbs offset: Integer
|
31
|
+
# @rbs return: Node | nil
|
32
|
+
def node_at: (Integer offset) -> (Node | nil)
|
33
|
+
|
34
|
+
# @rbs offset: Integer
|
35
|
+
# @rbs return: Node::StatementsNode | nil
|
36
|
+
def statements_node_at: (Integer offset) -> (Node::StatementsNode | nil)
|
37
|
+
|
38
|
+
# @rbs offset: Integer
|
39
|
+
# @rbs return: Node::DefNode | nil
|
40
|
+
def def_node_at: (Integer offset) -> (Node::DefNode | nil)
|
41
|
+
|
42
|
+
# @rbs offset: Integer
|
43
|
+
# @rbs return: Node::ParameterNode | nil
|
44
|
+
def parameter_node_at: (Integer offset) -> (Node::ParameterNode | nil)
|
45
|
+
|
46
|
+
# @rbs offset: Integer
|
47
|
+
# @rbs return: Node::ClassNode | nil
|
48
|
+
def class_node_at: (Integer offset) -> (Node::ClassNode | nil)
|
49
|
+
|
50
|
+
# @rbs offset: Integer
|
51
|
+
# @rbs return: bool
|
52
|
+
def include?: (Integer offset) -> bool
|
53
|
+
|
54
|
+
# @rbs return: Prism::Node & Prism::_Node
|
55
|
+
def prism_node: () -> (Prism::Node & Prism::_Node)
|
56
|
+
|
57
|
+
# @rbs return: Integer
|
58
|
+
def offset: () -> Integer
|
59
|
+
|
60
|
+
# @rbs return: String
|
61
|
+
def inspect: () -> String
|
62
|
+
end
|
63
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
# Generated from lib/ruby_mod_kit/offset_diff.rb with RBS::Inline
|
2
|
+
|
3
|
+
module RubyModKit
|
4
|
+
# The class of offset differences.
|
5
|
+
class OffsetDiff
|
6
|
+
@diffs: SortedSet[[ Integer, Integer, Integer ]]
|
7
|
+
|
8
|
+
# @rbs return: void
|
9
|
+
def initialize: () -> void
|
10
|
+
|
11
|
+
# @rbs src_offset: Integer
|
12
|
+
# @rbs return: Integer
|
13
|
+
def []: (Integer src_offset) -> Integer
|
14
|
+
|
15
|
+
# @rbs src_offset: Integer
|
16
|
+
# @rbs new_diff: Integer
|
17
|
+
# @rbs return: void
|
18
|
+
def insert: (Integer src_offset, Integer new_diff) -> void
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
# Generated from lib/ruby_mod_kit/transpiler.rb with RBS::Inline
|
2
|
+
|
3
|
+
module RubyModKit
|
4
|
+
# The class of transpiler.
|
5
|
+
class Transpiler
|
6
|
+
# @rbs src: String
|
7
|
+
# @rbs filename: String | nil
|
8
|
+
# @rbs return: String
|
9
|
+
def transpile: (String src, ?filename: String | nil) -> String
|
10
|
+
end
|
11
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
# Generated from lib/ruby_mod_kit.rb with RBS::Inline
|
2
|
+
|
3
|
+
# The root namespace for ruby_mod_kit.
|
4
|
+
module RubyModKit
|
5
|
+
class Error < StandardError
|
6
|
+
end
|
7
|
+
|
8
|
+
class SyntaxError < ::SyntaxError
|
9
|
+
end
|
10
|
+
|
11
|
+
# @rbs file: String
|
12
|
+
# @rbs *args: String
|
13
|
+
# @rbs return: void
|
14
|
+
def self.execute_file: (String file, *String args) -> void
|
15
|
+
|
16
|
+
# @rbs file: String
|
17
|
+
# @rbs return: String
|
18
|
+
def self.transpile_file: (String file) -> String
|
19
|
+
|
20
|
+
# @rbs src: String
|
21
|
+
# @rbs filename: String | nil
|
22
|
+
# @rbs return: String
|
23
|
+
def self.transpile: (String src, ?filename: String | nil) -> String
|
24
|
+
|
25
|
+
# @rbs file: String
|
26
|
+
# @rbs *args: String
|
27
|
+
# @rbs return: void
|
28
|
+
def self.execute_rb_file: (String file, *String args) -> void
|
29
|
+
|
30
|
+
# @rbs path: String
|
31
|
+
# @rbs return: String
|
32
|
+
def self.rb_path: (String path) -> String
|
33
|
+
end
|
data/sig/sorted_set.rbs
ADDED
data/sig/thor.rbs
ADDED
metadata
ADDED
@@ -0,0 +1,157 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: ruby_mod_kit
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- wanabe
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2024-11-18 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: prism
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: sorted_set
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '1.0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '1.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: thor
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '1.3'
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '1.3'
|
55
|
+
description: ruby_mod_kit
|
56
|
+
email:
|
57
|
+
- s.wanabe@gmail.com
|
58
|
+
executables:
|
59
|
+
- ruby_mod_kit
|
60
|
+
extensions: []
|
61
|
+
extra_rdoc_files: []
|
62
|
+
files:
|
63
|
+
- LICENSE.txt
|
64
|
+
- README.md
|
65
|
+
- examples/user.rb
|
66
|
+
- examples/user.rbm
|
67
|
+
- exe/ruby_mod_kit
|
68
|
+
- lib/ruby_mod_kit.rb
|
69
|
+
- lib/ruby_mod_kit/cli.rb
|
70
|
+
- lib/ruby_mod_kit/generation.rb
|
71
|
+
- lib/ruby_mod_kit/memo.rb
|
72
|
+
- lib/ruby_mod_kit/memo/class.rb
|
73
|
+
- lib/ruby_mod_kit/memo/ivar.rb
|
74
|
+
- lib/ruby_mod_kit/memo/method.rb
|
75
|
+
- lib/ruby_mod_kit/memo/offset_memo.rb
|
76
|
+
- lib/ruby_mod_kit/memo/parameter.rb
|
77
|
+
- lib/ruby_mod_kit/mission.rb
|
78
|
+
- lib/ruby_mod_kit/mission/fix_parse_error.rb
|
79
|
+
- lib/ruby_mod_kit/mission/ivar_arg.rb
|
80
|
+
- lib/ruby_mod_kit/mission/overload.rb
|
81
|
+
- lib/ruby_mod_kit/mission/type_attr.rb
|
82
|
+
- lib/ruby_mod_kit/mission/type_parameter.rb
|
83
|
+
- lib/ruby_mod_kit/mission/type_return.rb
|
84
|
+
- lib/ruby_mod_kit/node.rb
|
85
|
+
- lib/ruby_mod_kit/node/call_node.rb
|
86
|
+
- lib/ruby_mod_kit/node/class_node.rb
|
87
|
+
- lib/ruby_mod_kit/node/def_node.rb
|
88
|
+
- lib/ruby_mod_kit/node/parameter_node.rb
|
89
|
+
- lib/ruby_mod_kit/node/program_node.rb
|
90
|
+
- lib/ruby_mod_kit/node/statements_node.rb
|
91
|
+
- lib/ruby_mod_kit/node/symbol_node.rb
|
92
|
+
- lib/ruby_mod_kit/node/untyped_node.rb
|
93
|
+
- lib/ruby_mod_kit/offset_diff.rb
|
94
|
+
- lib/ruby_mod_kit/transpiler.rb
|
95
|
+
- lib/ruby_mod_kit/version.rb
|
96
|
+
- ruby_mod_kit.gemspec
|
97
|
+
- sig/generated/examples/user.rbs
|
98
|
+
- sig/generated/ruby_mod_kit.rbs
|
99
|
+
- sig/generated/ruby_mod_kit/cli.rbs
|
100
|
+
- sig/generated/ruby_mod_kit/generation.rbs
|
101
|
+
- sig/generated/ruby_mod_kit/memo.rbs
|
102
|
+
- sig/generated/ruby_mod_kit/memo/class.rbs
|
103
|
+
- sig/generated/ruby_mod_kit/memo/ivar.rbs
|
104
|
+
- sig/generated/ruby_mod_kit/memo/located.rbs
|
105
|
+
- sig/generated/ruby_mod_kit/memo/method.rbs
|
106
|
+
- sig/generated/ruby_mod_kit/memo/offset_memo.rbs
|
107
|
+
- sig/generated/ruby_mod_kit/memo/parameter.rbs
|
108
|
+
- sig/generated/ruby_mod_kit/memo/parameter_type.rbs
|
109
|
+
- sig/generated/ruby_mod_kit/mission.rbs
|
110
|
+
- sig/generated/ruby_mod_kit/mission/fix_parse_error.rbs
|
111
|
+
- sig/generated/ruby_mod_kit/mission/ivar_arg.rbs
|
112
|
+
- sig/generated/ruby_mod_kit/mission/overload.rbs
|
113
|
+
- sig/generated/ruby_mod_kit/mission/type_attr.rbs
|
114
|
+
- sig/generated/ruby_mod_kit/mission/type_parameter.rbs
|
115
|
+
- sig/generated/ruby_mod_kit/mission/type_return.rbs
|
116
|
+
- sig/generated/ruby_mod_kit/node.rbs
|
117
|
+
- sig/generated/ruby_mod_kit/node/call_node.rbs
|
118
|
+
- sig/generated/ruby_mod_kit/node/class_node.rbs
|
119
|
+
- sig/generated/ruby_mod_kit/node/def_node.rbs
|
120
|
+
- sig/generated/ruby_mod_kit/node/parameter_node.rbs
|
121
|
+
- sig/generated/ruby_mod_kit/node/program_node.rbs
|
122
|
+
- sig/generated/ruby_mod_kit/node/statements_node.rbs
|
123
|
+
- sig/generated/ruby_mod_kit/node/symbol_node.rbs
|
124
|
+
- sig/generated/ruby_mod_kit/node/untyped_node.rbs
|
125
|
+
- sig/generated/ruby_mod_kit/offset_diff.rbs
|
126
|
+
- sig/generated/ruby_mod_kit/transpiler.rbs
|
127
|
+
- sig/generated/ruby_mod_kit/version.rbs
|
128
|
+
- sig/sorted_set.rbs
|
129
|
+
- sig/thor.rbs
|
130
|
+
homepage: https://github.com/wanabe/ruby_mod_kit
|
131
|
+
licenses:
|
132
|
+
- MIT
|
133
|
+
metadata:
|
134
|
+
homepage_uri: https://github.com/wanabe/ruby_mod_kit
|
135
|
+
source_code_uri: https://github.com/wanabe/ruby_mod_kit
|
136
|
+
changelog_uri: https://github.com/wanabe/ruby_mod_kit/blob/main/CHANGELOG.md
|
137
|
+
rubygems_mfa_required: 'true'
|
138
|
+
post_install_message:
|
139
|
+
rdoc_options: []
|
140
|
+
require_paths:
|
141
|
+
- lib
|
142
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
143
|
+
requirements:
|
144
|
+
- - ">="
|
145
|
+
- !ruby/object:Gem::Version
|
146
|
+
version: 2.7.0
|
147
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
148
|
+
requirements:
|
149
|
+
- - ">="
|
150
|
+
- !ruby/object:Gem::Version
|
151
|
+
version: '0'
|
152
|
+
requirements: []
|
153
|
+
rubygems_version: 3.5.22
|
154
|
+
signing_key:
|
155
|
+
specification_version: 4
|
156
|
+
summary: ruby_mod_kit
|
157
|
+
test_files: []
|