All Projects → orisano → impast

orisano / impast

Licence: MIT License
A library for package AST importing

Programming Languages

go
31211 projects - #10 most used programming language

Projects that are alternatives of or similar to impast

Astring
🌳 Tiny and fast JavaScript code generator from an ESTree-compliant AST.
Stars: ✭ 757 (+2811.54%)
Mutual labels:  ast, codegen
lowcode
React Lowcode - prototype, develop and maintain internal apps easier
Stars: ✭ 32 (+23.08%)
Mutual labels:  ast, codegen
CQRSAzure
CQRS on Windows Azure
Stars: ✭ 25 (-3.85%)
Mutual labels:  codegen
micronaut-openapi-codegen
OpenAPI codegen for Micronaut
Stars: ✭ 26 (+0%)
Mutual labels:  codegen
rector-laravel
Rector upgrades rules for Laravel
Stars: ✭ 75 (+188.46%)
Mutual labels:  ast
Headache
Programming Language that compiles to 8 Bit Brainfuck
Stars: ✭ 59 (+126.92%)
Mutual labels:  ast
ruby ast visualizer
🌲 Ruby AST Visualizer. Based on Parser.
Stars: ✭ 28 (+7.69%)
Mutual labels:  ast
coAST
Universal and language-independent abstract syntax tree
Stars: ✭ 30 (+15.38%)
Mutual labels:  ast
gogrep
Syntax-aware Go code search, based on the mvdan/gogrep
Stars: ✭ 25 (-3.85%)
Mutual labels:  ast
kolasu
Kotlin Language Support – AST Library
Stars: ✭ 45 (+73.08%)
Mutual labels:  ast
js-ziju
Compile javascript to LLVM IR, x86 assembly and self interpreting
Stars: ✭ 112 (+330.77%)
Mutual labels:  ast
C90Compiler-EIE2
C90 to MIPS I Compiler done as a coursework for EE2-15
Stars: ✭ 15 (-42.31%)
Mutual labels:  ast
dedupimport
Deduplicate named/unnamed imports that have the same import path in Go files
Stars: ✭ 20 (-23.08%)
Mutual labels:  ast
CreateAPI
Delightful code generator for OpenAPI specs
Stars: ✭ 176 (+576.92%)
Mutual labels:  codegen
babel-codemod-example
An example of how to use babel as a codemod
Stars: ✭ 24 (-7.69%)
Mutual labels:  ast
hxjsonast
Parse JSON into position-aware AST with Haxe!
Stars: ✭ 28 (+7.69%)
Mutual labels:  ast
wx2bd
微信和百度小程序的互转工具,脚本转换率目标为100%,持续更新中~~
Stars: ✭ 21 (-19.23%)
Mutual labels:  ast
bredon
A modern CSS value compiler in JavaScript
Stars: ✭ 39 (+50%)
Mutual labels:  ast
easybundler
A code generator for Android Bundles
Stars: ✭ 53 (+103.85%)
Mutual labels:  codegen
hwt
VHDL/Verilog/SystemC code generator, simulator API written in python/c++
Stars: ✭ 145 (+457.69%)
Mutual labels:  codegen

impast

Build Status Maintainability Test Coverage

A library for package AST importing.

Installation

go get -u github.com/orisano/impast

How to use

package main

import (
	"fmt"
	"log"
	
	"github.com/orisano/impast"
)

func main() {
	pkg, err := impast.ImportPackage("io")
	if err != nil {
		log.Fatal(err)
	}
	it := impast.FindInterface(pkg, "Writer")
	if it == nil {
		log.Fatalf("io.Writer not found")
	}

	methods := impast.GetRequires(it)
	for _, method := range methods {
		fmt.Println(method.Names[0].Name)
	}
	// Output:
	// Write
}

Useful commands

interfacer

struct to interface command

Installation

go get -u github.com/orisano/impast/cmd/interfacer

How to use

$ interfacer -out HTTPClient net/http.Client
type HTTPClient interface {
	Do(req *http.Request) (*http.Response, error)
	Get(url string) (resp *http.Response, err error)
	Head(url string) (resp *http.Response, err error)
	Post(url, contentType string, body io.Reader) (resp *http.Response, err error)
	PostForm(url string, data url.Values) (resp *http.Response, err error)
}

mocker

generate mock command

Installation

go get -u github.com/orisano/impast/cmd/mocker

How to use

$ mocker -pkg io -type ReadWriter
type ReadWriterMock struct {
	ReadMock	func(p []byte) (n int, err error)
	WriteMock	func(p []byte) (n int, err error)
}

func (m *ReadWriterMock) Read(p []byte) (n int, err error) {
	return m.ReadMock(p)
}

func (m *ReadWriterMock) Write(p []byte) (n int, err error) {
	return m.WriteMock(p)
}

stuber

generate stub command

Installation

go get -u github.com/orisano/impast/cmd/stuber

How to use

$ stuber -pkg net -implement Conn -export -name c -type "*MyConn"
func (c *MyConn) Read(b []byte) (n int, err error) {
	panic("implement me")
}

func (c *MyConn) Write(b []byte) (n int, err error) {
	panic("implement me")
}

func (c *MyConn) Close() error {
	panic("implement me")
}

func (c *MyConn) LocalAddr() net.Addr {
	panic("implement me")
}

func (c *MyConn) RemoteAddr() net.Addr {
	panic("implement me")
}

func (c *MyConn) SetDeadline(t time.Time) error {
	panic("implement me")
}

func (c *MyConn) SetReadDeadline(t time.Time) error {
	panic("implement me")
}

func (c *MyConn) SetWriteDeadline(t time.Time) error {
	panic("implement me")
}

Author

Nao Yonashiro (@orisano)

License

MIT

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].