memos/plugin/gomark/ast/node.go
2023-12-12 23:24:02 +08:00

20 lines
326 B
Go

package ast
type Node interface {
Type() NodeType
}
type NodeType int
func (t NodeType) String() string {
return nodeTypeNames[t]
}
var nodeTypeIndex NodeType
var nodeTypeNames = []string{""}
func NewNodeType(name string) NodeType {
nodeTypeNames = append(nodeTypeNames, name)
nodeTypeIndex++
return nodeTypeIndex
}