Tom Lane wrote:
> I wouldn't recommend trying to use a standard FTS to index code:
> code is not a natural language and the kinds of searches you usually
> want to perform are a lot different. As an example, I glimpse for
> "foo" when looking for references to a function foo, but "^foo"
> when seeking its definition (this relies on the coding conventions
> about function layout, of course). An FTS doesn't think start-of-line
> is significant so it can't do that.
+1. The nice thing about a tool that understands code is that you can
query it in ways that make sense to code. For example I can search for
"all files that include foo.h" or "all callers of function bar" or "all
occurences of the symbol baz". I use cscope for this, which integrates
nicely into my text editor (vim), and others have told me they use
kscope which puts it inside a nice GUI window, if you care about such
things.
--
Alvaro Herrera http://www.amazon.com/gp/registry/5ZYLFMCVHXC
"I would rather have GNU than GNOT." (ccchips, lwn.net/Articles/37595/)