Skip to content

Package strparse provides convenience wrappers around `go/parser` for simple expr/stmt/decl parsing from string.

License

Notifications You must be signed in to change notification settings

go-toolsmith/strparse

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

strparse

build-img pkg-img reportcard-img version-img

Package strparse provides convenience wrappers around go/parser for simple expression, statement and declaretion parsing from string.

Installation

Go version 1.16+

go get github.com/go-toolsmith/strparse

Example

package main

import (
	"github.com/go-toolsmith/astequal"
	"github.com/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
}

License

MIT License.

About

Package strparse provides convenience wrappers around `go/parser` for simple expr/stmt/decl parsing from string.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 3

  •  
  •  
  •  

Languages

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy