sid

package
v0.14.3 Latest Latest
Warning

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

Go to latest
Published: May 2, 2026 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package sid provides Stable ID calculation for AST nodes

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type SID

type SID string

SID represents a Stable Identifier for an AST node

func NewSID

func NewSID(path string, start, end int, kind string, childPath []int) SID

NewSID calculates a stable ID for an AST node Formula: hash(canonical_path | start_offset | end_offset | node_kind | child_path)

type SIDMap

type SIDMap struct {
	SurfaceToCore map[SID][]SID
	CoreToSurface map[SID]SID
}

SIDMap maintains the mapping from surface SIDs to core SIDs

func NewSIDMap

func NewSIDMap() *SIDMap

NewSIDMap creates a new SID mapping

func (*SIDMap) AddMapping

func (m *SIDMap) AddMapping(surfaceSID SID, coreSID SID)

AddMapping records a surface→core SID mapping

func (*SIDMap) GetCoreSIDs

func (m *SIDMap) GetCoreSIDs(surfaceSID SID) []SID

GetCoreSIDs returns all core SIDs derived from a surface SID

func (*SIDMap) GetSurfaceSID

func (m *SIDMap) GetSurfaceSID(coreSID SID) (SID, bool)

GetSurfaceSID returns the surface SID that generated a core SID

func (*SIDMap) GetTraceSlice

func (m *SIDMap) GetTraceSlice(surfaceSID SID) *TraceSlice

GetTraceSlice returns the transformation trace for a surface SID

type TraceSlice

type TraceSlice struct {
	SurfaceSID  SID
	SurfaceKind string
	CoreSIDs    []SID
	CoreKinds   []string
	Steps       []TransformStep
}

TraceSlice represents the transformation path from surface to core

type TransformStep

type TransformStep struct {
	Description string
	FromSID     SID
	ToSID       SID
}

TransformStep represents one step in the transformation

Jump to

Keyboard shortcuts

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