Documentation
¶
Index ¶
Constants ¶
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 )
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 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.