Help us shape the future of Go! Take the 2026 Go Developer Survey

printer

package
v1.14.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 15, 2024 License: MIT Imports: 5 Imported by: 63

Documentation

Overview

This source inspired by https://github.com/fatih/color.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ColorAttribute added in v1.13.7

type ColorAttribute int
const (
	ColorReset ColorAttribute = iota
	ColorBold
	ColorFaint
	ColorItalic
	ColorUnderline
	ColorBlinkSlow
	ColorBlinkRapid
	ColorReverseVideo
	ColorConcealed
	ColorCrossedOut
)
const (
	ColorFgHiBlack ColorAttribute = iota + 90
	ColorFgHiRed
	ColorFgHiGreen
	ColorFgHiYellow
	ColorFgHiBlue
	ColorFgHiMagenta
	ColorFgHiCyan
	ColorFgHiWhite
)
const (
	ColorResetBold ColorAttribute = iota + 22
	ColorResetItalic
	ColorResetUnderline
	ColorResetBlinking

	ColorResetReversed
	ColorResetConcealed
	ColorResetCrossedOut
)

type PrintFunc

type PrintFunc func() *Property

PrintFunc returns property instance

type Printer

type Printer struct {
	LineNumber       bool
	LineNumberFormat func(num int) string
	MapKey           PrintFunc
	Anchor           PrintFunc
	Alias            PrintFunc
	Bool             PrintFunc
	String           PrintFunc
	Number           PrintFunc
	Comment          PrintFunc
}

Printer create text from token collection or ast

func (*Printer) PrintErrorMessage

func (p *Printer) PrintErrorMessage(msg string, isColored bool) string

func (*Printer) PrintErrorToken

func (p *Printer) PrintErrorToken(tk *token.Token, isColored bool) string

func (*Printer) PrintNode

func (p *Printer) PrintNode(node ast.Node) []byte

PrintNode create text from ast.Node

func (*Printer) PrintTokens

func (p *Printer) PrintTokens(tokens token.Tokens) string

PrintTokens create text from token collection

type Property

type Property struct {
	Prefix string
	Suffix string
}

Property additional property set for each the token

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL