sourcecode

package
v0.5.5-rc.1 Latest Latest
Warning

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

Go to latest
Published: Oct 4, 2022 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LineContentAt

func LineContentAt[T StringLikeContent](anchor Anchor, buf T) T

func MakeErrorAt

func MakeErrorAt[T StringLikeContent](anchor Anchor, buf T, err error) error

Types

type Anchor

type Anchor struct {
	LineNumber      int
	LineStartOffset int
	OffsetInBuffer  int
}

func CalcAnchor

func CalcAnchor[T StringLikeContent](buf T) Anchor

type Error

type Error struct {
	Location Location
	Err      error
}

func MakeError

func MakeError(loc Location, err error) *Error

func (*Error) Error

func (e *Error) Error() string

type Location

type Location struct {
	LineNumber   int // 1-based
	ColumnNumber int // 1-based
}

Location specifies line:column position within a text file - both numers are 1-based - empty inputs are treated as 1:1

func LocationAt

func LocationAt[T StringLikeContent](anchor Anchor, buf T) Location

func (*Location) String

func (loc *Location) String() string

func (*Location) Valid

func (loc *Location) Valid() bool

type StringLikeContent

type StringLikeContent interface {
	~string | []byte
}

Jump to

Keyboard shortcuts

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