decode 0.19.0 → 0.20.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data/bake/decode/index.rb +23 -0
- data/lib/decode/language/ruby/parser.rb +11 -6
- data/lib/decode/version.rb +1 -1
- data.tar.gz.sig +0 -0
- metadata +2 -2
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 742b2c4908ded7f357fdba5f4a65da4714720307a86dcce2ef6d7da2fbb3e8ec
|
4
|
+
data.tar.gz: 5c4f90dc81fc5706afb3b55c530c88fa520705a26d1998e7dec76349bb039653
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c8b3aaf6638b577b4efe790adac6689a0825afcb70644f8ae9d15990281bdc4d60bf052f46ed1fca548ec645edd573b94d35dd56b1b94528abbbab46f059bd9b
|
7
|
+
data.tar.gz: b9c6efcc4f6817924c95042c8c03b4fb6a040a5fc98e77d94cd19efa7d3c069ad7667c73bf1237196058f0c7b7ad7de6bf34a4ffcac20309bfdf610573987a91
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data/bake/decode/index.rb
CHANGED
@@ -29,3 +29,26 @@ def coverage(root)
|
|
29
29
|
|
30
30
|
$stderr.puts "#{documented}/#{total} definitions have documentation."
|
31
31
|
end
|
32
|
+
|
33
|
+
# Process the given source root and report on symbols.
|
34
|
+
# @parameter root [String] The root path to index.
|
35
|
+
def symbols(root)
|
36
|
+
require 'build/files/glob'
|
37
|
+
require 'decode/index'
|
38
|
+
|
39
|
+
paths = Build::Files::Path.expand(root).glob("**/*")
|
40
|
+
|
41
|
+
index = Decode::Index.new
|
42
|
+
index.update(paths)
|
43
|
+
|
44
|
+
index.trie.traverse do |path, node, descend|
|
45
|
+
level = path.size
|
46
|
+
puts "#{" " * level}#{path.inspect} -> #{node.values.inspect}"
|
47
|
+
|
48
|
+
if path.any?
|
49
|
+
puts "#{" " * level}#{path.join("::")}"
|
50
|
+
end
|
51
|
+
|
52
|
+
descend.call
|
53
|
+
end
|
54
|
+
end
|
@@ -74,10 +74,6 @@ module Decode
|
|
74
74
|
# Walk over the syntax tree and extract relevant definitions with their associated comments.
|
75
75
|
def walk_definitions(node, comments, parent = nil, &block)
|
76
76
|
case node.type
|
77
|
-
when :begin
|
78
|
-
node.children.each do |child|
|
79
|
-
walk_definitions(child, comments, parent, &block)
|
80
|
-
end
|
81
77
|
when :module
|
82
78
|
definition = Module.new(
|
83
79
|
node, nested_name_for(node.children[0]),
|
@@ -126,10 +122,13 @@ module Decode
|
|
126
122
|
|
127
123
|
yield definition
|
128
124
|
when :defs
|
125
|
+
extracted_comments = extract_comments_for(node, comments)
|
126
|
+
|
129
127
|
definition = Function.new(
|
130
128
|
node, node.children[1],
|
131
|
-
comments:
|
132
|
-
parent: parent,
|
129
|
+
comments: extracted_comments,
|
130
|
+
parent: scope_for(extracted_comments, parent, &block),
|
131
|
+
language: @language
|
133
132
|
)
|
134
133
|
|
135
134
|
yield definition
|
@@ -186,6 +185,12 @@ module Decode
|
|
186
185
|
walk_definitions(children, comments, definition, &block)
|
187
186
|
end
|
188
187
|
end
|
188
|
+
else
|
189
|
+
node.children.each do |child|
|
190
|
+
if child.is_a?(::Parser::AST::Node)
|
191
|
+
walk_definitions(child, comments, parent, &block) if child
|
192
|
+
end
|
193
|
+
end
|
189
194
|
end
|
190
195
|
end
|
191
196
|
|
data/lib/decode/version.rb
CHANGED
data.tar.gz.sig
CHANGED
Binary file
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: decode
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.20.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Samuel Williams
|
@@ -37,7 +37,7 @@ cert_chain:
|
|
37
37
|
Q2K9NVun/S785AP05vKkXZEFYxqG6EW012U4oLcFl5MySFajYXRYbuUpH6AY+HP8
|
38
38
|
voD0MPg1DssDLKwXyt1eKD/+Fq0bFWhwVM/1XiAXL7lyYUyOq24KHgQ2Csg=
|
39
39
|
-----END CERTIFICATE-----
|
40
|
-
date: 2023-
|
40
|
+
date: 2023-06-04 00:00:00.000000000 Z
|
41
41
|
dependencies:
|
42
42
|
- !ruby/object:Gem::Dependency
|
43
43
|
name: parser
|
metadata.gz.sig
CHANGED
Binary file
|