analyser

package
v0.0.0-...-352e25d Latest Latest
Warning

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

Go to latest
Published: Apr 6, 2017 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	String lexemeType = iota
	Number
	Bool
	Null

	ObjectOpen
	ObjectClose
	ArrayOpen
	ArrayClose

	Comma
	Colon
)

all possible JSON lexeme

Variables

View Source
var ErrEOF = errors.New("No more lexeme")

ErrEOF represent no more lexeme

View Source
var ErrRootNodeShouldBeObjectOrArray = errors.New("Root node should be object or array")

ErrRootNodeShouldBeObjectOrArray ...

Functions

This section is empty.

Types

type ArrayNode

type ArrayNode struct {
	Parent Node `json:"-"`
	Items  []interface{}
}

ArrayNode represent node of JSON array

func (*ArrayNode) Append

func (n *ArrayNode) Append(i interface{})

Append append sub node or other things

func (*ArrayNode) GetParent

func (n *ArrayNode) GetParent() Node

GetParent get parent of node

func (*ArrayNode) SetParent

func (n *ArrayNode) SetParent(p Node)

SetParent set parent of node

type Lexeme

type Lexeme struct {
	Type  lexemeType
	Value string
}

Lexeme ...

type LexemeList

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

LexemeList ...

func (*LexemeList) Read

func (l *LexemeList) Read() (*Lexeme, error)

Read ...

func (*LexemeList) Write

func (l *LexemeList) Write(p []byte) (n int, err error)

Write accept JSON string

type Node

type Node interface {
	Append(i interface{})
	SetParent(p Node)
	GetParent() Node
}

Node represent node on syntax tree

type ObjectNode

type ObjectNode struct {
	Parent     Node   `json:"-"`
	NextKey    string `json:"-"`
	Properties map[string]interface{}
}

ObjectNode represent node of JSON object

func (*ObjectNode) Append

func (n *ObjectNode) Append(i interface{})

Append append sub node or other things

func (*ObjectNode) GetParent

func (n *ObjectNode) GetParent() Node

GetParent get parent of node

func (*ObjectNode) SetParent

func (n *ObjectNode) SetParent(p Node)

SetParent set parent of node

type SyntaxTree

type SyntaxTree struct {
	Root    Node
	Current Node
	Remain  string
}

SyntaxTree syntax tree

func (*SyntaxTree) Convert

func (t *SyntaxTree) Convert(travel func(node interface{}, depth int, output *bytes.Buffer)) []byte

EncodeToStruct encode to Go struct

func (*SyntaxTree) String

func (t *SyntaxTree) String() string

String ...

func (*SyntaxTree) Write

func (t *SyntaxTree) Write(l *LexemeList) error

Write ...

Jump to

Keyboard shortcuts

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