vdf

package
v0.0.0-...-ca00f6e Latest Latest
Warning

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

Go to latest
Published: Aug 12, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package vdf implements a parser and serializer for Valve Data Format.

Index

Constants

This section is empty.

Variables

View Source
var (
	Escape = strings.NewReplacer(
		"\\", "\\\\",
		"\n", "\\n",
		"\t", "\\t",
		"\v", "\\v",
		"\b", "\\b",
		"\r", "\\r",
		"\f", "\\f",
		"\a", "\\a",
		"\"", "\\\"",
	)

	Unescape = strings.NewReplacer(
		"\\n", "\n",
		"\\t", "\t",
		"\\v", "\v",
		"\\b", "\b",
		"\\r", "\r",
		"\\f", "\f",
		"\\a", "\a",
		"\\\"", "\"",
		"\\'", "'",
		"\\?", "?",
		"\\\\", "\\",
	)
)

Functions

This section is empty.

Types

type KeyValues

type KeyValues struct {
	Key      string
	Value    string
	Cond     string
	HasValue bool
	// contains filtered or unexported fields
}

func (*KeyValues) AddSubKey

func (kv *KeyValues) AddSubKey(child *KeyValues)

func (*KeyValues) FindKey

func (kv *KeyValues) FindKey(name string) *KeyValues

func (*KeyValues) FirstSubKey

func (kv *KeyValues) FirstSubKey() *KeyValues

func (*KeyValues) FirstTrueSubKey

func (kv *KeyValues) FirstTrueSubKey() *KeyValues

func (*KeyValues) FirstValue

func (kv *KeyValues) FirstValue() *KeyValues

func (*KeyValues) NextSubKey

func (kv *KeyValues) NextSubKey() *KeyValues

func (*KeyValues) NextTrueSubKey

func (kv *KeyValues) NextTrueSubKey() *KeyValues

func (*KeyValues) NextValue

func (kv *KeyValues) NextValue() *KeyValues

func (*KeyValues) ReadFrom

func (kv *KeyValues) ReadFrom(r io.Reader) (int64, error)

func (*KeyValues) String

func (kv *KeyValues) String() string

func (*KeyValues) WriteTo

func (kv *KeyValues) WriteTo(w io.Writer) (int64, error)

type Token

type Token uint8

Token is an enumeration of the types of syntax token in a VDF file.

const (
	TokenSpace Token = iota
	TokenComment
	TokenString
	TokenQuoted
	TokenCond
	TokenOpenBrace
	TokenCloseBrace
)

func ReadToken

func ReadToken(r *bufio.Reader) (string, Token, error)

ReadToken consumes and returns the next token in the reader.

The returned string is verbatim; no processing is done other than determining its length and token type.

Input to this function is expected to be UTF-8 encoded.

func (Token) String

func (i Token) String() string

Jump to

Keyboard shortcuts

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