优化自动生成json #3
@ -32,6 +32,7 @@ type Node struct {
|
|||||||
PreBrotherNode *Node // 前一个兄弟节点
|
PreBrotherNode *Node // 前一个兄弟节点
|
||||||
LastBrotherNode *Node // 下一个兄弟节点
|
LastBrotherNode *Node // 下一个兄弟节点
|
||||||
SonNodeList []*Node // 子节点列表
|
SonNodeList []*Node // 子节点列表
|
||||||
|
ObjectStack []string // 对象信息堆栈, 利用栈的括号匹配, 判断某一个对象是否扫面完成
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewNode 创建新节点
|
// NewNode 创建新节点
|
||||||
@ -54,6 +55,7 @@ func NewNode(key string, value string, valueType string, parentNode *Node) *Node
|
|||||||
PreBrotherNode: nil,
|
PreBrotherNode: nil,
|
||||||
LastBrotherNode: nil,
|
LastBrotherNode: nil,
|
||||||
SonNodeList: nil,
|
SonNodeList: nil,
|
||||||
|
ObjectStack: make([]string, 0),
|
||||||
}
|
}
|
||||||
|
|
||||||
switch valueType {
|
switch valueType {
|
||||||
@ -98,5 +100,9 @@ func NewNode(key string, value string, valueType string, parentNode *Node) *Node
|
|||||||
//
|
//
|
||||||
// Date : 23:08 2023/3/28
|
// Date : 23:08 2023/3/28
|
||||||
func NewVirtualNode() *Node {
|
func NewVirtualNode() *Node {
|
||||||
return &Node{IsVirtual: true, SonNodeList: make([]*Node, 0)}
|
return &Node{
|
||||||
|
IsVirtual: true,
|
||||||
|
SonNodeList: make([]*Node, 0),
|
||||||
|
ObjectStack: make([]string, 0),
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user