RubyFlow The Ruby and Rails community linklog

×

The Ruby and Rails community linklog

Made a library? Written a blog post? Found a useful tutorial? Share it with the Ruby community here or just enjoy what everyone else has found!

Regex Search on Arbitrary Sequences in Ruby

In working on Laser, an unreleased static analysis tool, I found need to do regex searching on arbitrary Arrays. This is the writeup, and this is the gem.

Comments

Hey, that’s pretty neat! First of all though, the link to your blog appears to be broken (asked me to sign in), but I read the article from the front page.

A while back I wanted to do something similar for doing static analysis in ruby, and came up with SexpPath which was used to do pattern matching against the S-Expressions that RubyParser output. You might find it interesting, for instance with the ruby specific DSL you could do sexp / R?{ _class } / R?{ _method } to get all the classes and their methods out of a S-Expression.

I actually did experiment with it in RubyScope. In the end though, it turns out that grep is faster.

Anyways, all that to say, this looks pretty neat. How stable is Ripper’s output though? A lot of things seemed to say ‘Experimental’ when I last looked at it, and it seems to be um… lightly documented.

Post a comment

You can use basic HTML markup (e.g. <a>) or Markdown.

As you are not logged in, you will be
directed via GitHub to signup or sign in