You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
memos/plugin/gomark/ast/node.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
}