core

package
v0.0.0-...-8df569a Latest Latest
Warning

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

Go to latest
Published: Mar 27, 2026 License: GPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ErrorResult = ResultType(iota)
	InternalErrorResult
	WarningResult
	HintResult

	// Internal debugging error messages or strings that are not shown to the
	// user by default.
	// TODO: add support for printing these.
	DebugResult
)
View Source
const UsmUintBitSize = 8 * unsafe.Sizeof(UsmUint(0))

Variables

This section is empty.

Functions

This section is empty.

Types

type Result

type Result []ResultDetails

type ResultDetails

type ResultDetails struct {
	Type     ResultType
	Message  string
	Location *UnmanagedSourceView
}

type ResultList

type ResultList = list.List[Result]

type ResultStringer

type ResultStringer struct {
	SourceContext
	Titles             map[ResultType]string
	SourceErrorPointer string
	Filepath           string
	LineStarts         []UsmUint
}

func NewResultStringer

func NewResultStringer(ctx SourceContext, Filepath string) ResultStringer

func (*ResultStringer) StringResult

func (w *ResultStringer) StringResult(result Result) string

func (*ResultStringer) StringResultDetails

func (w *ResultStringer) StringResultDetails(details ResultDetails) string

type ResultType

type ResultType uint8

type SourceContext

type SourceContext = view.ViewContext[rune]

The context of a file.

When paired with an UnmanagedSourceView, creates a SourceView which represents a concrete string from a source file.

type SourceView

type SourceView = view.View[rune, SourceViewOffset]

Represents a view into a single source file ("substring" of the file source).

This structure is self contained and contains a pointer to the file structure and whole data, and is a bit larger in memory than the UnmanagedSourceView.

func NewSourceView

func NewSourceView(data string) SourceView

func ReadSource

func ReadSource(reader io.Reader) (view SourceView, err error)

type SourceViewOffset

type SourceViewOffset = UsmUint

type UnmanagedSourceView

type UnmanagedSourceView = view.UnmanagedView[rune, SourceViewOffset]

Represents a view into a single source file ("substring" of the file source).

Does not store the file content itself, but only the start and end indices of the substring (to not waste memory). Use the SourceView type to store a view with context to a specific file.

func NewEofUnmanagedSourceView

func NewEofUnmanagedSourceView() UnmanagedSourceView

Returns an unmanaged view that points to the maximum possible character offset. This is currently used as a hack to represent a location of the end of the file, for example for example in the UnexpectedEof lex error.

func NewFullUnmanagedSourceView

func NewFullUnmanagedSourceView() UnmanagedSourceView

Returns an unmanaged view that covers the whole source.

type UsmUint

type UsmUint = uint64

Base type for unsigned integers. This defines, for example, the maximum length of a source file, and the maximum type size, and other bounds for internal data structures.

func Add

func Add(x, y UsmUint) (res UsmUint, ok bool)

func Mul

func Mul(x, y UsmUint) (res UsmUint, ok bool)

func ParseUint

func ParseUint(s string) (UsmUint, error)

Jump to

Keyboard shortcuts

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