github.com/shogo82148/std@v1.22.1-0.20240327122250-4e474527810c/cmd/compile/internal/syntax/printer.go (about) 1 // Copyright 2016 The Go Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style 3 // license that can be found in the LICENSE file. 4 5 // This file implements printing of syntax trees in source format. 6 7 package syntax 8 9 import ( 10 "github.com/shogo82148/std/io" 11 ) 12 13 // Form controls print formatting. 14 type Form uint 15 16 const ( 17 _ Form = iota 18 LineForm 19 ShortForm 20 ) 21 22 // Fprint prints node x to w in the specified form. 23 // It returns the number of bytes written, and whether there was an error. 24 func Fprint(w io.Writer, x Node, form Form) (n int, err error) 25 26 // String is a convenience function that prints n in ShortForm 27 // and returns the printed string. 28 func String(n Node) string