asq

module
v0.0.0-...-e0dc6c1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 20, 2025 License: MIT

README

asq - Active Semantic Query Tool

A tool for semantic code querying using tree-sitter patterns. Extract and match code patterns in Go files using semantic queries.

Installation

Using Go
go install github.com/StCredZero/asq/cmd/asq@latest
Using Homebrew

Coming soon with first release

After the first release, you'll be able to install using:

brew tap StCredZero/asq
brew install asq

Usage

Generate a Tree-sitter Query

To generate a tree-sitter query from a Go file that contains code marked with //asq_start and //asq_end comments:

asq tree-sitter path/to/file.go

Example input file:

package example

func Example() {
    //asq_start
    e.Inst().Foo()
    //asq_end
}
Search Using Generated Query

To search for matches of the generated query in all Go files recursively from the current directory:

asq query path/to/file.go

The output will show matches with their file paths, line numbers, and column numbers:

//asq_match path/to/match1.go:10:4
e.Inst().Foo()
//asq_match path/to/match2.go:15:2
e.Inst().Foo()

License

MIT License - see LICENSE for details.

Directories

Path Synopsis
cmd
asq
pkg
asq

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL