hocon

package
v0.0.0-...-a002c03 Latest Latest
Warning

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

Go to latest
Published: Jun 6, 2020 License: Apache-2.0 Imports: 10 Imported by: 12

Documentation

Index

Constants

View Source
const (
	HoconNotInUnquotedKey  = "$\"{}[]:=+,#`^?!@*&\\."
	HoconNotInUnquotedText = "$\"{}[]:=+,#`^?!@*&\\"
)

Variables

View Source
var (
	DefaultToken = Token{}
)

Functions

func StringTokenType

func StringTokenType(tokenType TokenType) string

Types

type HoconArray

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

func NewHoconArray

func NewHoconArray() *HoconArray

func (*HoconArray) GetArray

func (p *HoconArray) GetArray() []*HoconValue

func (*HoconArray) GetString

func (p *HoconArray) GetString() string

func (*HoconArray) IsArray

func (p *HoconArray) IsArray() bool

func (*HoconArray) IsString

func (p *HoconArray) IsString() bool

func (*HoconArray) String

func (p *HoconArray) String() string

type HoconElement

type HoconElement interface {
	IsString() bool
	GetString() string
	IsArray() bool
	GetArray() []*HoconValue
}

type HoconLiteral

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

func NewHoconLiteral

func NewHoconLiteral(value string) *HoconLiteral

func (*HoconLiteral) GetArray

func (p *HoconLiteral) GetArray() []*HoconValue

func (*HoconLiteral) GetString

func (p *HoconLiteral) GetString() string

func (*HoconLiteral) IsArray

func (p *HoconLiteral) IsArray() bool

func (*HoconLiteral) IsString

func (p *HoconLiteral) IsString() bool

func (*HoconLiteral) String

func (p *HoconLiteral) String() string

type HoconObject

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

func NewHoconObject

func NewHoconObject() *HoconObject

func (*HoconObject) GetArray

func (p *HoconObject) GetArray() []*HoconValue

func (*HoconObject) GetKey

func (p *HoconObject) GetKey(key string) *HoconValue

func (*HoconObject) GetKeys

func (p *HoconObject) GetKeys() []string

func (*HoconObject) GetOrCreateKey

func (p *HoconObject) GetOrCreateKey(key string) *HoconValue

func (*HoconObject) GetString

func (p *HoconObject) GetString() string

func (*HoconObject) IsArray

func (p *HoconObject) IsArray() bool

func (*HoconObject) IsString

func (p *HoconObject) IsString() bool

func (*HoconObject) Items

func (p *HoconObject) Items() map[string]*HoconValue

func (*HoconObject) Merge

func (p *HoconObject) Merge(other *HoconObject)

func (*HoconObject) MergeImmutable

func (p *HoconObject) MergeImmutable(other *HoconObject) *HoconObject

func (*HoconObject) String

func (p *HoconObject) String() string

func (*HoconObject) ToString

func (p *HoconObject) ToString(indent int) string

func (*HoconObject) Unwrapped

func (p *HoconObject) Unwrapped() map[string]interface{}

type HoconRoot

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

func NewHoconRoot

func NewHoconRoot(value *HoconValue, substitutions ...*HoconSubstitution) *HoconRoot

func Parse

func Parse(text string, callback IncludeCallback) *HoconRoot

func (HoconRoot) Substitutions

func (p HoconRoot) Substitutions() []*HoconSubstitution

func (HoconRoot) Value

func (p HoconRoot) Value() *HoconValue

type HoconSubstitution

type HoconSubstitution struct {
	Path          string
	ResolvedValue *HoconValue
	IsOptional    bool
	OrignialPath  string
}

func NewHoconSubstitution

func NewHoconSubstitution(path string, isOptional bool) *HoconSubstitution

func (*HoconSubstitution) GetArray

func (p *HoconSubstitution) GetArray() []*HoconValue

func (*HoconSubstitution) GetObject

func (p *HoconSubstitution) GetObject() *HoconObject

func (*HoconSubstitution) GetString

func (p *HoconSubstitution) GetString() string

func (*HoconSubstitution) IsArray

func (p *HoconSubstitution) IsArray() bool

func (*HoconSubstitution) IsObject

func (p *HoconSubstitution) IsObject() bool

func (*HoconSubstitution) IsString

func (p *HoconSubstitution) IsString() bool

type HoconTokenizer

type HoconTokenizer struct {
	*Tokenizer
}

func NewHoconTokenizer

func NewHoconTokenizer(text string) *HoconTokenizer

func (*HoconTokenizer) IsArrayEnd

func (p *HoconTokenizer) IsArrayEnd() bool

func (*HoconTokenizer) IsArrayStart

func (p *HoconTokenizer) IsArrayStart() bool

func (*HoconTokenizer) IsAssignment

func (p *HoconTokenizer) IsAssignment() bool

func (*HoconTokenizer) IsComma

