From aa290be33c0d2bf91e0667e5042bf7d6c43a0837 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=99=BD=E8=8C=B6=E6=B8=85=E6=AC=A2?= Date: Thu, 30 Mar 2023 16:30:39 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=AF=B9=E8=B1=A1=E6=A0=88?= =?UTF-8?q?=E5=AE=9A=E4=B9=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tree/node.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/tree/node.go b/tree/node.go index 52f32a4..8b8885b 100644 --- a/tree/node.go +++ b/tree/node.go @@ -32,6 +32,7 @@ type Node struct { PreBrotherNode *Node // 前一个兄弟节点 LastBrotherNode *Node // 下一个兄弟节点 SonNodeList []*Node // 子节点列表 + ObjectStack []string // 对象信息堆栈, 利用栈的括号匹配, 判断某一个对象是否扫面完成 } // NewNode 创建新节点 @@ -54,6 +55,7 @@ func NewNode(key string, value string, valueType string, parentNode *Node) *Node PreBrotherNode: nil, LastBrotherNode: nil, SonNodeList: nil, + ObjectStack: make([]string, 0), } switch valueType { @@ -98,5 +100,9 @@ func NewNode(key string, value string, valueType string, parentNode *Node) *Node // // Date : 23:08 2023/3/28 func NewVirtualNode() *Node { - return &Node{IsVirtual: true, SonNodeList: make([]*Node, 0)} + return &Node{ + IsVirtual: true, + SonNodeList: make([]*Node, 0), + ObjectStack: make([]string, 0), + } }