dnscrypt-proxy/vendor/github.com/go-toolsmith/strparse
Frank Denis 8e913d8bf9 Udate deps 2021-09-24 09:30:49 +02:00
..
.travis.yml Update deps 2021-07-03 10:56:53 +02:00
LICENSE Update deps 2021-07-03 10:56:53 +02:00
README.md Update deps 2021-07-03 10:56:53 +02:00
strparse.go Update deps 2021-07-03 10:56:53 +02:00

README.md

Go Report Card GoDoc Build Status

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
}