优化词法分析,分析时增加类型
This commit is contained in:
28
define.go
28
define.go
@ -7,17 +7,20 @@
|
||||
// Date : 2022-07-04 18:02
|
||||
package filter
|
||||
|
||||
import "fmt"
|
||||
|
||||
// jsonNode json语法树节点定义
|
||||
//
|
||||
// Author : go_developer@163.com<白茶清欢>
|
||||
//
|
||||
// Date : 18:06 2022/7/4
|
||||
type jsonNode struct {
|
||||
Name string // 节点名称
|
||||
Parent *jsonNode // 父节点
|
||||
Son *jsonNode // 子节点
|
||||
Brother *jsonNode // 兄弟节点
|
||||
Val interface{} // 节点的值
|
||||
Name string // 节点名称
|
||||
Parent *jsonNode // 父节点
|
||||
Son *jsonNode // 子节点
|
||||
PreBrother *jsonNode // 前一个兄弟节点
|
||||
NextBrother *jsonNode // 下一个兄弟节点
|
||||
Val interface{} // 节点的值
|
||||
}
|
||||
|
||||
// lexicalNode 词法分析的节点
|
||||
@ -26,6 +29,17 @@ type jsonNode struct {
|
||||
//
|
||||
// Date : 18:02 2022/7/4
|
||||
type lexicalNode struct {
|
||||
Val string // 词法分析出来的词
|
||||
IsToken bool // 是否为关键字
|
||||
Val interface{} // 词法分析出来的词
|
||||
Type string // 值得类型
|
||||
Show bool // 这个值是否对外呈现
|
||||
IsToken bool // 是否为关键字
|
||||
}
|
||||
|
||||
// ValStr 值转为字符串
|
||||
//
|
||||
// Author : go_developer@163.com<白茶清欢>
|
||||
//
|
||||
// Date : 14:10 2022/7/5
|
||||
func (l *lexicalNode) ValStr() string {
|
||||
return fmt.Sprintf("%v", l.Val)
|
||||
}
|
||||
|
Reference in New Issue
Block a user