Documentation ¶
Index ¶
- func Cause(err error) string
- func Color(ctx context.Context) aurora.Aurora
- func DisplayError(ctx context.Context, w io.Writer, spans []*SpanError, err error, ...)
- func FormatPos(pos lexer.Position) string
- func Levenshtein(s1, s2 []rune) int
- func Offset(pos lexer.Position, offset int, line int) lexer.Position
- func Suggestion(value string, candidates []string) string
- func WithColor(ctx context.Context, color aurora.Aurora) context.Context
- func WithError(err error, pos, end lexer.Position, opts ...Option) error
- type Error
- type Option
- type PrettyInfo
- type PrettyOption
- type Span
- type SpanError
- type Type
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DisplayError ¶
func Levenshtein ¶
Levenshtein returns the levenshtein distance between two rune arrays.
This implementation translated from the optimized C code at https://en.wikibooks.org/wiki/Algorithm_Implementation/Strings/Levenshtein_distance#C
func Suggestion ¶
Types ¶
type PrettyInfo ¶
type PrettyInfo struct {
NumContext int
}
type PrettyOption ¶
type PrettyOption func(*PrettyInfo)
func WithNumContext ¶
func WithNumContext(num int) PrettyOption
Click to show internal directories.
Click to hide internal directories.