context

package
Version: v0.5.2 Latest Latest
Warning

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

Go to latest
Published: Mar 2, 2021 License: GPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	HIGHLIGHT_START = "\u001b[31;1m" // bold red
	HIGHLIGHT_STOP  = "\u001b[0m"
)

Variables

This section is empty.

Functions

func Abbreviate

func Abbreviate(path string) string

exported because also used in files modules

func AppendContextString

func AppendContextString(err error, msg string, c Context)

func AppendError

func AppendError(err_ error, other_ error)

func AppendString

func AppendString(err error, msg string)

func PrependContextString

func PrependContextString(err error, msg string, c Context)

func String2RuneSlice added in v0.5.0

func String2RuneSlice(s string) []rune

func ToHTML

func ToHTML(err error) string

Types

type Context

type Context struct {
	// contains filtered or unexported fields
}

func MergeContexts

func MergeContexts(cs ...Context) Context

func MergeFill

func MergeFill(a Context, b Context) Context

func NewContext

func NewContext(source *Source, path string) Context

func NewDummyContext

func NewDummyContext() Context

for preset globals

func SimpleFill added in v0.4.0

func SimpleFill(a Context, b Context) Context

func (*Context) Content

func (c *Context) Content() string

func (*Context) Distance

func (c *Context) Distance(other *Context) int

0 if stop == start

func (*Context) IncludeLeftSpace added in v0.4.0

func (c *Context) IncludeLeftSpace() Context

func (*Context) IncludeRightSpace added in v0.4.0

func (c *Context) IncludeRightSpace() Context

func (*Context) IsAtLineStart

func (c *Context) IsAtLineStart() bool

func (*Context) IsAtSourceStart

func (c *Context) IsAtSourceStart() bool

func (*Context) IsConsecutive

func (c *Context) IsConsecutive(other Context) bool

func (*Context) IsSingleLine

func (c *Context) IsSingleLine() bool

func (*Context) Len

func (c *Context) Len() int

func (*Context) Less

func (c *Context) Less(other *Context) bool

func (*Context) Merge

func (a *Context) Merge(b Context) Context

func (*Context) NewContext

func (c *Context) NewContext(relStart, relStop int) Context

func (*Context) NewError

func (c *Context) NewError(msg string) *ContextError

func (*Context) Path

func (c *Context) Path() string

func (*Context) Same added in v0.4.1

func (c *Context) Same(other *Context) bool

func (*Context) SearchReplaceOrig

func (c *Context) SearchReplaceOrig(old, new string) error

replace sadly means reading entire file, and then replacing it the reading has already been done though, so just use that WARNING: this is irreversible and should only be used during refactorings

func (*Context) WritePrettyOneLiner

func (c *Context) WritePrettyOneLiner() string

type ContextError

type ContextError struct {
	// contains filtered or unexported fields
}

func (*ContextError) AppendContextString

func (ce *ContextError) AppendContextString(msg string, c Context)

func (*ContextError) AppendError

func (ce *ContextError) AppendError(other *ContextError)

func (*ContextError) AppendString

func (ce *ContextError) AppendString(msg string)

func (*ContextError) Error

func (ce *ContextError) Error() string

func (*ContextError) GetObject added in v0.4.1

func (ce *ContextError) GetObject() interface{}

func (*ContextError) PrependContextString

func (ce *ContextError) PrependContextString(msg string, c Context)

func (*ContextError) SetObject added in v0.4.1

func (ce *ContextError) SetObject(obj interface{})

func (*ContextError) ToHTML

func (ce *ContextError) ToHTML() string

type Source

type Source struct {
	// contains filtered or unexported fields
}

func NewSource

func NewSource(src string) *Source

func (*Source) GetChar added in v0.4.0

func (s *Source) GetChar(i int) rune

func (*Source) GetString added in v0.5.0

func (s *Source) GetString(start, stop int) string

func (*Source) Len added in v0.4.0

func (s *Source) Len() int

Jump to

Keyboard shortcuts

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