parser

package
v1.0.4 Latest Latest
Warning

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

Go to latest
Published: Feb 13, 2022 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrIndexOutOfRange       = errors.New("index out of range")
	ErrInsertParserTypeError = errors.New("insert parser type error")
	ErrNullPosition          = errors.New("null position")
)

Functions

This section is empty.

Types

type BasicContext

type BasicContext struct {
	Name     parser_type.ParserType `json:"-"`
	Value    string                 `json:"value,omitempty"`
	Children []Parser               `json:"param,omitempty"`
	Position parser_position.ParserPosition
	// contains filtered or unexported fields
}

func (BasicContext) Bytes

func (b BasicContext) Bytes() []byte

func (BasicContext) Dump

func (b BasicContext) Dump(dumper dumper.Dumper) error

func (BasicContext) GetChild

func (b BasicContext) GetChild(index int) (Parser, error)

func (BasicContext) GetIndention

func (b BasicContext) GetIndention() parser_indention.Indention

func (BasicContext) GetPosition

func (b BasicContext) GetPosition() string

func (BasicContext) GetType

func (b BasicContext) GetType() parser_type.ParserType

func (BasicContext) GetValue

func (b BasicContext) GetValue() string

func (*BasicContext) Insert

func (b *BasicContext) Insert(parser Parser, index int) error

func (BasicContext) Len

func (b BasicContext) Len() int

func (BasicContext) Match

func (b BasicContext) Match(words KeyWords) bool

func (*BasicContext) Modify

func (b *BasicContext) Modify(parser Parser, index int) error

func (*BasicContext) Query

func (b *BasicContext) Query(words KeyWords) (Context, int)

func (*BasicContext) QueryAll

func (b *BasicContext) QueryAll(words KeyWords) map[Context][]int

func (*BasicContext) Remove

func (b *BasicContext) Remove(index int) error

func (BasicContext) SetGlobalDeep

func (b BasicContext) SetGlobalDeep(deep int)

type Comment

type Comment struct {
	Comments string `json:"comments"`
	Inline   bool   `json:"inline"`
	// contains filtered or unexported fields
}

func (Comment) Bytes

func (c Comment) Bytes() []byte

func (Comment) Dump

func (c Comment) Dump(dumper dumper.Dumper) error

func (Comment) GetIndention

func (c Comment) GetIndention() parser_indention.Indention

func (*Comment) GetPosition

func (c *Comment) GetPosition() string

func (Comment) GetType

func (c Comment) GetType() parser_type.ParserType

func (Comment) GetValue

func (c Comment) GetValue() string

func (*Comment) Match

func (c *Comment) Match(words KeyWords) bool

func (*Comment) SetGlobalDeep

func (c *Comment) SetGlobalDeep(deep int)

type Config

type Config struct {
	BasicContext `json:"config"`
}

func (Config) Bytes

func (c Config) Bytes() []byte

func (Config) Dump

func (c Config) Dump(dumper dumper.Dumper) error

type Context

type Context interface {
	Parser
	Insert(parser Parser, index int) error
	Remove(index int) error
	Modify(parser Parser, index int) error
	Query(words KeyWords) (Context, int)
	QueryAll(words KeyWords) map[Context][]int
	GetChild(index int) (Parser, error)
	Len() int
}

func NewContext

func NewContext(value string, parserType parser_type.ParserType, indention parser_indention.Indention) Context

type Events

type Events struct {
	BasicContext `json:"events"`
}

type Geo

type Geo struct {
	BasicContext `json:"geo"`
}

type Http

type Http struct {
	BasicContext `json:"http"`
}

type If

type If struct {
	BasicContext `json:"if"`
}

type Include

type Include struct {
	BasicContext `json:"include"`
}

func (Include) Bytes

func (i Include) Bytes() []byte

func (Include) Dump

func (i Include) Dump(dumper dumper.Dumper) error

func (*Include) Insert

func (i *Include) Insert(parser Parser, index int) error

func (*Include) Modify

func (i *Include) Modify(parser Parser, index int) error

type Key

type Key struct {
	Name  string `json:"name"`
	Value string `json:"value"`
	// contains filtered or unexported fields
}

func (Key) Bytes

func (k Key) Bytes() []byte

func (Key) Dump

func (k Key) Dump(dumper dumper.Dumper) error

func (Key) GetIndention

func (k Key) GetIndention() parser_indention.Indention

func (Key) GetPosition

func (k Key) GetPosition() string

func (Key) GetType

func (k Key) GetType() parser_type.ParserType

func (Key) GetValue

func (k Key) GetValue() string

func (*Key) Match

func (k *Key) Match(words KeyWords) bool

func (*Key) SetGlobalDeep

func (k *Key) SetGlobalDeep(deep int)

type KeyWords

type KeyWords interface {
	Match(parser Parser) bool
}

func NewKeyWords

func NewKeyWords(pType parser_type.ParserType, isReg bool, value ...string) (KeyWords, error)

type LimitExcept

type LimitExcept struct {
	BasicContext `json:"limit_except"`
}

type Map

type Map struct {
	BasicContext `json:"map"`
}

type Parser

type Parser interface {
	Bytes() []byte
	Dump(dumper dumper.Dumper) error
	GetType() parser_type.ParserType
	// key.GetValue:
	// return key's name and key's value
	GetValue() string
	GetIndention() parser_indention.Indention
	SetGlobalDeep(int)
	GetPosition() string

	Match(words KeyWords) bool
	// contains filtered or unexported methods
}

func NewComment

func NewComment(comments string, inline bool, indention parser_indention.Indention) Parser

func NewKey

func NewKey(k, v string, indention parser_indention.Indention) Parser

type Server

type Server struct {
	BasicContext `json:"server"`
}

type Stream

type Stream struct {
	BasicContext `json:"stream"`
}

type Types

type Types struct {
	BasicContext `json:"types"`
}

type Upstream

type Upstream struct {
	BasicContext `json:"upstream"`
}

Jump to

Keyboard shortcuts

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