Ruby syntaxtree: Difference between revisions
From wikinotes
No edit summary |
|||
(2 intermediate revisions by the same user not shown) | |||
Line 2: | Line 2: | ||
node-types all defined within [https://github.com/ruby-syntax-tree/syntax_tree/blob/main/lib/syntax_tree/node.rb node.rb] | node-types all defined within [https://github.com/ruby-syntax-tree/syntax_tree/blob/main/lib/syntax_tree/node.rb node.rb] | ||
= Documentation = | |||
<blockquote> | |||
{| class="wikitable" | |||
|- | |||
| github || https://github.com/ruby-syntax-tree/syntax_tree | |||
|- | |||
| api docs (and avail AST nodes!) || https://ruby-syntax-tree.github.io/syntax_tree/table_of_contents.html#classes | |||
|- | |||
|} | |||
</blockquote><!-- Documentation --> | |||
<source lang="bash"> | <source lang="bash"> | ||
stree match /some/file.rb # generate matcher code | |||
stree search 'VarRef' /some/file.rb # search for code | |||
stree search 'VarRef[value: Const[value: "MyModule"]]' **/*.rb | stree search 'VarRef[value: Const[value: "MyModule"]]' **/*.rb | ||
stree search 'ConstPathRef[VarRef[value: Const[value: "MyModule"]],Const[value: "MyClass"]]' **/*.rb | stree search 'ConstPathRef[VarRef[value: Const[value: "MyModule"]],Const[value: "MyClass"]]' **/*.rb | ||
</source> | </source> |
Latest revision as of 00:25, 1 February 2024
a very fast ruby ast
node-types all defined within node.rb
Documentation
github https://github.com/ruby-syntax-tree/syntax_tree api docs (and avail AST nodes!) https://ruby-syntax-tree.github.io/syntax_tree/table_of_contents.html#classes
stree match /some/file.rb # generate matcher code
stree search 'VarRef' /some/file.rb # search for code
stree search 'VarRef[value: Const[value: "MyModule"]]' **/*.rb
stree search 'ConstPathRef[VarRef[value: Const[value: "MyModule"]],Const[value: "MyClass"]]' **/*.rb