fmtraw

package
v1.61.2 Latest Latest
Warning

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

Go to latest
Published: Sep 10, 2026 License: BSD-3-Clause Imports: 3 Imported by: 0

Documentation

Overview

Package fmtraw grants in-repo tooling access to the formatting metadata stored in lisp values' unexported meta field (see internal/fmtmeta for the metadata itself and the history of why the field is unexported — issue #382).

lisp.LVal deliberately has no exported metadata accessors: the metadata only exists on format-preserving parse trees, which are produced and owned by parser/rdparser, read by the formatter, and never sealed, evaluated, or shared. This package is the sanctioned path between those tools and the field: it lives under internal/, so the Go compiler limits it to this module — an embedder importing elps cannot reach the field at all.

The accessors are injected by package lisp's init through the untyped slots in the hook subpackage (see hook's doc comment for the cycle it breaks). Writers MUST own the tree they stamp: the parser writes only nodes it produced during the current parse, before anything else can see them.

Index

Constants

This section is empty.

Variables

View Source
var Meta func(v *lisp.LVal) *fmtmeta.Meta

Meta returns v's formatting metadata, or nil when v carries none (always nil outside format-preserving parses). The returned struct is v's own — the format-preserving parser mutates it through this pointer while it still owns the tree; everyone else treats it as read-only. Injected by package lisp's init; importing this package imports lisp, so the accessors are always non-nil by the time user code runs.

View Source
var SetMeta func(v *lisp.LVal, m *fmtmeta.Meta)

SetMeta attaches m as v's formatting metadata, replacing any existing metadata. Only the format-preserving parser should call it, on nodes it produced during the current parse.

Functions

func EnsureMeta

func EnsureMeta(v *lisp.LVal) *fmtmeta.Meta

EnsureMeta returns v's formatting metadata, attaching a fresh empty Meta first when v has none. The write path has the same ownership contract as SetMeta.

Types

This section is empty.

Directories

Path Synopsis
Package hook is the untyped injection slot behind internal/fmtraw.
Package hook is the untyped injection slot behind internal/fmtraw.

Jump to

Keyboard shortcuts

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