mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2024-12-01 22:31:15 +00:00
c28f7cb29f
Initial part of #435 |
||
---|---|---|
.. | ||
.travis.yml | ||
go.mod | ||
LICENSE | ||
README.md | ||
strparse.go |
strparse
Package strparse provides convenience wrappers around go/parser
for simple
expression, statement and declaretion parsing from string.
Installation
go get github.com/go-toolsmith/strparse
Example
package main
import (
"go-toolsmith/astequal"
"go-toolsmith/strparse"
)
func main() {
// Comparing AST strings for equallity (note different spacing):
x := strparse.Expr(`1 + f(v[0].X)`)
y := strparse.Expr(` 1+f( v[0].X ) `)
fmt.Println(astequal.Expr(x, y)) // => true
}