File tree Expand file tree Collapse file tree 1 file changed +30
-1
lines changed Expand file tree Collapse file tree 1 file changed +30
-1
lines changed Original file line number Diff line number Diff line change 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+ ```
You can’t perform that action at this time.
0 commit comments