mirror of
https://github.com/usememos/memos.git
synced 2025-02-23 14:47:44 +01:00
21 lines
326 B
Go
21 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
|
|
}
|