aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/github.com/go-toolsmith/astfmt
diff options
context:
space:
mode:
authorTaras Madan <tarasmadan@google.com>2025-01-22 16:07:17 +0100
committerTaras Madan <tarasmadan@google.com>2025-01-23 10:42:36 +0000
commit7b4377ad9d8a7205416df8d6217ef2b010f89481 (patch)
treee6fec4fd12ff807a16d847923f501075bf71d16c /vendor/github.com/go-toolsmith/astfmt
parent475a4c203afb8b7d3af51c4fd32bb170ff32a45e (diff)
vendor: delete
Diffstat (limited to 'vendor/github.com/go-toolsmith/astfmt')
-rw-r--r--vendor/github.com/go-toolsmith/astfmt/LICENSE21
-rw-r--r--vendor/github.com/go-toolsmith/astfmt/README.md55
-rw-r--r--vendor/github.com/go-toolsmith/astfmt/astfmt.go111
3 files changed, 0 insertions, 187 deletions
diff --git a/vendor/github.com/go-toolsmith/astfmt/LICENSE b/vendor/github.com/go-toolsmith/astfmt/LICENSE
deleted file mode 100644
index eef17180f..000000000
--- a/vendor/github.com/go-toolsmith/astfmt/LICENSE
+++ /dev/null
@@ -1,21 +0,0 @@
-MIT License
-
-Copyright (c) 2018 go-toolsmith
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all
-copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-SOFTWARE.
diff --git a/vendor/github.com/go-toolsmith/astfmt/README.md b/vendor/github.com/go-toolsmith/astfmt/README.md
deleted file mode 100644
index 00f790fd2..000000000
--- a/vendor/github.com/go-toolsmith/astfmt/README.md
+++ /dev/null
@@ -1,55 +0,0 @@
-# astfmt
-
-[![build-img]][build-url]
-[![pkg-img]][pkg-url]
-[![reportcard-img]][reportcard-url]
-[![version-img]][version-url]
-
-Package `astfmt` implements ast.Node formatting with fmt-like API.
-
-## Installation
-
-Go version 1.16+
-
-```bash
-go get github.com/go-toolsmith/astfmt
-```
-
-## Example
-
-```go
-package main
-
-import (
- "go/token"
- "os"
-
- "github.com/go-toolsmith/astfmt"
- "github.com/go-toolsmith/strparse"
-)
-
-func Example() {
- x := strparse.Expr(`foo(bar(baz(1+2)))`)
- // astfmt functions add %s support for ast.Node arguments.
- astfmt.Println(x) // => foo(bar(baz(1 + 2)))
- astfmt.Fprintf(os.Stdout, "node=%s\n", x) // => node=foo(bar(baz(1 + 2)))
-
- // Can use specific file set with printer.
- fset := token.NewFileSet() // Suppose this fset is used when parsing
- pp := astfmt.NewPrinter(fset)
- pp.Println(x) // => foo(bar(baz(1 + 2)))
-}
-```
-
-## License
-
-[MIT License](LICENSE).
-
-[build-img]: https://github.com/go-toolsmith/astfmt/workflows/build/badge.svg
-[build-url]: https://github.com/go-toolsmith/astfmt/actions
-[pkg-img]: https://pkg.go.dev/badge/go-toolsmith/astfmt
-[pkg-url]: https://pkg.go.dev/github.com/go-toolsmith/astfmt
-[reportcard-img]: https://goreportcard.com/badge/go-toolsmith/astfmt
-[reportcard-url]: https://goreportcard.com/report/go-toolsmith/astfmt
-[version-img]: https://img.shields.io/github/v/release/go-toolsmith/astfmt
-[version-url]: https://github.com/go-toolsmith/astfmt/releases
diff --git a/vendor/github.com/go-toolsmith/astfmt/astfmt.go b/vendor/github.com/go-toolsmith/astfmt/astfmt.go
deleted file mode 100644
index ca993e033..000000000
--- a/vendor/github.com/go-toolsmith/astfmt/astfmt.go
+++ /dev/null
@@ -1,111 +0,0 @@
-// Package astfmt implements `ast.Node` formatting with fmt-like API.
-package astfmt
-
-import (
- "bytes"
- "fmt"
- "go/ast"
- "go/printer"
- "go/token"
- "io"
-)
-
-// Println calls fmt.Println with additional support of %s format
-// for ast.Node arguments.
-//
-// Uses empty file set for AST printing.
-func Println(args ...interface{}) error {
- return defaultPrinter.Println(args...)
-}
-
-// Fprintf calls fmt.Fprintf with additional support of %s format
-// for ast.Node arguments.
-//
-// Uses empty file set for AST printing.
-func Fprintf(w io.Writer, format string, args ...interface{}) error {
- return defaultPrinter.Fprintf(w, format, args...)
-}
-
-// Sprintf calls fmt.Sprintf with additional support of %s format
-// for ast.Node arguments.
-//
-// Uses empty file set for AST printing.
-func Sprintf(format string, args ...interface{}) string {
- return defaultPrinter.Sprintf(format, args...)
-}
-
-// Sprint calls fmt.Sprint with additional support of %s format
-// for ast.Node arguments.
-//
-// Uses empty file set for AST printing.
-func Sprint(args ...interface{}) string {
- return defaultPrinter.Sprint(args...)
-}
-
-// NewPrinter returns printer that uses bound file set when printing AST nodes.
-func NewPrinter(fset *token.FileSet) *Printer {
- return &Printer{fset: fset}
-}
-
-// Printer provides API close to fmt package for printing AST nodes.
-// Unlike freestanding functions from this package, it makes it possible
-// to associate appropriate file set for better output.
-type Printer struct {
- fset *token.FileSet
-}
-
-// Println printer method is like Println function, but uses bound file set when printing.
-func (p *Printer) Println(args ...interface{}) error {
- _, err := fmt.Println(wrapArgs(p.fset, args)...)
- return err
-}
-
-// Fprintf printer method is like Fprintf function, but uses bound file set when printing.
-func (p *Printer) Fprintf(w io.Writer, format string, args ...interface{}) error {
- _, err := fmt.Fprintf(w, format, wrapArgs(p.fset, args)...)
- return err
-}
-
-// Sprintf printer method is like Sprintf function, but uses bound file set when printing.
-func (p *Printer) Sprintf(format string, args ...interface{}) string {
- return fmt.Sprintf(format, wrapArgs(p.fset, args)...)
-}
-
-// Sprint printer method is like Sprint function, but uses bound file set when printing.
-func (p *Printer) Sprint(args ...interface{}) string {
- return fmt.Sprint(wrapArgs(p.fset, args)...)
-}
-
-// defaultPrinter is used in printing functions like Println.
-// Uses empty file set.
-var defaultPrinter = NewPrinter(token.NewFileSet())
-
-// wrapArgs returns arguments slice with every ast.Node element
-// replaced with fmtNode wrapper that supports additional formatting.
-func wrapArgs(fset *token.FileSet, args []interface{}) []interface{} {
- for i := range args {
- if x, ok := args[i].(ast.Node); ok {
- args[i] = fmtNode{fset: fset, node: x}
- }
- }
- return args
-}
-
-type fmtNode struct {
- fset *token.FileSet
- node ast.Node
-}
-
-func (n fmtNode) String() string {
- var buf bytes.Buffer
- if err := printer.Fprint(&buf, n.fset, n.node); err != nil {
- return fmt.Sprintf("%%!s(ast.Node=%s)", err)
- }
- return buf.String()
-}
-
-func (n fmtNode) GoString() string {
- var buf bytes.Buffer
- fmt.Fprintf(&buf, "%#v", n.node)
- return buf.String()
-}