| 194 | } |
| 195 | |
| 196 | func (e *encoder) mappings(m *semantic.Mappings) *Mappings { |
| 197 | out := Mappings{} |
| 198 | |
| 199 | for sem, asts := range m.SemanticToAST { |
| 200 | for _, ast := range asts { |
| 201 | out.SemToAst = append(out.SemToAst, &SemanticToAST{ |
| 202 | Sem: e.node(sem), |
| 203 | Ast: e.astNode(ast), |
| 204 | }) |
| 205 | } |
| 206 | } |
| 207 | |
| 208 | for ast, cst := range m.AST.ASTToCST { |
| 209 | out.AstToCst = append(out.AstToCst, &ASTToCST{ |
| 210 | Ast: e.astNode(ast), |
| 211 | Cst: e.cstNode(cst), |
| 212 | }) |
| 213 | } |
| 214 | |
| 215 | return &out |
| 216 | } |
| 217 | |
| 218 | func (e *encoder) node(n semantic.Node) *Node { |
| 219 | switch n := n.(type) { |