walk

package
v1.7.30 Latest Latest
Warning

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

Go to latest
Published: Jul 29, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package walk provides CST traversal and indexed node lookup.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HasChildToken

func HasChildToken(node *parser.Node, kind token.Kind) bool

func HasWrapperStorageQualifier

func HasWrapperStorageQualifier(node *parser.Node) bool

func IsStatement

func IsStatement(n *parser.Node) bool

func ReferencesByAmpersand

func ReferencesByAmpersand(tokens []token.Token, node *parser.Node) bool

Types

type CompactDefineCursor

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

func (*CompactDefineCursor) KnownDefinesAt

func (c *CompactDefineCursor) KnownDefinesAt(offset int) []string

func (*CompactDefineCursor) KnownDefinesViewAt

func (c *CompactDefineCursor) KnownDefinesViewAt(offset int) []string

type CompactModel

type CompactModel struct {
	Tree      *syntax.CompactTree
	Path      string
	LineTable *source.LineTable
	// contains filtered or unexported fields
}

func NewCompact

func NewCompact(path string, file *parser.CompactFile) *CompactModel

func NewCompactWithContext

func NewCompactWithContext(path string, file *parser.CompactFile, defines *DefineContext, snapshots []DefineSnapshot, complete bool, lineTable *source.LineTable) *CompactModel

func NewCompactWithDefineContext

func NewCompactWithDefineContext(path string, file *parser.CompactFile, defines []string, snapshots []DefineSnapshot, complete bool) *CompactModel

func NewCompactWithDefineSnapshots

func NewCompactWithDefineSnapshots(path string, file *parser.CompactFile, defines []string, snapshots []DefineSnapshot) *CompactModel

func NewCompactWithDefines

func NewCompactWithDefines(path string, file *parser.CompactFile, defines []string) *CompactModel

func NewCompactWithSharedContext

func NewCompactWithSharedContext(path string, file *parser.CompactFile, defines *DefineContext, snapshots []DefineSnapshot, complete bool, lineTable *source.LineTable) *CompactModel

func (*CompactModel) All

func (m *CompactModel) All() []syntax.NodeID

func (*CompactModel) Ancestors

func (m *CompactModel) Ancestors(node syntax.NodeID) []syntax.NodeID

func (*CompactModel) EnclosingFunction

func (m *CompactModel) EnclosingFunction(node syntax.NodeID) syntax.NodeID

func (*CompactModel) Inactive

func (m *CompactModel) Inactive(node syntax.NodeID) bool

func (*CompactModel) IsInsideConditionalBranch

func (m *CompactModel) IsInsideConditionalBranch(node syntax.NodeID) bool

func (*CompactModel) Iter

func (m *CompactModel) Iter(visit func(syntax.NodeID))

func (*CompactModel) IterKind

func (m *CompactModel) IterKind(kind parser.Kind, visit func(syntax.NodeID))

func (*CompactModel) KnownDefinesAt

func (m *CompactModel) KnownDefinesAt(offset int) []string

func (*CompactModel) NewCompactDefineCursor

func (m *CompactModel) NewCompactDefineCursor() *CompactDefineCursor

func (*CompactModel) NextSibling

func (m *CompactModel) NextSibling(node syntax.NodeID) syntax.NodeID

func (*CompactModel) OfKind

func (m *CompactModel) OfKind(kind parser.Kind) []syntax.NodeID

func (*CompactModel) Parent

func (m *CompactModel) Parent(node syntax.NodeID) syntax.NodeID

func (*CompactModel) PrevSibling

func (m *CompactModel) PrevSibling(node syntax.NodeID) syntax.NodeID

func (*CompactModel) Range

func (m *CompactModel) Range(node syntax.NodeID) source.Range

func (*CompactModel) Root

func (m *CompactModel) Root() syntax.NodeID

func (*CompactModel) Source

func (m *CompactModel) Source() []byte

func (*CompactModel) Text

func (m *CompactModel) Text(node syntax.NodeID) string

func (*CompactModel) Uncertain

func (m *CompactModel) Uncertain(node syntax.NodeID) bool

type DefineContext

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

func NewDefineContext

func NewDefineContext(defines []string) *DefineContext

type DefineCursor

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

func (*DefineCursor) KnownDefinesAt

func (c *DefineCursor) KnownDefinesAt(offset int) []string

func (*DefineCursor) KnownDefinesViewAt

func (c *DefineCursor) KnownDefinesViewAt(offset int) []string

type DefineSnapshot

type DefineSnapshot struct {
	Offset  int
	Defines []string
}

type Index

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

func NewIndex

func NewIndex(pf *parser.File) *Index

type Model

type Model struct {
	File      *parser.File
	Path      string
	LineTable *source.LineTable
	// contains filtered or unexported fields
}

func New

func New(path string, pf *parser.File) *Model

func NewWithContext

func NewWithContext(path string, pf *parser.File, defines *DefineContext, snapshots []DefineSnapshot, complete bool, lineTable *source.LineTable, index *Index) *Model

func NewWithDefineContext

func NewWithDefineContext(path string, pf *parser.File, defines []string, snapshots []DefineSnapshot, complete bool) *Model

func NewWithDefineSnapshots

func NewWithDefineSnapshots(path string, pf *parser.File, defines []string, snapshots []DefineSnapshot) *Model

func NewWithDefines

func NewWithDefines(path string, pf *parser.File, defines []string) *Model

func NewWithSharedContext

func NewWithSharedContext(path string, pf *parser.File, defines *DefineContext, snapshots []DefineSnapshot, complete bool, lineTable *source.LineTable, index *Index) *Model

func (*Model) All

func (m *Model) All() []*parser.Node

func (*Model) Ancestors

func (m *Model) Ancestors(n *parser.Node) []*parser.Node

func (*Model) EnclosingFunction

func (m *Model) EnclosingFunction(n *parser.Node) *parser.Node

func (*Model) Inactive

func (m *Model) Inactive(n *parser.Node) bool

func (*Model) IsInsideConditionalBranch

func (m *Model) IsInsideConditionalBranch(n *parser.Node) bool

func (*Model) Iter

func (m *Model) Iter(visit func(*parser.Node))

func (*Model) IterKind

func (m *Model) IterKind(k parser.Kind, visit func(*parser.Node))

func (*Model) KnownDefinesAt

func (m *Model) KnownDefinesAt(offset int) []string

func (*Model) NewDefineCursor

func (m *Model) NewDefineCursor() *DefineCursor

func (*Model) NextSibling

func (m *Model) NextSibling(n *parser.Node) *parser.Node

func (*Model) OfKind

func (m *Model) OfKind(k parser.Kind) []*parser.Node

func (*Model) Parent

func (m *Model) Parent(n *parser.Node) *parser.Node

func (*Model) PrevSibling

func (m *Model) PrevSibling(n *parser.Node) *parser.Node

func (*Model) Range

func (m *Model) Range(n *parser.Node) source.Range

func (*Model) Root

func (m *Model) Root() *parser.Node

func (*Model) Source

func (m *Model) Source() []byte

func (*Model) Text

func (m *Model) Text(n *parser.Node) string

func (*Model) TokenText

func (m *Model) TokenText(tok token.Token) string

func (*Model) Uncertain

func (m *Model) Uncertain(n *parser.Node) bool

Jump to

Keyboard shortcuts

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