Ruby syntaxtree

From wikinotes

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