ir

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2025 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Package ir contains the Tony format implementation.

Index

Constants

View Source
const (
	IntKeysTag = "!sparsearray"
	IntKeysFmt = "%d"
	MergeKey   = "<<"
)

Variables

View Source
var (
	ErrParse     = errors.New("parse error")
	ErrBadFormat = format.ErrBadFormat
)

Functions

func CheckTag

func CheckTag(tag string) error

func HeadTag

func HeadTag(tag string) (string, string)

func TagArgs

func TagArgs(tag string) (string, []string, string)

func TagCompose

func TagCompose(tag string, args []string, oTag string) string

func TagGet

func TagGet(tag, what string) (string, []string)

func TagHas

func TagHas(tag, what string) bool

func TagRemove

func TagRemove(tag, what string) string

func ToMap

func ToMap(node *Node) map[string]*Node

func Truth

func Truth(node *Node) bool

Types

type KeyVal

type KeyVal struct {
	Key *Node
	Val *Node
}

type Node

type Node struct {
	Type        Type
	Parent      *Node
	ParentIndex int
	ParentField string
	Fields      []*Node
	Values      []*Node

	Tag     string
	Lines   []string
	Comment *Node

	String  string
	Bool    bool
	Number  string
	Float64 *float64
	Int64   *int64
}

func FromBool

func FromBool(v bool) *Node

func FromFloat

func FromFloat(f float64) *Node

func FromInt

func FromInt(v int64) *Node

func FromIntKeysMap

func FromIntKeysMap(yMap map[uint32]*Node) *Node

func FromIntKeysMapAt

func FromIntKeysMapAt(res *Node, yMap map[uint32]*Node) *Node

func FromKeyVals

func FromKeyVals(kvs []KeyVal) *Node

func FromKeyValsAt

func FromKeyValsAt(res *Node, kvs []KeyVal) *Node

func FromMap

func FromMap(yMap map[string]*Node) *Node

func FromSlice

func FromSlice(ySlice []*Node) *Node

func FromString

func FromString(v string) *Node

func FromStringAt

func FromStringAt(p *Node, v string) *Node

func Get

func Get(y *Node, field string) *Node

func Null

func Null() *Node

func (*Node) Clone

func (y *Node) Clone() *Node

func (*Node) CloneTo

func (y *Node) CloneTo(dst *Node) *Node

func (*Node) GetPath

func (y *Node) GetPath(yPath string) (*Node, error)

func (*Node) ListPath

func (y *Node) ListPath(dst []*Node, yPath string) ([]*Node, error)

func (*Node) MarshalJSON

func (y *Node) MarshalJSON() ([]byte, error)

func (*Node) NonCommentParent

func (y *Node) NonCommentParent() *Node

func (*Node) Path

func (y *Node) Path() string

func (*Node) ReType

func (y *Node) ReType()

used when a tag overrides a default built in tag

func (*Node) Root

func (y *Node) Root() *Node

func (*Node) ToIntKeysMap

func (y *Node) ToIntKeysMap() (map[uint32]*Node, error)

func (*Node) UnmarshalJSON

func (y *Node) UnmarshalJSON(d []byte) error

func (*Node) Visit

func (y *Node) Visit(f func(y *Node, isPost bool) (bool, error)) error

func (*Node) WithTag

func (y *Node) WithTag(tag string) *Node

type Path

type Path struct {
	IndexAll bool
	Index    *int
	Field    *string
	Subtree  bool
	Next     *Path
}

func ParsePath

func ParsePath(p string) (*Path, error)

func (*Path) String

func (p *Path) String() string

type Type

type Type int
const (
	NullType Type = iota
	NumberType
	StringType
	BoolType
	ObjectType
	ArrayType
	CommentType
)

func Types

func Types() []Type

func (Type) IsLeaf

func (t Type) IsLeaf() bool

func (Type) MarshalText

func (t Type) MarshalText() ([]byte, error)

func (Type) String

func (t Type) String() string

func (*Type) UnmarshalText

func (t *Type) UnmarshalText(d []byte) error

Jump to

Keyboard shortcuts

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