resolver

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Feb 19, 2026 License: GPL-3.0 Imports: 8 Imported by: 0

Documentation

Overview

Package resolver provides token reference resolution.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ResolveAliases

func ResolveAliases(tokens []*token.Token, version schema.Version) error

ResolveAliases resolves all alias references in the token list. Updates ResolvedValue and IsResolved fields on each token.

func ResolveGroupExtensions

func ResolveGroupExtensions(tokens []*token.Token, data []byte) ([]*token.Token, error)

ResolveGroupExtensions resolves $extends relationships in DTCG 2025.10 files. It creates copies of inherited tokens with updated paths and names. Child tokens override inherited tokens with the same terminal name.

This function should be called AFTER parsing, BEFORE alias resolution. For Draft schema, this is a no-op that returns the tokens unchanged.

Types

type DependencyGraph

type DependencyGraph struct {
	// contains filtered or unexported fields
}

DependencyGraph represents a directed graph of token dependencies.

func BuildDependencyGraph

func BuildDependencyGraph(tokens []*token.Token) *DependencyGraph

BuildDependencyGraph builds a dependency graph from a list of tokens.

func (*DependencyGraph) Dependencies

func (g *DependencyGraph) Dependencies(tokenName string) []string

Dependencies returns the list of tokens that the given token depends on.

func (*DependencyGraph) Dependents

func (g *DependencyGraph) Dependents(tokenName string) []string

Dependents returns the list of tokens that depend on the given token.

func (*DependencyGraph) FindCycle

func (g *DependencyGraph) FindCycle() []string

FindCycle returns the cycle path if one exists, or nil if no cycle.

func (*DependencyGraph) HasCycle

func (g *DependencyGraph) HasCycle() bool

HasCycle returns true if the graph contains a circular dependency.

func (*DependencyGraph) TopologicalSort

func (g *DependencyGraph) TopologicalSort() ([]string, error)

TopologicalSort returns tokens in dependency order (dependencies first). Returns error if graph contains a cycle.

Jump to

Keyboard shortcuts

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