conf

package
v0.3.7 Latest Latest
Warning

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

Go to latest
Published: May 29, 2020 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultSplitChars = "\r\n\t\f\v #\"';{}\\"
View Source
const IncludeDirective = "include"

Variables

View Source
var DefaultDecoder = &Decoder{
	SplitChars:          DefaultSplitChars,
	TokenFactory:        DefaultTokenFactory,
	TokenHandlerFactory: NewTokenHandler,
}

Functions

func NewErrCommand

func NewErrCommand(command Command, message string) error

func NewErrCommandArg added in v0.3.7

func NewErrCommandArg(command Command, arg string) error

func NewErrCommandArgsNumber added in v0.3.7

func NewErrCommandArgsNumber(command Command) error

func NewErrCommandMustHaveBlock added in v0.3.7

func NewErrCommandMustHaveBlock(command Command) error

func NewErrCommandMustHaveNoBlock added in v0.3.7

func NewErrCommandMustHaveNoBlock(command Command) error

func NewErrCommandName added in v0.3.7

func NewErrCommandName(command Command) error

func NewErrParse

func NewErrParse(line int, data string) error

Types

type BackslashToken

type BackslashToken struct {
}

func (*BackslashToken) String

func (t *BackslashToken) String() string

type Block

type Block interface {
	Call(command Command) error
	CallBlock(command Command) (Block, error)
}

type BlockWrapper

type BlockWrapper struct {
	Parent  *BlockWrapper
	Current Block
}

type ClosingCurlyBracketToken

type ClosingCurlyBracketToken struct {
}

func (*ClosingCurlyBracketToken) String

func (t *ClosingCurlyBracketToken) String() string

type Command

type Command interface {
	GetLine() int
	GetName() string
	GetArgs() []string
	String() string
}

func NewCommand

func NewCommand(line int, name string, args ...string) Command

type Decoder

type Decoder struct {
	SplitChars          string
	TokenFactory        TokenFactoryFunc
	TokenHandlerFactory TokenHandlerFactory
}

func (*Decoder) Decode

func (t *Decoder) Decode(base Block, globs ...string) error

type DefaultCommand

type DefaultCommand struct {
	Line int
	Name string
	Args []string
}

func (*DefaultCommand) GetArgs

func (t *DefaultCommand) GetArgs() []string

func (*DefaultCommand) GetLine added in v0.3.7

func (t *DefaultCommand) GetLine() int

func (*DefaultCommand) GetName

func (t *DefaultCommand) GetName() string

func (*DefaultCommand) String

func (t *DefaultCommand) String() string

type DefaultTokenHandler

type DefaultTokenHandler struct {
	BlockWrapper *BlockWrapper
	Decoder      *Decoder

	Directive           string
	Args                []string
	LastArg             string
	Line                string
	LineNumber          int
	IsCommentLine       bool
	IsDoubleQuotaOpened bool
	IsSingleQuotaOpened bool
	IsEscaped           bool
	IsEscapedNow        bool
}

func (*DefaultTokenHandler) CommitLastArg

func (t *DefaultTokenHandler) CommitLastArg()

func (*DefaultTokenHandler) Handle

func (t *DefaultTokenHandler) Handle(token Token) (err error)

func (*DefaultTokenHandler) HandleBackslashToken

func (t *DefaultTokenHandler) HandleBackslashToken(token *BackslashToken) error

func (*DefaultTokenHandler) HandleClosingCurlyBracketToken

func (t *DefaultTokenHandler) HandleClosingCurlyBracketToken(token *ClosingCurlyBracketToken) error

func (*DefaultTokenHandler) HandleDoubleQuotaToken

func (t *DefaultTokenHandler) HandleDoubleQuotaToken(token *DoubleQuotaToken) error

func (*DefaultTokenHandler) HandleHashToken

func (t *DefaultTokenHandler) HandleHashToken(token *HashToken) error

func (*DefaultTokenHandler) HandleNewlineToken

func (t *DefaultTokenHandler) HandleNewlineToken(token *NewlineToken) error

func (*DefaultTokenHandler) HandleOpeningCurlyBracketToken

func (t *DefaultTokenHandler) HandleOpeningCurlyBracketToken(token *OpeningCurlyBracketToken) error

func (*DefaultTokenHandler) HandleSemicolonToken

func (t *DefaultTokenHandler) HandleSemicolonToken(token *SemicolonToken) (err error)

func (*DefaultTokenHandler) HandleSingleQuotaToken

func (t *DefaultTokenHandler) HandleSingleQuotaToken(token *SingleQuotaToken) error

func (*DefaultTokenHandler) HandleStringToken

func (t *DefaultTokenHandler) HandleStringToken(token *StringToken) error

func (*DefaultTokenHandler) HandleWhitespaceToken

func (t *DefaultTokenHandler) HandleWhitespaceToken(token *WhitespaceToken) error

func (*DefaultTokenHandler) IsCallCommitted

func (t *DefaultTokenHandler) IsCallCommitted() bool

func (*DefaultTokenHandler) IsStringEscaped

func (t *DefaultTokenHandler) IsStringEscaped() bool

type DoubleQuotaToken

type DoubleQuotaToken struct {
}

func (*DoubleQuotaToken) String

func (t *DoubleQuotaToken) String() string

type ErrCommand

type ErrCommand struct {
	Command Command
	Message string
}

func (*ErrCommand) Error

func (t *ErrCommand) Error() string

type ErrParse

type ErrParse struct {
	Line int
	Data string
}

func (*ErrParse) Error

func (t *ErrParse) Error() string

type HashToken

type HashToken struct {
}

func (*HashToken) String

func (t *HashToken) String() string

type NewlineToken

type NewlineToken struct {
}

func (*NewlineToken) String

func (t *NewlineToken) String() string

type OpeningCurlyBracketToken

type OpeningCurlyBracketToken struct {
}

func (*OpeningCurlyBracketToken) String

func (t *OpeningCurlyBracketToken) String() string

type SemicolonToken

type SemicolonToken struct {
}

func (*SemicolonToken) String

func (t *SemicolonToken) String() string

type SingleQuotaToken

type SingleQuotaToken struct {
}

func (*SingleQuotaToken) String

func (t *SingleQuotaToken) String() string

type StringToken

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

func (*StringToken) String

func (t *StringToken) String() string

type Token

type Token interface {
	String() string
}

func DefaultTokenFactory

func DefaultTokenFactory(data string) []Token

type TokenFactoryFunc

type TokenFactoryFunc func(data string) []Token

type TokenHandler

type TokenHandler interface {
	Handle(token Token) error
}

func NewTokenHandler

func NewTokenHandler(base Block, decoder *Decoder) TokenHandler

type TokenHandlerFactory

type TokenHandlerFactory func(base Block, decoder *Decoder) TokenHandler

type WhitespaceToken

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

func (*WhitespaceToken) String

func (t *WhitespaceToken) String() string

Jump to

Keyboard shortcuts

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