func (p *HoconTokenizer) IsComma() bool

func (*HoconTokenizer) IsDot

func (p *HoconTokenizer) IsDot() bool

func (*HoconTokenizer) IsEndOfObject

func (p *HoconTokenizer) IsEndOfObject() bool

func (*HoconTokenizer) IsInclude

func (p *HoconTokenizer) IsInclude() bool

func (*HoconTokenizer) IsNewline

func (p *HoconTokenizer) IsNewline() bool

func (*HoconTokenizer) IsObjectStart

func (p *HoconTokenizer) IsObjectStart() bool

func (*HoconTokenizer) IsPlusAssignment

func (p *HoconTokenizer) IsPlusAssignment() bool

func (*HoconTokenizer) IsSpaceOrTab

func (p *HoconTokenizer) IsSpaceOrTab() bool

func (*HoconTokenizer) IsStartOfComment

func (p *HoconTokenizer) IsStartOfComment() bool

func (*HoconTokenizer) IsStartOfQuotedText

func (p *HoconTokenizer) IsStartOfQuotedText() bool

func (*HoconTokenizer) IsStartOfTripleQuotedText

func (p *HoconTokenizer) IsStartOfTripleQuotedText() bool

func (*HoconTokenizer) IsStartSimpleValue

func (p *HoconTokenizer) IsStartSimpleValue() bool

func (*HoconTokenizer) IsSubstitutionStart

func (p *HoconTokenizer) IsSubstitutionStart() bool

func (*HoconTokenizer) IsUnquotedKey

func (p *HoconTokenizer) IsUnquotedKey() bool

func (*HoconTokenizer) IsUnquotedKeyStart

func (p *HoconTokenizer) IsUnquotedKeyStart() bool

func (*HoconTokenizer) IsWhitespace

func (p *HoconTokenizer) IsWhitespace() bool

func (*HoconTokenizer) IsWhitespaceOrComment

func (p *HoconTokenizer) IsWhitespaceOrComment() bool

func (*HoconTokenizer) PullArrayEnd

func (p *HoconTokenizer) PullArrayEnd() *Token

func (*HoconTokenizer) PullArrayStart

func (p *HoconTokenizer) PullArrayStart() *Token

func (*HoconTokenizer) PullAssignment

func (p *HoconTokenizer) PullAssignment() *Token

func (*HoconTokenizer) PullComma

func (p *HoconTokenizer) PullComma() *Token

func (*HoconTokenizer) PullComment

func (p *HoconTokenizer) PullComment() *Token

func (*HoconTokenizer) PullDot

func (p *HoconTokenizer) PullDot() *Token

func (*HoconTokenizer) PullEndOfObject

func (p *HoconTokenizer) PullEndOfObject() *Token

func (*HoconTokenizer) PullInclude

func (p *HoconTokenizer) PullInclude() *Token

func (*HoconTokenizer) PullNewline

func (p *HoconTokenizer) PullNewline() *Token

func (*HoconTokenizer) PullNext

func (p *HoconTokenizer) PullNext() (token *Token)

func (*HoconTokenizer) PullPlusAssignment

func (p *HoconTokenizer) PullPlusAssignment() *Token

func (*HoconTokenizer) PullQuotedKey

func (p *HoconTokenizer) PullQuotedKey() *Token

func (*HoconTokenizer) PullQuotedText

func (p *HoconTokenizer) PullQuotedText() *Token

func (*HoconTokenizer) PullRestOfLine

func (p *HoconTokenizer) PullRestOfLine() string

func (*HoconTokenizer) PullSimpleValue

func (p *HoconTokenizer) PullSimpleValue() *Token

func (*HoconTokenizer) PullSpaceOrTab

func (p *HoconTokenizer) PullSpaceOrTab() *Token

func (*HoconTokenizer) PullStartOfObject

func (p *HoconTokenizer) PullStartOfObject() *Token

func (*HoconTokenizer) PullTripleQuotedText

func (p *HoconTokenizer) PullTripleQuotedText() *Token

func (*HoconTokenizer) PullUnquotedKey

func (p *HoconTokenizer) PullUnquotedKey() *Token

func (*HoconTokenizer) PullValue

func (p *HoconTokenizer) PullValue() *Token

func (*HoconTokenizer) PullWhitespaceAndComments

func (p *HoconTokenizer) PullWhitespaceAndComments()

type HoconValue

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

func NewHoconValue

func NewHoconValue() *HoconValue

func (*HoconValue) AppendValue

func (p *HoconValue) AppendValue(value HoconElement)

func (*HoconValue) AtKey

func (p *HoconValue) AtKey(key string) *HoconRoot

func (*HoconValue) Clear

func (p *HoconValue) Clear()

func (*HoconValue) GetArray

func (p *HoconValue) GetArray() []*HoconValue

func (*HoconValue) GetBoolean

func (p *HoconValue) GetBoolean() bool

