astcore

package
v0.0.0-...-4349ab3 Latest Latest
Warning

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

Go to latest
Published: Aug 15, 2022 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WalkDown

func WalkDown(n Node, f func(Node) error) error

Types

type ChainedDeclMap

type ChainedDeclMap struct {
	Parent DeclMap
	Impl   DeclMapImpl
}

func NewChainedDeclMap

func NewChainedDeclMap(parent DeclMap) *ChainedDeclMap

func (*ChainedDeclMap) Get

func (m *ChainedDeclMap) Get(name string) *Decl

func (*ChainedDeclMap) Overwrite

func (m *ChainedDeclMap) Overwrite(name string, decl *Decl)

func (*ChainedDeclMap) Set

func (m *ChainedDeclMap) Set(n DeclNode) error

type CompositeDeclMap

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

func NewCompositeDeclMap

func NewCompositeDeclMap(maps ...DeclMap) *CompositeDeclMap

func (*CompositeDeclMap) Get

func (c *CompositeDeclMap) Get(name string) *Decl

func (*CompositeDeclMap) Overwrite

func (c *CompositeDeclMap) Overwrite(name string, decl *Decl)

func (*CompositeDeclMap) Set

func (c *CompositeDeclMap) Set(decl DeclNode) error

type Decl

type Decl struct {
	*Ident
	Node Node
}

func NewDeclaration

func NewDeclaration(ident *Ident, node Node) *Decl

type DeclMap

type DeclMap interface {
	Get(name string) *Decl
	Set(DeclNode) error
	Overwrite(name string, decl *Decl)
}

func NewDeclMap

func NewDeclMap() DeclMap

type DeclMapImpl

type DeclMapImpl map[string]*Decl

func (DeclMapImpl) Get

func (m DeclMapImpl) Get(name string) *Decl

func (DeclMapImpl) Overwrite

func (m DeclMapImpl) Overwrite(name string, decl *Decl)

func (DeclMapImpl) Set

func (m DeclMapImpl) Set(decl DeclNode) error

type DeclMaps

type DeclMaps []DeclMap

func (DeclMaps) Reverse

func (s DeclMaps) Reverse() DeclMaps

type DeclNode

type DeclNode interface {
	Node
	ToDeclarations() Decls
}

interface which is implemented by all declaration types

type DeclNodes

type DeclNodes []DeclNode

type Decls

type Decls []*Decl

func NewDeclarations

func NewDeclarations(identList IdentList, node Node) Decls

func (Decls) Find

func (s Decls) Find(name string) *Decl

type Ident

type Ident struct {
	Name     string
	Location *Location
}
  • Ident ``` <identifier> ```

func NewIdent

func NewIdent(v *token.Token) *Ident

func NewIdentFrom

func NewIdentFrom(arg interface{}) *Ident

func (*Ident) Children

func (m *Ident) Children() Nodes

func (*Ident) String

func (m *Ident) String() string

type IdentList

type IdentList []*Ident
  • IdentList ``` Ident ','... ```

func NewIdentList

func NewIdentList(args ...interface{}) IdentList

func (IdentList) Children

func (s IdentList) Children() Nodes

func (IdentList) Find

func (s IdentList) Find(name string) *Ident

func (IdentList) Names

func (s IdentList) Names() []string

type IdentRef

type IdentRef struct {
	*Ident
	Ref *Decl
	Node
}

Ident with reference to Declaration

func NewIdentRef

func NewIdentRef(ident *Ident, ref *Decl) *IdentRef

func (*IdentRef) Children

func (m *IdentRef) Children() Nodes

type Location

type Location struct {
	Path  string
	Start *Position
	End   *Position
}

func NewLocation

func NewLocation(start, end *runes.Position) *Location

func (*Location) String

func (m *Location) String() string

type Node

type Node interface {
	Children() Nodes
}

type Nodes

type Nodes []Node

func (Nodes) Children

func (s Nodes) Children() Nodes

type Position

type Position = runes.Position

Jump to

Keyboard shortcuts

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