source

package
v0.70.0 Latest Latest
Warning

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

Go to latest
Published: Sep 11, 2026 License: MIT Imports: 4 Imported by: 0

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

func FormatCodeFrame(source string, pos Position) string

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.

type Position

type Position struct {
	Line   int
	Column int
}

Position represents a source-code position. Line and Column are 1-indexed. The layout is intentionally preserved across the move from vibes.Position so positional struct literals in embedder code keep compiling.

Jump to

Keyboard shortcuts

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