Documentation
¶
Overview ¶
Package source contains stable source-location types shared between the AST (internal) and the public error surface.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FormatCodeFrame ¶
FormatCodeFrame returns a human-readable source snippet highlighting the column at the given position. It returns the empty string when no useful frame can be produced (missing source, out-of-range line, etc.).
Types ¶
type CodeFrameFormatter ¶ added in v0.60.0
type CodeFrameFormatter struct {
// contains filtered or unexported fields
}
CodeFrameFormatter renders code frames against an indexed source.
func NewCodeFrameFormatter ¶ added in v0.60.0
func NewCodeFrameFormatter(source string) *CodeFrameFormatter
NewCodeFrameFormatter returns a reusable formatter for source.
func (*CodeFrameFormatter) Format ¶ added in v0.60.0
func (f *CodeFrameFormatter) Format(pos Position) string
Format returns a human-readable source snippet highlighting the column at the given position.
Click to show internal directories.
Click to hide internal directories.