一个源代码上下文感知的代码搜索工具:Cgrep

jopen 10年前

Cgrep 是一个 grep 的工具,特别适合在大的代码库中进行搜索。支持 30 多种编程语言。通过通配符和组合符提供上下文感知的过滤和语义搜索,而不仅仅是简单的模式匹配。

特性

  • 多线程 可以配置jobs数量.

  • 超快 Running on a single core it is nearly as fast as GNU grep, up to 6x times faster than ack.

  • 多行Multi-line 模式搜索

  • Colors highlight of tokens and strings matching.

  • Recursive searches: Support of language filters and pruning directories.

  • Standard searches: through Boyer–Moore and Posix Regex.

  • Code Tokenizer: Searches as prefix, infix, suffix and edit distance (Levenshtein distance).

  • Context-aware filters distinguish among code, comments and literals in different languages.

  • Languages support for Awk, C, Cpp, Chapel, Csharp, Css, CMake, D, Erlang, Fsharp, Go, Haskell, Html, Java, Javascript, Latex, Lua, Make, OCaml, ObjectiveC, Perl, PHP, Python, Ruby, Scala, Tcl, Text, Shell, Verilog, VHDL, Vim.

  • Semantic searches through wildcards and combinators. _, _1, _2..., $, $1, $2..., ANY, KEY, STR, CHR, NUM, HEX, OCT, OR. E.g. "_1(_1 && $)" search for move constructors, "struct OR class _ { OR : OR <" search for class declarations.

  • 自定义输出 with custom format string, XML and JSON back-ends.


 

项目主页:http://www.open-open.com/lib/view/home/1403312345278