Re: I want to search my project source code - Mailing list pgsql-general

From Alvaro Herrera
Subject Re: I want to search my project source code
Date
Msg-id 20071029140037.GB2517@alvh.no-ip.org
Whole thread Raw
In response to Re: I want to search my project source code  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-general
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/)

pgsql-general by date:

Previous
From: "Albe Laurenz"
Date:
Subject: Re: Stored Procs Vs User Defined Functions vis-a-vis UDF's in Postgresql
Next
From: "Pit M."
Date:
Subject: Problems with PostgreSQL DBI-Link / DBD-ODBC