1[![Go Report Card](https://goreportcard.com/badge/github.com/go-toolsmith/astp)](https://goreportcard.com/report/github.com/go-toolsmith/astp) 2[![GoDoc](https://godoc.org/github.com/go-toolsmith/astp?status.svg)](https://godoc.org/github.com/go-toolsmith/astp) 3[![Build Status](https://travis-ci.org/go-toolsmith/astp.svg?branch=master)](https://travis-ci.org/go-toolsmith/astp) 4 5 6# astp 7 8Package astp provides AST predicates. 9 10## Installation: 11 12```bash 13go get github.com/go-toolsmith/astp 14``` 15 16## Example 17 18```go 19package main 20 21import ( 22 "fmt" 23 24 "github.com/go-toolsmith/astp" 25 "github.com/go-toolsmith/strparse" 26) 27 28func main() { 29 if astp.IsIdent(strparse.Expr(`x`)) { 30 fmt.Println("ident") 31 } 32 if astp.IsBlockStmt(strparse.Stmt(`{f()}`)) { 33 fmt.Println("block stmt") 34 } 35 if astp.IsGenDecl(strparse.Decl(`var x int = 10`)) { 36 fmt.Println("gen decl") 37 } 38} 39``` 40