parser

package
v3.17.0-beta.0 Latest Latest
Warning

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

Go to latest
Published: May 9, 2024 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package parser provides a parser for a path specification language used in expressing Kubernetes object paths. See specification: https://docs.google.com/document/d/1MdchNFz9guycX__QMGxpJviPaT_MZs8iXaAFqCvoXYQ/edit#heading=h.ryydvhafooho

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrTrailingSeparator indicates a parsing error due to an illegal trailing separator.
	ErrTrailingSeparator = errors.New("trailing separators are forbidden")
	// ErrUnexpectedToken indicates a parsing error due to an unexpected token.
	ErrUnexpectedToken = errors.New("unexpected token")
	// ErrInvalidInteger indicates a parsing error due to an invalid integer, such as integer overflow.
	ErrInvalidInteger = invalidIntegerError{}
)

Functions

This section is empty.

Types

type List

type List struct {
	KeyField string
	KeyValue interface{}
	Glob     bool
}

func (List) DeepCopy

func (l List) DeepCopy() List

func (List) DeepCopyNode

func (l List) DeepCopyNode() Node

func (List) String

func (l List) String() string

func (List) Type

func (l List) Type() NodeType

type Node

type Node interface {
	Type() NodeType
	DeepCopyNode() Node
	// String converts the Node into an equivalent String representation.
	// Calling Parse on the result yields an equivalent Node, but may differ in
	// structure if the Node is a Path containing Path Nodes.
	String() string
}

type NodeType

type NodeType string
const (
	// ListNode is an array element of a path.
	ListNode NodeType = "List"
	// ObjectNode is the final Node in a path, what is being referenced.
	ObjectNode NodeType = "Object"
)

type Object

type Object struct {
	Reference string
}

func (Object) DeepCopy

func (o Object) DeepCopy() Object

func (Object) DeepCopyNode

func (o Object) DeepCopyNode() Node

func (Object) String

func (o Object) String() string

func (Object) Type

func (o Object) Type() NodeType

type Path

type Path struct {
	Nodes []Node
}

Path represents an entire parsed path specification.

func Parse

func Parse(input string) (Path, error)

Parse parses the provided input and returns an abstract representation if successful.

func (Path) DeepCopy

func (r Path) DeepCopy() Path

func (Path) String

func (r Path) String() string

Jump to

Keyboard shortcuts

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