(n cst.Node)
| 2116 | } |
| 2117 | |
| 2118 | func (e *encoder) cstNode(n cst.Node) (out *CSTNode) { |
| 2119 | switch n := n.(type) { |
| 2120 | case *cst.Branch: |
| 2121 | return &CSTNode{Ty: &CSTNode_Branch{e.cstBranch(n)}} |
| 2122 | case *cst.Leaf: |
| 2123 | return &CSTNode{Ty: &CSTNode_Leaf{e.cstLeaf(n)}} |
| 2124 | default: |
| 2125 | panic(fmt.Errorf("Unhandled CST Node: %T", n)) |
| 2126 | } |
| 2127 | } |
| 2128 | |
| 2129 | func (e *encoder) cstSeparator(n cst.Separator) *CSTSeparator { |
| 2130 | if len(n) == 0 { |