mirror of
https://github.com/usememos/memos.git
synced 2025-01-08 05:10:34 +08:00
20 lines
326 B
Go
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
|
|
}
|