masamune-ast 1.1.1 → 1.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/masamune/abstract_syntax_tree.rb +8 -0
- data/lib/masamune/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0cafe74abe55158e29178163ef544558f8e8d042d8adae0668a8625e1883c843
|
4
|
+
data.tar.gz: f0068f9e6783403ba0d17f65902c0ecfded0806424383c8d325168ce0b4c7a58
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b6647c5ea9745d2e1f842a0d0eea3de05e795c7afa9a3241cf9d6a87dd802c4c62e7c9fdb266afcbc8e54ffe51af25d9bacc32830d4f28009f9c34b2a4f733a8
|
7
|
+
data.tar.gz: d7781f44d57a0bca23d7a61eaed10cdb687431a66540433ac0e01f43c6a625cd05aea2cd06168b1ea980d2fffaa827634ba3633ca8a94950df2110a60d4f9f5c
|
data/Gemfile.lock
CHANGED
@@ -70,6 +70,14 @@ module Masamune
|
|
70
70
|
def brace_block_params
|
71
71
|
end
|
72
72
|
|
73
|
+
# @tree only shows comments as a type of `:void_stmt` and
|
74
|
+
# doesn't have a data node, so we get comments from @lex_nodes.
|
75
|
+
def comments(content: nil)
|
76
|
+
comments = @lex_nodes.select {|node| node.type == :comment}
|
77
|
+
comments.select {|comment| comment.token == content} if content
|
78
|
+
comments.map {|comment| {position: comment.position, token: comment.token}}
|
79
|
+
end
|
80
|
+
|
73
81
|
def all_methods
|
74
82
|
method_definitions + method_calls
|
75
83
|
end
|
data/lib/masamune/version.rb
CHANGED