Skip to content

Commit eefc00e

Browse files
committed
add readme
1 parent fae4a23 commit eefc00e

File tree

1 file changed

+30
-1
lines changed

1 file changed

+30
-1
lines changed

README.md

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,31 @@
1+
[![Go Report Card](https://goreportcard.com/badge/github.com/go-toolsmith/strparse)](https://goreportcard.com/report/github.com/go-toolsmith/strparse)
2+
[![GoDoc](https://godoc.org/github.com/go-toolsmith/strparse?status.svg)](https://godoc.org/github.com/go-toolsmith/strparse)
3+
14
# strparse
2-
Convenience wrapper around `go/parser` for simple expr/stmt/decl parsing. Does not require FileSet.
5+
6+
Package strparse provides convenience wrappers around `go/parser` for simple
7+
expression, statement and declaretion parsing from string.
8+
9+
## Installation
10+
11+
```bash
12+
go get github.com/go-toolsmith/strparse
13+
```
14+
15+
## Example
16+
17+
```go
18+
package main
19+
20+
import (
21+
"go-toolsmith/astequal"
22+
"go-toolsmith/strparse"
23+
)
24+
25+
func main() {
26+
// Comparing AST strings for equallity (note different spacing):
27+
x := strparse.Expr(`1 + f(v[0].X)`)
28+
y := strparse.Expr(` 1+f( v[0].X ) `)
29+
fmt.Println(astequal.Expr(x, y) // => true
30+
}
31+
```

0 commit comments

Comments
 (0)