Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Intelligent file search for windows that can ignore whitespace and search in code?

Does anybody know a Windows based searching tool that is easy to use and is programmer friendly.

The functions I am looking for:

Ignore white space in search

= capable to find

myTestFunction ( $parameter, $another_parameter, $yet_another_parameter )
{ doThis();

using the query

myTestFunction($parameter,$another_parameter,$yet_another_parameter){doThis();

without Regexes.

Search code "semantically" (for me, it would have to be PHP):

  • Search in comments only
  • Search in function names only
  • Search for parameters that are named $xyz
  • Search in (insert code construct here) only

If there is none around, it's high time somebody developed it! :) I have opened a bounty for this.

like image 256
Pekka Avatar asked Nov 17 '25 19:11

Pekka


1 Answers

See our SD Search Engine. This is a language-sensitive search engine designed to search large code bases, with special language classifiers for C, C++, Java, C#, COBOL, JavaScript, Ada, Python, Ruby and lot of other languages, including your specific target langauge PHP (PHP4 and PHP5).

I think it does everything you requested.

It indexes the language elements so search across large code bases are extremely fast (Linux Kernal ~~ 7.5 Million lines --> 2.5 seconds). (The indexing step runs on Windows, but the display engine is in Java.)

Search hits are shown in one-line context hit window showing the file and line number, as well as the line with the hit highlighted. Clicks on hits bring up the source code, tabs expanded appropriately, and the line count right even for languages which have odd line counting rules (such as GCC WRT form characters), with the hit line and hit text highlighted. Clicking in the source window will launch your favorite editor on the file.

Because it understands language elements, it ignores language-specific whitespace. It skips over comments unless you insist they be inspected. Searches thus ignore whitespace, comments and lineboundaries (if the language thinks lineboundaries are whitespace, which is why there are langauge-specific scanners). The query language allows you to specify which language tokens you want (specific tokens in quotes, or generic tokens such as identifiers I, numbers N, strings S, operators O and punctuation P) with constraints on the token value as well as a series of tokens.

Your example search:

 myTestFunction($parameter,$another_parameter,$yet_another_parameter){doThis(); 

would be expressed to the search engine precisely as:

 I=myTestFunction '(' I ',' I ',' I ')' '{' I=dothis '(' ')' ';'

but it would probably be easier (less typing) to find it as:

 I=myTest* ... I=dothis

where I=myTest* means an identifier starting with myTest and ... means "near".

The Search Engine also offer regular expressions searches on the text, if you insist. So you still have grep-like searches (a lot slower than indexed searches) but with the hit window and source display windows too.

like image 108
Ira Baxter Avatar answered Nov 21 '25 10:11

Ira Baxter



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!