Documentation ¶
Index ¶
- Variables
- func Walk(v Visitor, node Node)
- type AliasNode
- type AnchorNode
- type ArrayNode
- type ArrayNodeIter
- type BoolNode
- type CommentNode
- type DirectiveNode
- type Document
- type File
- type FloatNode
- type InfinityNode
- func (n *InfinityNode) AddColumn(col int)
- func (n *InfinityNode) GetComment() *token.Token
- func (n *InfinityNode) GetToken() *token.Token
- func (n *InfinityNode) GetValue() interface{}
- func (n *InfinityNode) SetComment(tk *token.Token) error
- func (n *InfinityNode) String() string
- func (n *InfinityNode) Type() NodeType
- type IntegerNode
- func (n *IntegerNode) AddColumn(col int)
- func (n *IntegerNode) GetComment() *token.Token
- func (n *IntegerNode) GetToken() *token.Token
- func (n *IntegerNode) GetValue() interface{}
- func (n *IntegerNode) SetComment(tk *token.Token) error
- func (n *IntegerNode) String() string
- func (n *IntegerNode) Type() NodeType
- type LiteralNode
- func (n *LiteralNode) AddColumn(col int)
- func (n *LiteralNode) GetComment() *token.Token
- func (n *LiteralNode) GetToken() *token.Token
- func (n *LiteralNode) GetValue() interface{}
- func (n *LiteralNode) SetComment(tk *token.Token) error
- func (n *LiteralNode) String() string
- func (n *LiteralNode) Type() NodeType
- type MapNode
- type MapNodeIter
- type MappingNode
- func (n *MappingNode) AddColumn(col int)
- func (n *MappingNode) GetComment() *token.Token
- func (n *MappingNode) GetToken() *token.Token
- func (n *MappingNode) MapRange() *MapNodeIter
- func (n *MappingNode) SetComment(tk *token.Token) error
- func (n *MappingNode) String() string
- func (n *MappingNode) Type() NodeType
- type MappingValueNode
- func (n *MappingValueNode) AddColumn(col int)
- func (n *MappingValueNode) GetComment() *token.Token
- func (n *MappingValueNode) GetToken() *token.Token
- func (n *MappingValueNode) MapRange() *MapNodeIter
- func (n *MappingValueNode) SetComment(tk *token.Token) error
- func (n *MappingValueNode) String() string
- func (n *MappingValueNode) Type() NodeType
- type MergeKeyNode
- func (n *MergeKeyNode) AddColumn(col int)
- func (n *MergeKeyNode) GetComment() *token.Token
- func (n *MergeKeyNode) GetToken() *token.Token
- func (n *MergeKeyNode) GetValue() interface{}
- func (n *MergeKeyNode) SetComment(tk *token.Token) error
- func (n *MergeKeyNode) String() string
- func (n *MergeKeyNode) Type() NodeType
- type NanNode
- type Node
- func Bool(tk *token.Token) Node
- func Comment(tk *token.Token) Node
- func Float(tk *token.Token) Node
- func Infinity(tk *token.Token) Node
- func Integer(tk *token.Token) Node
- func MergeKey(tk *token.Token) Node
- func Nan(tk *token.Token) Node
- func Null(tk *token.Token) Node
- func String(tk *token.Token) Node
- type NodeType
- type NullNode
- type ScalarNode
- type SequenceNode
- func (n *SequenceNode) AddColumn(col int)
- func (n *SequenceNode) ArrayRange() *ArrayNodeIter
- func (n *SequenceNode) GetComment() *token.Token
- func (n *SequenceNode) GetToken() *token.Token
- func (n *SequenceNode) SetComment(tk *token.Token) error
- func (n *SequenceNode) String() string
- func (n *SequenceNode) Type() NodeType
- type StringNode
- func (n *StringNode) AddColumn(col int)
- func (n *StringNode) GetComment() *token.Token
- func (n *StringNode) GetToken() *token.Token
- func (n *StringNode) GetValue() interface{}
- func (n *StringNode) SetComment(tk *token.Token) error
- func (n *StringNode) String() string
- func (n *StringNode) Type() NodeType
- type TagNode
- type Visitor
Constants ¶
This section is empty.
Variables ¶
var (
ErrInvalidTokenType = xerrors.New("invalid token type")
)
Functions ¶
Types ¶
type AliasNode ¶
type AliasNode struct { Comment *token.Token // position of Comment ( `#comment` ) Start *token.Token Value Node }
AliasNode type of alias node
func (*AliasNode) AddColumn ¶ added in v1.1.4
AddColumn add column number to child nodes recursively
func (*AliasNode) GetComment ¶ added in v1.4.5
GetComment returns comment token instance
func (*AliasNode) SetComment ¶ added in v1.4.5
SetComment set comment token
type AnchorNode ¶
type AnchorNode struct { Comment *token.Token // position of Comment ( `#comment` ) Start *token.Token Name Node Value Node }
AnchorNode type of anchor node
func (*AnchorNode) AddColumn ¶ added in v1.1.4
func (n *AnchorNode) AddColumn(col int)
AddColumn add column number to child nodes recursively
func (*AnchorNode) GetComment ¶ added in v1.4.5
func (n *AnchorNode) GetComment() *token.Token
GetComment returns comment token instance
func (*AnchorNode) GetToken ¶
func (n *AnchorNode) GetToken() *token.Token
GetToken returns token instance
func (*AnchorNode) SetComment ¶ added in v1.4.5
func (n *AnchorNode) SetComment(tk *token.Token) error
SetComment set comment token
type ArrayNode ¶
type ArrayNode interface {
ArrayRange() *ArrayNodeIter
}
ArrayNode interface of SequenceNode
type ArrayNodeIter ¶
type ArrayNodeIter struct {
// contains filtered or unexported fields
}
ArrayNodeIter is an iterator for ranging over a ArrayNode
func (*ArrayNodeIter) Next ¶
func (m *ArrayNodeIter) Next() bool
Next advances the array iterator and reports whether there is another entry. It returns false when the iterator is exhausted.
func (*ArrayNodeIter) Value ¶
func (m *ArrayNodeIter) Value() Node
Value returns the value of the iterator's current array entry.
type BoolNode ¶
type BoolNode struct { ScalarNode Comment *token.Token // position of Comment ( `#comment` ) Token *token.Token Value bool }
BoolNode type of boolean node
func (*BoolNode) GetComment ¶ added in v1.4.5
GetComment returns comment token instance
func (*BoolNode) GetValue ¶
func (n *BoolNode) GetValue() interface{}
GetValue returns boolean value
func (*BoolNode) SetComment ¶ added in v1.4.5
SetComment set comment token
type CommentNode ¶ added in v1.4.5
CommentNode type of comment node
func (*CommentNode) AddColumn ¶ added in v1.4.5
func (n *CommentNode) AddColumn(col int)
AddColumn add column number to child nodes recursively
func (*CommentNode) GetComment ¶ added in v1.4.5
func (n *CommentNode) GetComment() *token.Token
GetComment returns comment token instance
func (*CommentNode) GetToken ¶ added in v1.4.5
func (n *CommentNode) GetToken() *token.Token
GetToken returns token instance
func (*CommentNode) SetComment ¶ added in v1.4.5
func (n *CommentNode) SetComment(tk *token.Token) error
SetComment set comment token
func (*CommentNode) String ¶ added in v1.4.5
func (n *CommentNode) String() string
String comment to text
func (*CommentNode) Type ¶ added in v1.4.5
func (n *CommentNode) Type() NodeType
Type returns TagType
type DirectiveNode ¶
type DirectiveNode struct { Comment *token.Token // position of Comment ( `#comment` ) Start *token.Token Value Node }
DirectiveNode type of directive node
func (*DirectiveNode) AddColumn ¶ added in v1.1.4
func (n *DirectiveNode) AddColumn(col int)
AddColumn add column number to child nodes recursively
func (*DirectiveNode) GetComment ¶ added in v1.4.5
func (n *DirectiveNode) GetComment() *token.Token
GetComment returns comment token instance
func (*DirectiveNode) GetToken ¶
func (n *DirectiveNode) GetToken() *token.Token
GetToken returns token instance
func (*DirectiveNode) SetComment ¶ added in v1.4.5
func (n *DirectiveNode) SetComment(tk *token.Token) error
SetComment set comment token
type Document ¶
type Document struct { Comment *token.Token // position of Comment ( `#comment` ) Start *token.Token // position of DocumentHeader ( `---` ) End *token.Token // position of DocumentEnd ( `...` ) Body Node }
Document type of Document
func (*Document) GetComment ¶ added in v1.4.5
GetComment returns comment token instance
func (*Document) SetComment ¶ added in v1.4.5
SetComment set comment token
type FloatNode ¶
type FloatNode struct { ScalarNode Comment *token.Token // position of Comment ( `#comment` ) Token *token.Token Precision int Value float64 }
FloatNode type of float node
func (*FloatNode) AddColumn ¶ added in v1.1.4
AddColumn add column number to child nodes recursively
func (*FloatNode) GetComment ¶ added in v1.4.5
GetComment returns comment token instance
func (*FloatNode) GetValue ¶
func (n *FloatNode) GetValue() interface{}
GetValue returns float64 value
func (*FloatNode) SetComment ¶ added in v1.4.5
SetComment set comment token
type InfinityNode ¶
type InfinityNode struct { ScalarNode Comment *token.Token // position of Comment ( `#comment` ) Token *token.Token Value float64 }
InfinityNode type of infinity node
func (*InfinityNode) AddColumn ¶ added in v1.1.4
func (n *InfinityNode) AddColumn(col int)
AddColumn add column number to child nodes recursively
func (*InfinityNode) GetComment ¶ added in v1.4.5
func (n *InfinityNode) GetComment() *token.Token
GetComment returns comment token instance
func (*InfinityNode) GetToken ¶
func (n *InfinityNode) GetToken() *token.Token
GetToken returns token instance
func (*InfinityNode) GetValue ¶
func (n *InfinityNode) GetValue() interface{}
GetValue returns math.Inf(0) or math.Inf(-1)
func (*InfinityNode) SetComment ¶ added in v1.4.5
func (n *InfinityNode) SetComment(tk *token.Token) error
SetComment set comment token
type IntegerNode ¶
type IntegerNode struct { ScalarNode Comment *token.Token // position of Comment ( `#comment` ) Token *token.Token Value interface{} // int64 or uint64 value }
IntegerNode type of integer node
func (*IntegerNode) AddColumn ¶ added in v1.1.4
func (n *IntegerNode) AddColumn(col int)
AddColumn add column number to child nodes recursively
func (*IntegerNode) GetComment ¶ added in v1.4.5
func (n *IntegerNode) GetComment() *token.Token
GetComment returns comment token instance
func (*IntegerNode) GetToken ¶
func (n *IntegerNode) GetToken() *token.Token
GetToken returns token instance
func (*IntegerNode) GetValue ¶
func (n *IntegerNode) GetValue() interface{}
GetValue returns int64 value
func (*IntegerNode) SetComment ¶ added in v1.4.5
func (n *IntegerNode) SetComment(tk *token.Token) error
SetComment set comment token
type LiteralNode ¶
type LiteralNode struct { ScalarNode Comment *token.Token // position of Comment ( `#comment` ) Start *token.Token Value *StringNode }
LiteralNode type of literal node
func (*LiteralNode) AddColumn ¶ added in v1.1.4
func (n *LiteralNode) AddColumn(col int)
AddColumn add column number to child nodes recursively
func (*LiteralNode) GetComment ¶ added in v1.4.5
func (n *LiteralNode) GetComment() *token.Token
GetComment returns comment token instance
func (*LiteralNode) GetToken ¶
func (n *LiteralNode) GetToken() *token.Token
GetToken returns token instance
func (*LiteralNode) GetValue ¶
func (n *LiteralNode) GetValue() interface{}
GetValue returns string value
func (*LiteralNode) SetComment ¶ added in v1.4.5
func (n *LiteralNode) SetComment(tk *token.Token) error
SetComment set comment token
type MapNode ¶
type MapNode interface {
MapRange() *MapNodeIter
}
MapNode interface of MappingValueNode / MappingNode
type MapNodeIter ¶
type MapNodeIter struct {
// contains filtered or unexported fields
}
MapNodeIter is an iterator for ranging over a MapNode
func (*MapNodeIter) Key ¶
func (m *MapNodeIter) Key() Node
Key returns the key of the iterator's current map node entry.
func (*MapNodeIter) Next ¶
func (m *MapNodeIter) Next() bool
Next advances the map iterator and reports whether there is another entry. It returns false when the iterator is exhausted.
func (*MapNodeIter) Value ¶
func (m *MapNodeIter) Value() Node
Value returns the value of the iterator's current map node entry.
type MappingNode ¶
type MappingNode struct { Comment *token.Token // position of Comment ( `#comment` ) Start *token.Token End *token.Token IsFlowStyle bool Values []*MappingValueNode }
MappingNode type of mapping node
func Mapping ¶
func Mapping(tk *token.Token, isFlowStyle bool) *MappingNode
Mapping create node for map
func (*MappingNode) AddColumn ¶ added in v1.1.4
func (n *MappingNode) AddColumn(col int)
AddColumn add column number to child nodes recursively
func (*MappingNode) GetComment ¶ added in v1.4.5
func (n *MappingNode) GetComment() *token.Token
GetComment returns comment token instance
func (*MappingNode) GetToken ¶
func (n *MappingNode) GetToken() *token.Token
GetToken returns token instance
func (*MappingNode) MapRange ¶
func (n *MappingNode) MapRange() *MapNodeIter
MapRange implements MapNode protocol
func (*MappingNode) SetComment ¶ added in v1.4.5
func (n *MappingNode) SetComment(tk *token.Token) error
SetComment set comment token
type MappingValueNode ¶
type MappingValueNode struct { Comment *token.Token // position of Comment ( `#comment` ) Start *token.Token Key Node Value Node }
MappingValueNode type of mapping value
func (*MappingValueNode) AddColumn ¶ added in v1.1.4
func (n *MappingValueNode) AddColumn(col int)
AddColumn add column number to child nodes recursively
func (*MappingValueNode) GetComment ¶ added in v1.4.5
func (n *MappingValueNode) GetComment() *token.Token
GetComment returns comment token instance
func (*MappingValueNode) GetToken ¶
func (n *MappingValueNode) GetToken() *token.Token
GetToken returns token instance
func (*MappingValueNode) MapRange ¶
func (n *MappingValueNode) MapRange() *MapNodeIter
MapRange implements MapNode protocol
func (*MappingValueNode) SetComment ¶ added in v1.4.5
func (n *MappingValueNode) SetComment(tk *token.Token) error
SetComment set comment token
func (*MappingValueNode) String ¶
func (n *MappingValueNode) String() string
String mapping value to text
func (*MappingValueNode) Type ¶
func (n *MappingValueNode) Type() NodeType
Type returns MappingValueType
type MergeKeyNode ¶
type MergeKeyNode struct { ScalarNode Comment *token.Token // position of Comment ( `#comment` ) Token *token.Token }
MergeKeyNode type of merge key node
func (*MergeKeyNode) AddColumn ¶ added in v1.4.0
func (n *MergeKeyNode) AddColumn(col int)
AddColumn add column number to child nodes recursively
func (*MergeKeyNode) GetComment ¶ added in v1.4.5
func (n *MergeKeyNode) GetComment() *token.Token
GetComment returns comment token instance
func (*MergeKeyNode) GetToken ¶
func (n *MergeKeyNode) GetToken() *token.Token
GetToken returns token instance
func (*MergeKeyNode) GetValue ¶
func (n *MergeKeyNode) GetValue() interface{}
GetValue returns '<<' value
func (*MergeKeyNode) SetComment ¶ added in v1.4.5
func (n *MergeKeyNode) SetComment(tk *token.Token) error
SetComment set comment token
type NanNode ¶
type NanNode struct { ScalarNode Comment *token.Token // position of Comment ( `#comment` ) Token *token.Token }
NanNode type of nan node
func (*NanNode) GetComment ¶ added in v1.4.5
GetComment returns comment token instance
func (*NanNode) SetComment ¶ added in v1.4.5
SetComment set comment token
type Node ¶
type Node interface { // String node to text String() string // GetToken returns token instance GetToken() *token.Token // Type returns type of node Type() NodeType // AddColumn add column number to child nodes recursively AddColumn(int) // SetComment set comment token to node SetComment(*token.Token) error // Comment returns comment token instance GetComment() *token.Token }
Node type of node
type NodeType ¶
type NodeType int
NodeType type identifier of node
const ( // UnknownNodeType type identifier for default UnknownNodeType NodeType = iota // DocumentType type identifier for document node DocumentType // NullType type identifier for null node NullType // BoolType type identifier for boolean node BoolType // IntegerType type identifier for integer node IntegerType // FloatType type identifier for float node FloatType // InfinityType type identifier for infinity node InfinityType // NanType type identifier for nan node NanType // StringType type identifier for string node StringType // MergeKeyType type identifier for merge key node MergeKeyType // LiteralType type identifier for literal node LiteralType // MappingType type identifier for mapping node MappingType // MappingValueType type identifier for mapping value node MappingValueType // SequenceType type identifier for sequence node SequenceType // AnchorType type identifier for anchor node AnchorType // AliasType type identifier for alias node AliasType // DirectiveType type identifier for directive node DirectiveType // TagType type identifier for tag node TagType // CommentType type identifier for comment node CommentType )
type NullNode ¶
type NullNode struct { ScalarNode Comment *token.Token // position of Comment ( `#comment` ) Token *token.Token }
NullNode type of null node
func (*NullNode) GetComment ¶ added in v1.4.5
GetComment returns comment token instance
func (*NullNode) SetComment ¶ added in v1.4.5
SetComment set comment token
type ScalarNode ¶
type ScalarNode interface { Node GetValue() interface{} }
ScalarNode type for scalar node
type SequenceNode ¶
type SequenceNode struct { Comment *token.Token // position of Comment ( `#comment` ) Start *token.Token End *token.Token IsFlowStyle bool Values []Node }
SequenceNode type of sequence node
func Sequence ¶
func Sequence(tk *token.Token, isFlowStyle bool) *SequenceNode
Sequence create node for sequence
func (*SequenceNode) AddColumn ¶ added in v1.1.4
func (n *SequenceNode) AddColumn(col int)
AddColumn add column number to child nodes recursively
func (*SequenceNode) ArrayRange ¶
func (n *SequenceNode) ArrayRange() *ArrayNodeIter
ArrayRange implements ArrayNode protocol
func (*SequenceNode) GetComment ¶ added in v1.4.5
func (n *SequenceNode) GetComment() *token.Token
GetComment returns comment token instance
func (*SequenceNode) GetToken ¶
func (n *SequenceNode) GetToken() *token.Token
GetToken returns token instance
func (*SequenceNode) SetComment ¶ added in v1.4.5
func (n *SequenceNode) SetComment(tk *token.Token) error
SetComment set comment token
type StringNode ¶
type StringNode struct { ScalarNode Comment *token.Token // position of Comment ( `#comment` ) Token *token.Token Value string }
StringNode type of string node
func (*StringNode) AddColumn ¶ added in v1.1.4
func (n *StringNode) AddColumn(col int)
AddColumn add column number to child nodes recursively
func (*StringNode) GetComment ¶ added in v1.4.5
func (n *StringNode) GetComment() *token.Token
GetComment returns comment token instance
func (*StringNode) GetToken ¶
func (n *StringNode) GetToken() *token.Token
GetToken returns token instance
func (*StringNode) GetValue ¶
func (n *StringNode) GetValue() interface{}
GetValue returns string value
func (*StringNode) SetComment ¶ added in v1.4.5
func (n *StringNode) SetComment(tk *token.Token) error
SetComment set comment token
func (*StringNode) String ¶
func (n *StringNode) String() string
String string value to text with quote or literal header if required
type TagNode ¶
type TagNode struct { Comment *token.Token // position of Comment ( `#comment` ) Start *token.Token Value Node }
TagNode type of tag node
func (*TagNode) GetComment ¶ added in v1.4.5
GetComment returns comment token instance
func (*TagNode) SetComment ¶ added in v1.4.5
SetComment set comment token