package tracker

import "github.com/pelletier/go-toml/v2/internal/tracker"

Index

Types

type KeyTracker

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

KeyTracker is a tracker that keeps track of the current Key as the AST is walked.

func (*KeyTracker) Key

func (t *KeyTracker) Key() []string

Key returns the current key

func (*KeyTracker) Pop

func (t *KeyTracker) Pop(node ast.Node)

Pop key from stack.

func (*KeyTracker) Push

func (t *KeyTracker) Push(node ast.Node)

Push the given key on the stack.

func (*KeyTracker) UpdateArrayTable

func (t *KeyTracker) UpdateArrayTable(node ast.Node)

UpdateArrayTable sets the state of the tracker with the AST array table node.

func (*KeyTracker) UpdateTable

func (t *KeyTracker) UpdateTable(node ast.Node)

UpdateTable sets the state of the tracker with the AST table node.

type SeenTracker

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

SeenTracker tracks which keys have been seen with which TOML type to flag duplicates and mismatches according to the spec.

func (*SeenTracker) CheckExpression

func (s *SeenTracker) CheckExpression(node ast.Node) error

CheckExpression takes a top-level node and checks that it does not contain keys that have been seen in previous calls, and validates that types are consistent.

Source Files

key.go seen.go tracker.go

Version
v2.0.0-alpha.2
Published
Apr 21, 2021
Platform
js/wasm
Imports
2 packages
Last checked
4 hours ago

Tools for package owners.