All Projects → mvdan → Gogrep

mvdan / Gogrep

Licence: bsd-3-clause
Search for Go code using syntax trees

Programming Languages

go
31211 projects - #10 most used programming language

Projects that are alternatives of or similar to Gogrep

Phpgrep
Syntax-aware grep for PHP code.
Stars: ✭ 185 (-58.89%)
Mutual labels:  search, code, syntax
Pervane
Plain text file based note taking and knowledge base building tool, markdown editor, simple browser IDE.
Stars: ✭ 159 (-64.67%)
Mutual labels:  search, code
Haskell Symbol Search Cheatsheet
Haskell/GHC symbol search cheatsheet
Stars: ✭ 243 (-46%)
Mutual labels:  search, syntax
Code Surfer
Rad code slides <🏄/>
Stars: ✭ 5,477 (+1117.11%)
Mutual labels:  code, syntax
micro-code-analyser
A tiny Node.js microservice to detect the language of a code snippet
Stars: ✭ 21 (-95.33%)
Mutual labels:  syntax, code
CodeEditorView
Code Editor UITextView
Stars: ✭ 20 (-95.56%)
Mutual labels:  syntax, code
KodeEditor
A simple code editor with syntax highlighting and pinch to zoom
Stars: ✭ 60 (-86.67%)
Mutual labels:  syntax, code
Opengrok
OpenGrok is a fast and usable source code search and cross reference engine, written in Java
Stars: ✭ 3,452 (+667.11%)
Mutual labels:  search, code
Cracking The Coding Interview
📚 C++ and Python solutions with automated tests for Cracking the Coding Interview 6th Edition.
Stars: ✭ 396 (-12%)
Mutual labels:  search
Hideseek
A simple, mobile-friendly, yet customizable quick/live search jQuery plugin.
Stars: ✭ 430 (-4.44%)
Mutual labels:  search
Vue Instant
vue instant allows you to easily create custom search controls with auto suggestions for your vue 2 applications
Stars: ✭ 397 (-11.78%)
Mutual labels:  search
Awesome Elasticsearch
A curated list of the most important and useful resources about elasticsearch: articles, videos, blogs, tips and tricks, use cases. All about Elasticsearch!
Stars: ✭ 4,168 (+826.22%)
Mutual labels:  search
Searchkit
GraphQL API & React UI components for Elasticsearch. The easiest way to build a great search experience
Stars: ✭ 4,338 (+864%)
Mutual labels:  search
Tomb5
Tomb Raider: Chronicles Disassembly translated to C source code.
Stars: ✭ 397 (-11.78%)
Mutual labels:  code
Vscode Es7 Javascript React Snippets
Extension for Javascript/React snippets with search supporting ES7 and babel features
Stars: ✭ 435 (-3.33%)
Mutual labels:  search
React Native Searchbar
A pretty sweet search bar for React Native.
Stars: ✭ 392 (-12.89%)
Mutual labels:  search
Iosdropdown
Drop Down Menu for iOS With Search And Other Awesome Customisation
Stars: ✭ 390 (-13.33%)
Mutual labels:  search
Vsearch
Versatile open-source tool for microbiome analysis
Stars: ✭ 444 (-1.33%)
Mutual labels:  search
Voice Overlay Ios
🗣 An overlay that gets your user’s voice permission and input as text in a customizable UI
Stars: ✭ 440 (-2.22%)
Mutual labels:  search
Ngx Mat Select Search
Angular component providing an input field for searching / filtering MatSelect options of the Angular Material library.
Stars: ✭ 416 (-7.56%)
Mutual labels:  search

gogrep

GO111MODULE=on go get mvdan.cc/gogrep

Search for Go code using syntax trees. Work in progress.

gogrep -x 'if $x != nil { return $x, $*_ }'

Instructions

usage: gogrep commands [packages]

A command is of the form "-A pattern", where -A is one of:

   -x  find all nodes matching a pattern
   -g  discard nodes not matching a pattern
   -v  discard nodes matching a pattern
   -a  filter nodes by certain attributes
   -s  substitute with a given syntax tree
   -w  write source back to disk or stdout

A pattern is a piece of Go code which may include wildcards. It can be:

   a statement (many if split by semicolons)
   an expression (many if split by commas)
   a type expression
   a top-level declaration (var, func, const)
   an entire file

Wildcards consist of $ and a name. All wildcards with the same name within an expression must match the same node, excluding "_". Example:

   $x.$_ = $x // assignment of self to a field in self

If * is before the name, it will match any number of nodes. Example:

   fmt.Fprintf(os.Stdout, $*_) // all Fprintfs on stdout

* can also be used to match optional nodes, like:

for $*_ { $*_ }    // will match all for loops
if $*_; $b { $*_ } // will match all ifs with condition $b

The nodes resulting from applying the commands will be printed line by line to standard output.

Here are two simple examples of the -a operand:

   gogrep -x '$x + $y'                   // will match both numerical and string "+" operations
   gogrep -x '$x + $y' -a 'type(string)' // matches only string concatenations
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].