func (*HoconValue) GetBooleanList

func (p *HoconValue) GetBooleanList() []bool

func (*HoconValue) GetByte

func (p *HoconValue) GetByte() byte

func (*HoconValue) GetByteList

func (p *HoconValue) GetByteList() []byte

func (*HoconValue) GetByteSize

func (p *HoconValue) GetByteSize() *big.Int

func (*HoconValue) GetChildObject

func (p *HoconValue) GetChildObject(key string) *HoconValue

func (*HoconValue) GetFloat32

func (p *HoconValue) GetFloat32() float32

func (*HoconValue) GetFloat32List

func (p *HoconValue) GetFloat32List() []float32

func (*HoconValue) GetFloat64

func (p *HoconValue) GetFloat64() float64

func (*HoconValue) GetFloat64List

func (p *HoconValue) GetFloat64List() []float64

func (*HoconValue) GetInt32

func (p *HoconValue) GetInt32() int32

func (*HoconValue) GetInt32List

func (p *HoconValue) GetInt32List() []int32

func (*HoconValue) GetInt64

func (p *HoconValue) GetInt64() int64

func (*HoconValue) GetInt64List

func (p *HoconValue) GetInt64List() []int64

func (*HoconValue) GetObject

func (p *HoconValue) GetObject() *HoconObject

func (*HoconValue) GetString

func (p *HoconValue) GetString() string

func (*HoconValue) GetStringList

func (p *HoconValue) GetStringList() []string

func (*HoconValue) GetTimeDuration

func (p *HoconValue) GetTimeDuration(allowInfinite bool) time.Duration

func (*HoconValue) IsArray

func (p *HoconValue) IsArray() bool

func (*HoconValue) IsEmpty

func (p *HoconValue) IsEmpty() bool

func (*HoconValue) IsObject

func (p *HoconValue) IsObject() bool

func (*HoconValue) IsString

func (p *HoconValue) IsString() bool

func (*HoconValue) NewValue

func (p *HoconValue) NewValue(value HoconElement)

func (*HoconValue) String

func (p *HoconValue) String() string

func (*HoconValue) ToString

func (p *HoconValue) ToString(indent int) string

type IncludeCallback

type IncludeCallback func(filename string) *HoconRoot

type MightBeAHoconObject

type MightBeAHoconObject interface {
	IsObject() bool
	GetObject() *HoconObject
}

type Parser

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

func (*Parser) ParseArray

func (p *Parser) ParseArray(currentPath string) HoconArray

func (*Parser) ParseSubstitution

func (p *Parser) ParseSubstitution(value string, isOptional bool) *HoconSubstitution

func (*Parser) ParseTrailingWhitespace

func (p *Parser) ParseTrailingWhitespace(owner *HoconValue)

func (*Parser) ParseValue

func (p *Parser) ParseValue(owner *HoconValue, isEqualPlus bool, currentPath string)

type Stack

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

func NewStack

func NewStack() *Stack

func (*Stack) Pop

func (p *Stack) Pop() (int, error)

func (*Stack) Push

func (p *Stack) Push(v int)

type Token

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

func NewToken

func NewToken(v interface{}) *Token

func (*Token) Include

func (p *Token) Include(path string) *Token

func (*Token) Key

func (p *Token) Key(key string) *Token

func (*Token) LiteralValue

func (p *Token) LiteralValue(value string) *Token

func (*Token) Substitution

func (p *Token) Substitution(path string, isOptional bool) *Token

type TokenType

type TokenType int
const (
	TokenTypeNone TokenType = iota
	TokenTypeComment
	TokenTypeKey
	TokenTypeLiteralValue
	TokenTypeAssign
	TokenTypePlusAssign
	TokenTypeObjectStart
	TokenTypeObjectEnd
	TokenTypeDot
	TokenTypeNewline
	TokenTypeEoF
	TokenTypeArrayStart
	TokenTypeArrayEnd
	TokenTypeComma
	TokenTypeSubstitute
	TokenTypeInclude
)

type Tokenizer

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

func NewTokenizer

func NewTokenizer(text string) *Tokenizer

func (*Tokenizer) EOF

func (p *Tokenizer) EOF() bool

func (*Tokenizer) Matches

func (p *Tokenizer) Matches(pattern string) bool

func (*Tokenizer) MatchesMore

func (p *Tokenizer) MatchesMore(patterns []string) bool

func (*Tokenizer) Peek

func (p *Tokenizer) Peek() byte

func (*Tokenizer) Pop

func (p *Tokenizer) Pop()

func (*Tokenizer) PullWhitespace

func (p *Tokenizer) PullWhitespace()

func (*Tokenizer) Push

func (p *Tokenizer) Push()

func (*Tokenizer) Take

func (p *Tokenizer) Take(length int) string

func (*Tokenizer) TakeOne

func (p *Tokenizer) TakeOne() byte

Jump to

Keyboard shortcuts

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