diff options
Diffstat (limited to 'vendor/github.com/go-toolsmith/astp/README.md')
| -rw-r--r-- | vendor/github.com/go-toolsmith/astp/README.md | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/vendor/github.com/go-toolsmith/astp/README.md b/vendor/github.com/go-toolsmith/astp/README.md new file mode 100644 index 000000000..7313c6ab8 --- /dev/null +++ b/vendor/github.com/go-toolsmith/astp/README.md @@ -0,0 +1,39 @@ +[](https://goreportcard.com/report/github.com/go-toolsmith/astp) +[](https://godoc.org/github.com/go-toolsmith/astp) +[](https://travis-ci.org/go-toolsmith/astp) + + +# astp + +Package astp provides AST predicates. + +## Installation: + +```bash +go get github.com/go-toolsmith/astp +``` + +## Example + +```go +package main + +import ( + "fmt" + + "github.com/go-toolsmith/astp" + "github.com/go-toolsmith/strparse" +) + +func main() { + if astp.IsIdent(strparse.Expr(`x`)) { + fmt.Println("ident") + } + if astp.IsBlockStmt(strparse.Stmt(`{f()}`)) { + fmt.Println("block stmt") + } + if astp.IsGenDecl(strparse.Decl(`var x int = 10`)) { + fmt.Println("gen decl") + } +} +``` |
