symbol

package
v0.1.10 Latest Latest
Warning

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

Go to latest
Published: Feb 25, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Builder

type Builder struct {
	Global      *Scope
	Current     *Scope
	Errors      []string
	Resolutions map[ast.Node]int
}

func NewBuilder

func NewBuilder() *Builder

func (*Builder) Define

func (b *Builder) Define(name string, kind SymbolKind) *Symbol

func (*Builder) EnterScope

func (b *Builder) EnterScope(name string)

func (*Builder) ExitScope

func (b *Builder) ExitScope()

func (*Builder) Resolve

func (b *Builder) Resolve(name string) *Symbol

func (*Builder) Visit

func (b *Builder) Visit(node ast.Node)

func (*Builder) VisitExpression

func (b *Builder) VisitExpression(expr ast.Expression)

func (*Builder) VisitStatement

func (b *Builder) VisitStatement(stmt ast.Statement)

type Scope

type Scope struct {
	Name    string
	Parent  *Scope
	Symbols map[string]*Symbol
}

func NewScope

func NewScope(name string, parent *Scope) *Scope

func (*Scope) Define

func (s *Scope) Define(sym *Symbol)

func (*Scope) Resolve

func (s *Scope) Resolve(name string) *Symbol

func (*Scope) ResolveWithDistance

func (s *Scope) ResolveWithDistance(name string) (*Symbol, int)

type Symbol

type Symbol struct {
	Name        string
	Kind        SymbolKind
	NestedScope *Scope
}

type SymbolKind

type SymbolKind int
const (
	VARIABLE SymbolKind = iota
	FUNCTION
	PARAMETER
	STRUCT_FIELD
	STRUCT
	CONSTANT
	MODULE
)

func (SymbolKind) String

func (k SymbolKind) String() string

Jump to

Keyboard shortcuts

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