4 ms·
I'd (probably) consider building and searching an index of ASTs (http://en.wikipedia.org/wiki/Abstract_syntax_tree http://en.wikipedia.org/wiki/Abstract_syntax_
by mc 17y ago
I'd (probably) consider building and searching an index of ASTs (http://en.wikipedia.org/wiki/Abstract_syntax_tree http://en.wikipedia.org/wiki/Abstract_syntax_tree).
Not only would it allow searching with regexp, but it could allow more sophisticated search queries like "Search all my Ruby code for blocks that rescue StandardError and are not followed by an ensure clause"
- gruseom 17y agoBut you'd have to do that separately for every language. Edit: the OP is such a great question. I've been saving up the joke of commenting "How is this Hacker News?" on the most literally appropriate HN post I run across... and almost used it on this one. Sadly, I probably never will.
- mc 17y ago> But you'd have to do that separately for every language. That's correct. It's one of the challenging parts.
- gruseom 17y agoIt's one of those ideas that would be best tried out on one instance first. It's not obvious that the ASTs of programs in different languages would be "A" enough for a generalized querying system to be useful. Still, I don't mean to shoot the idea down - it would make for an interesting experiment.